 |
threaddb
1.0
A file mapped memory container extension
|
Go to the documentation of this file.
18 #define threadDB_throw(a)\
20 throw std::runtime_error(ThreadDB_GetErrorMessage(m_pThreadDB));
34 m_pReadInfo(pReadInfo_p),
35 m_pThreadDB(pThreadDB_p)
65 database(
size_t PackageSize_p,
size_t PackageCacheLimit_p) :
70 throw std::runtime_error(
"Error creating the database.");
78 database(
const std::string& rIndexFileUTF8_p,
size_t PackageCacheLimit_p) :
81 if (
ThreadDB_Import(&m_pThreadDB, rIndexFileUTF8_p.c_str(), PackageCacheLimit_p))
83 throw std::runtime_error(
"Error creating the database.");
109 void Save(
const char* pIndexFileUTF8_p)
118 const char*
NewThread(
const char* pDataFolder_p,
size_t MaxFileSize_p = std::numeric_limits<size_t>::max())
120 const char* pFileName_p = 0;
131 uint64_t packageID = 0;
211 size_t readBytes = 0;
size_t GetFileCount() const
C++ wrapper to retrieve the number of registered temporary database files see ThreadDB_GetFileCount.
Definition: threaddbCPP.h:149
C++ wrapper class to the threadDB_ReadInfo control structure.
Definition: threaddbCPP.h:30
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.
void Replace(size_t Size_p, const char pData_p[], threadDB_ItemInfo &rItemHandle_p)
C++ wrapper for replacing the contents of a data item see ThreadDB_Replace.
Definition: threaddbCPP.h:233
const DLLEXPORT_ char * ThreadDB_GetVersionInfo(void *pThreadDB_p)
Interface for retrieving the package version info.
~ReadInfo()
Definition: threaddbCPP.h:38
DLLEXPORT_ threadDB_ReturnCode ThreadDB_Synchronize(void *pThreadDB_p)
Synchronizes the internal package buffers with the temporary database files.
size_t GetPackageCount() const
C++ wrapper to retrieve the number of registered packages see ThreadDB_GetPackageCount.
Definition: threaddbCPP.h:140
ReadInfo(threadDB_ReadInfo *pReadInfo_p, void *pThreadDB_p)
Definition: threaddbCPP.h:33
~database()
C++ wrapper to destruct a threadDB database object see ThreadDB_Destroy.
Definition: threaddbCPP.h:91
DLLEXPORT_ size_t ThreadDB_GetPackageCount(void *pThreadDB_p)
Returns the number of currently registered packages.
database(size_t PackageSize_p, size_t PackageCacheLimit_p)
C++ wrapper to construct a threadDB database object see ThreadDB_Create.
Definition: threaddbCPP.h:65
void RelocateFileTo(size_t FileID_p, const char *pFilePathUTF8_p, threadDB_RelocationType RelocationType_p) const
C++ wrapper to move a file to a different location or disc see ThreadDB_RelocateFileTo.
Definition: threaddbCPP.h:167
threadDB_ItemInfo ItemInfo
Definition: threaddbCPP.h:24
void Store(uint64_t Package_p, size_t Size_p, const char pData_p[], threadDB_ItemInfo *pItemHandle_p=0)
C++ wrapper to store a data item in the selected package see ThreadDB_Store.
Definition: threaddbCPP.h:176
DLLEXPORT_ size_t ThreadDB_GetFileCount(void *pThreadDB_p)
Returns the number of currently registered temporary database files.
DLLEXPORT_ threadDB_ReturnCode ThreadDB_Save(const char *pIndexFileUTF8_p, void *pThreadDB_p)
Interface to save the stored data.
const char * NewThread(const char *pDataFolder_p, size_t MaxFileSize_p=std::numeric_limits< size_t >::max())
C++ wrapper to create and register a threadDB worker thread see ThreadDB_NewThread.
Definition: threaddbCPP.h:118
Definition: threaddbCPP.h:22
DLLEXPORT_ threadDB_ReturnCode ThreadDB_Open(threadDB_ReadInfo **pReadInfo_p, size_t Package_p, void *pThreadDB_p)
This operation opens a package for stream reading.
const char * GetVersionInfo() const
C++ wrapper to retrieve the version information of the current installation see ThreadDB_GetVersionIn...
Definition: threaddbCPP.h:100
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.
const DLLEXPORT_ char * ThreadDB_GetDatabaseFileName(size_t FileIndex_p, void *pThreadDB_p)
Returns the filename of a currently registered temporary database files.
tdb::ReadInfo Open(size_t Package_p)
C++ wrapper to open a package for stream reading see ThreadDB_Open.
Definition: threaddbCPP.h:196
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.
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.
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 * Get() const
Definition: threaddbCPP.h:43
void Save(const char *pIndexFileUTF8_p)
C++ wrapper to save the contents of a threadDB database see ThreadDB_Save.
Definition: threaddbCPP.h:109
void Synchronize()
C++ wrapper to synchronize the package buffers prior reading see ThreadDB_Synchronize.
Definition: threaddbCPP.h:185
C++ wrapper class of the threadDB file mapped memory container extension.
Definition: threaddbCPP.h:57
Stream reading control information.
Definition: threaddbTypes.h:74
DLLEXPORT_ threadDB_ReturnCode ThreadDB_Close(threadDB_ReadInfo **pReadInfo_p, void *pThreadDB_p)
This operation closes a package after stream reading has finished.
DLLEXPORT_ void ThreadDB_Destroy(void *pThreadDB_p)
Interface to destroy an existing database object.
size_t Recover(size_t Size_p, char pData_p[], tdb::ReadInfo &rReadInfo_p)
C++ wrapper for stream reading of data items see ThreadDB_Recover.
Definition: threaddbCPP.h:209
Random access managment information.
Definition: threaddbTypes.h:56
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.
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.
uint64_t NewPackage()
C++ wrapper to create and register a threadDB data package see ThreadDB_NewPackage.
Definition: threaddbCPP.h:129
database(const std::string &rIndexFileUTF8_p, size_t PackageCacheLimit_p)
C++ wrapper to construct a threadDB database object from file see ThreadDB_Import.
Definition: threaddbCPP.h:78
threadDB_ItemInfo Recover(size_t Size_p, char pData_p[], const threadDB_ItemInfo &rItemHandle_p)
C++ wrapper for random reading of data items see ThreadDB_RecoverItem.
Definition: threaddbCPP.h:222
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.
#define threadDB_throw(a)
Definition: threaddbCPP.h:18
DLLEXPORT_ threadDB_ReturnCode ThreadDB_NewPackage(uint64_t *pPackageID_p, void *pThreadDB_p)
Registers a new data item package.
threadDB_RelocationType
Type of action to be performed when relocating a temporary database file.
Definition: threaddbTypes.h:92
const char * GetDatabaseFilename(size_t FileIndex_p) const
C++ wrapper to derive the name of the temporary database file with index FileIndex_p ThreadDB_GetData...
Definition: threaddbCPP.h:158