threaddb  1.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 
13 #include "threaddbTypes.h"
14 
15 #if defined(__cplusplus)
16 extern "C"
17 {
18 #endif
19 
40  DLLEXPORT_ threadDB_ReturnCode ThreadDB_Create(void** pThreadDB_p, size_t PackageSize_p, size_t PackageCacheLimit_p);
41 
58  DLLEXPORT_ threadDB_ReturnCode ThreadDB_Import(void** pThreadDB_p, const char* pIndexFileUTF8_p, size_t PackageCacheLimit_p);
59 
70  DLLEXPORT_ void ThreadDB_Destroy(void* pThreadDB_p);
71 
82  DLLEXPORT_ const char* ThreadDB_GetVersionInfo(void* pThreadDB_p);
83 
96  DLLEXPORT_ threadDB_ReturnCode ThreadDB_Save(const char* pIndexFileUTF8_p, void* pThreadDB_p);
97 
118  DLLEXPORT_ threadDB_ReturnCode ThreadDB_NewThread(const char** pFileName_p, const char* pFolder_p, size_t MaxFileSize_p, void* pThreadDB_p);
119 
132  DLLEXPORT_ threadDB_ReturnCode ThreadDB_NewPackage(uint64_t* pPackageID_p, void* pThreadDB_p);
133 
145  DLLEXPORT_ size_t ThreadDB_GetPackageCount(void* pThreadDB_p);
146 
158  DLLEXPORT_ size_t ThreadDB_GetFileCount(void* pThreadDB_p);
159 
172  DLLEXPORT_ const char* ThreadDB_GetDatabaseFileName(size_t FileIndex_p, void* pThreadDB_p);
173 
188  DLLEXPORT_ threadDB_ReturnCode ThreadDB_RelocateFileTo(size_t FileID_p, const char* pFilePathUTF8_p, threadDB_RelocationType RelocationType_p, void* pThreadDB_p);
189 
215  DLLEXPORT_ threadDB_ReturnCode ThreadDB_Store(uint64_t Package_p, size_t Size_p, const char pData_p[], threadDB_ItemInfo* pItemHandle_p, void* pThreadDB_p);
216 
230 
244  DLLEXPORT_ threadDB_ReturnCode ThreadDB_Open(threadDB_ReadInfo** pReadInfo_p, size_t Package_p, void* pThreadDB_p);
245 
257  DLLEXPORT_ threadDB_ReturnCode ThreadDB_Close(threadDB_ReadInfo** pReadInfo_p, void* pThreadDB_p);
258 
275  DLLEXPORT_ threadDB_ReturnCode ThreadDB_Recover(size_t* pReadBytes_p, size_t Size_p, char pData_p[], threadDB_ReadInfo* pReadInfo_p, void* pThreadDB_p);
276 
295  DLLEXPORT_ threadDB_ReturnCode ThreadDB_RecoverItem(size_t Size_p, char pData_p[], threadDB_ItemInfo* pItemHandle_p, void* pThreadDB_p);
296 
311  DLLEXPORT_ threadDB_ReturnCode ThreadDB_Replace(size_t Size_p, const char pData_p[], const threadDB_ItemInfo* pItemHandle_p, void* pThreadDB_p);
312 
323  DLLEXPORT_ const char* ThreadDB_GetErrorMessage(void* pThreadDB_p);
324 
325 #if defined(__cplusplus)
326 }
327 #endif
ThreadDB_GetErrorMessage
const DLLEXPORT_ char * ThreadDB_GetErrorMessage(void *pThreadDB_p)
Information on error state.
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_GetFileCount
DLLEXPORT_ size_t ThreadDB_GetFileCount(void *pThreadDB_p)
Returns the number of currently registered temporary database files.
DLLEXPORT_
#define DLLEXPORT_
Definition: threaddbTypes.h:20
ThreadDB_Save
DLLEXPORT_ threadDB_ReturnCode ThreadDB_Save(const char *pIndexFileUTF8_p, void *pThreadDB_p)
Interface to save the stored data.
ThreadDB_Open
DLLEXPORT_ threadDB_ReturnCode ThreadDB_Open(threadDB_ReadInfo **pReadInfo_p, size_t Package_p, void *pThreadDB_p)
This operation opens a package for stream reading.
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.
threaddbTypes.h
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_RecoverItem
DLLEXPORT_ threadDB_ReturnCode ThreadDB_RecoverItem(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_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 disc.
ThreadDB_Create
DLLEXPORT_ threadDB_ReturnCode ThreadDB_Create(void **pThreadDB_p, size_t PackageSize_p, size_t PackageCacheLimit_p)
Interface for creating a new database object.
threadDB_ReadInfo
Stream reading control information.
Definition: threaddbTypes.h:74
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:56
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_Recover
DLLEXPORT_ threadDB_ReturnCode ThreadDB_Recover(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_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:92
threadDB_ReturnCode
int32_t threadDB_ReturnCode
Definition: threaddbTypes.h:97