| threaddb 2.0 A file mapped memory container extension

threaddbC.h
Go to the documentation of this file.
1 /*
2 Copyright (c) 2019 by The ThreadDB Project
3 All Rights Reserved.
4
5 ThreadDB undergoes the BSD License 2.0. You should have received a copy along with this program; if not, write to the ThreadDB Project.
6 To obtain a full unlimited version contact thethreaddbproject(at)gmail.com.
7
8 threaddbC.h - C Interface to the ThreadDB memory container database
9 */
10
11 #pragma once
12
20 #include "threaddbTypes.h"
21
22 #if defined(__cplusplus) || defined(__MINGW32__) || defined(__MINGW64__)
23 extern "C"
24 {
25 #endif
26
48 DLLEXPORT_ threadDB_ReturnCode ThreadDB_Create(void** pThreadDB_p, size_t PackageSize_p, size_t PackageCacheLimit_p, const char* pPackagesFolder_p);
49
66 DLLEXPORT_ threadDB_ReturnCode ThreadDB_Import(void** pThreadDB_p, const char* pIndexFileUTF8_p, size_t PackageCacheLimit_p);
67
78 DLLEXPORT_ void ThreadDB_Destroy(void* pThreadDB_p);
79
90 DLLEXPORT_ const char* ThreadDB_GetVersionInfo(void* pThreadDB_p);
91
104 DLLEXPORT_ threadDB_ReturnCode ThreadDB_Save(const char* pIndexFileUTF8_p, void* pThreadDB_p);
105
126 DLLEXPORT_ threadDB_ReturnCode ThreadDB_NewThread(const char** pFileName_p, const char* pFolder_p, size_t MaxFileSize_p, void* pThreadDB_p);
127
140 DLLEXPORT_ threadDB_ReturnCode ThreadDB_NewPackage(uint64_t* pPackageID_p, void* pThreadDB_p);
141
152 DLLEXPORT_ size_t ThreadDB_GetThreadCount(void* pThreadDB_p);
153
164 DLLEXPORT_ size_t ThreadDB_GetPackageCount(void* pThreadDB_p);
165
176 DLLEXPORT_ size_t ThreadDB_GetFileCount(void* pThreadDB_p);
177
188 DLLEXPORT_ size_t ThreadDB_GetPackageSize(void* pThreadDB_p);
189
202 DLLEXPORT_ const char* ThreadDB_GetDatabaseFileName(size_t FileIndex_p, void* pThreadDB_p);
203
218 DLLEXPORT_ threadDB_ReturnCode ThreadDB_RelocateFileTo(size_t FileID_p, const char* pFilePathUTF8_p, threadDB_RelocationType RelocationType_p, void* pThreadDB_p);
219
245 DLLEXPORT_ threadDB_ReturnCode ThreadDB_Store(uint64_t Package_p, size_t Size_p, const char pData_p[], threadDB_ItemInfo* pItemHandle_p, void* pThreadDB_p);
246
259 DLLEXPORT_ threadDB_ReturnCode ThreadDB_SynchronizePackage(uint64_t Package_p, void* pThreadDB_p);
260
273 DLLEXPORT_ threadDB_ReturnCode ThreadDB_Synchronize(void* pThreadDB_p);
274
288 DLLEXPORT_ threadDB_ReturnCode ThreadDB_Open(threadDB_ReadInfo** pReadInfo_p, uint64_t Package_p, void* pThreadDB_p);
289
302 DLLEXPORT_ threadDB_ReturnCode ThreadDB_OpenItem(threadDB_ReadInfo** pReadInfo_p, const threadDB_ItemInfo* pItemHandle_p, void* pThreadDB_p);
303
315 DLLEXPORT_ threadDB_ReturnCode ThreadDB_Close(threadDB_ReadInfo** pReadInfo_p, void* pThreadDB_p);
316
333 DLLEXPORT_ threadDB_ReturnCode ThreadDB_RecoverContinous(size_t* pReadBytes_p, size_t Size_p, char pData_p[], threadDB_ReadInfo* pReadInfo_p, void* pThreadDB_p);
334
353 DLLEXPORT_ threadDB_ReturnCode ThreadDB_RecoverRandom(uint32_t Size_p, char pData_p[], const threadDB_ItemInfo* pItemHandle_p, uint64_t Package_p, void* pThreadDB_p);
354
373 DLLEXPORT_ threadDB_ReturnCode ThreadDB_RecoverRandomContinous(size_t Size_p, char pData_p[], threadDB_ItemInfo* pItemHandle_p, void* pThreadDB_p);
374
386 DLLEXPORT_ bool ThreadDB_PackageEnd(threadDB_ReadInfo* pReadInfo_p, void* pThreadDB_p);
387
402 DLLEXPORT_ threadDB_ReturnCode ThreadDB_Replace(size_t Size_p, const char pData_p[], const threadDB_ItemInfo* pItemHandle_p, void* pThreadDB_p);
403
414 DLLEXPORT_ const char* ThreadDB_GetErrorMessage(void* pThreadDB_p);
415
416 #if defined(__cplusplus)
417 }
418 #endif
ThreadDB_GetErrorMessage
const DLLEXPORT_ char * ThreadDB_GetErrorMessage(void *pThreadDB_p)
Information on error state.
ThreadDB_OpenItem
DLLEXPORT_ threadDB_ReturnCode ThreadDB_OpenItem(threadDB_ReadInfo **pReadInfo_p, const threadDB_ItemInfo *pItemHandle_p, void *pThreadDB_p)
This operation opens a package for stream reading at the given item cursor.
ThreadDB_GetThreadCount
DLLEXPORT_ size_t ThreadDB_GetThreadCount(void *pThreadDB_p)
Returns the number of currently running threads.
ThreadDB_Store
DLLEXPORT_ threadDB_ReturnCode ThreadDB_Store(uint64_t Package_p, size_t Size_p, const char pData_p[], threadDB_ItemInfo *pItemHandle_p, void *pThreadDB_p)
Stores database package items in the specified package.
ThreadDB_GetVersionInfo
const DLLEXPORT_ char * ThreadDB_GetVersionInfo(void *pThreadDB_p)
Interface for retrieving the package version info.
ThreadDB_Synchronize
DLLEXPORT_ threadDB_ReturnCode ThreadDB_Synchronize(void *pThreadDB_p)
Synchronizes the internal package buffers with the temporary database files.
ThreadDB_GetPackageCount
DLLEXPORT_ size_t ThreadDB_GetPackageCount(void *pThreadDB_p)
Returns the number of currently registered packages.
ThreadDB_RecoverRandomContinous
DLLEXPORT_ threadDB_ReturnCode ThreadDB_RecoverRandomContinous(size_t Size_p, char pData_p[], threadDB_ItemInfo *pItemHandle_p, void *pThreadDB_p)
Random access operation to the data items stored in a package.
ThreadDB_RecoverContinous
DLLEXPORT_ threadDB_ReturnCode ThreadDB_RecoverContinous(size_t *pReadBytes_p, size_t Size_p, char pData_p[], threadDB_ReadInfo *pReadInfo_p, void *pThreadDB_p)
Stream reading operation through the data items stored in a package.
ThreadDB_GetFileCount
DLLEXPORT_ size_t ThreadDB_GetFileCount(void *pThreadDB_p)
Returns the number of currently registered temporary database files.
DLLEXPORT_
#define DLLEXPORT_
Definition: threaddbTypes.h:27
ThreadDB_Save
DLLEXPORT_ threadDB_ReturnCode ThreadDB_Save(const char *pIndexFileUTF8_p, void *pThreadDB_p)
Interface to save the stored data.
ThreadDB_Replace
DLLEXPORT_ threadDB_ReturnCode ThreadDB_Replace(size_t Size_p, const char pData_p[], const threadDB_ItemInfo *pItemHandle_p, void *pThreadDB_p)
Replace operation to modify the contents of a stored data item.
ThreadDB_GetPackageSize
DLLEXPORT_ size_t ThreadDB_GetPackageSize(void *pThreadDB_p)
Returns the package buffer size.
threaddbTypes.h
Basic data types used by the interface.
ThreadDB_GetDatabaseFileName
const DLLEXPORT_ char * ThreadDB_GetDatabaseFileName(size_t FileIndex_p, void *pThreadDB_p)
Returns the filename of a currently registered temporary database files.
ThreadDB_RecoverRandom
DLLEXPORT_ threadDB_ReturnCode ThreadDB_RecoverRandom(uint32_t Size_p, char pData_p[], const threadDB_ItemInfo *pItemHandle_p, uint64_t Package_p, void *pThreadDB_p)
Random access operation to the data items stored in a package.
ThreadDB_RelocateFileTo
DLLEXPORT_ threadDB_ReturnCode ThreadDB_RelocateFileTo(size_t FileID_p, const char *pFilePathUTF8_p, threadDB_RelocationType RelocationType_p, void *pThreadDB_p)
Renames and copies/moves a temporary database file to a different location or disk.
threadDB_ReadInfo
Stream reading control information.
Definition: threaddbTypes.h:81
ThreadDB_Close
DLLEXPORT_ threadDB_ReturnCode ThreadDB_Close(threadDB_ReadInfo **pReadInfo_p, void *pThreadDB_p)
This operation closes a package after stream reading has finished.
ThreadDB_Destroy
DLLEXPORT_ void ThreadDB_Destroy(void *pThreadDB_p)
Interface to destroy an existing database object.
threadDB_ItemInfo
Random access managment information.
Definition: threaddbTypes.h:63
ThreadDB_Import
DLLEXPORT_ threadDB_ReturnCode ThreadDB_Import(void **pThreadDB_p, const char *pIndexFileUTF8_p, size_t PackageCacheLimit_p)
Interface for creating a new database object based on a database index file.
ThreadDB_NewThread
DLLEXPORT_ threadDB_ReturnCode ThreadDB_NewThread(const char **pFileName_p, const char *pFolder_p, size_t MaxFileSize_p, void *pThreadDB_p)
Interface to create and register a new worker thread.
ThreadDB_PackageEnd
DLLEXPORT_ bool ThreadDB_PackageEnd(threadDB_ReadInfo *pReadInfo_p, void *pThreadDB_p)
Stream reading operation through the data items stored in a package.
ThreadDB_Create
DLLEXPORT_ threadDB_ReturnCode ThreadDB_Create(void **pThreadDB_p, size_t PackageSize_p, size_t PackageCacheLimit_p, const char *pPackagesFolder_p)
Interface for creating a new database object.
ThreadDB_SynchronizePackage
DLLEXPORT_ threadDB_ReturnCode ThreadDB_SynchronizePackage(uint64_t Package_p, void *pThreadDB_p)
Synchronizes the internal package buffers with the temporary database files.
ThreadDB_Open
DLLEXPORT_ threadDB_ReturnCode ThreadDB_Open(threadDB_ReadInfo **pReadInfo_p, uint64_t Package_p, void *pThreadDB_p)
This operation opens a package for stream reading.
ThreadDB_NewPackage
DLLEXPORT_ threadDB_ReturnCode ThreadDB_NewPackage(uint64_t *pPackageID_p, void *pThreadDB_p)
Registers a new data item package.
threadDB_RelocationType
threadDB_RelocationType
Type of action to be performed when relocating a temporary database file.
Definition: threaddbTypes.h:98
threadDB_ReturnCode
int32_t threadDB_ReturnCode
Definition: threaddbTypes.h:103