 |
threaddb
2.0
A file mapped memory container extension
|
Go to the documentation of this file.
24 #define threadDB_throw(a)\
26 throw std::runtime_error(ThreadDB_GetErrorMessage(m_pThreadDB));
74 m_pReadInfo(pReadInfo_p),
75 m_pThreadDB(pThreadDB_p)
105 database(
size_t PackageSize_p = 4096,
size_t PackageCacheLimit_p = std::numeric_limits<size_t>::max(),
const std::string& rPackagesPath_p =
"") :
108 if (
ThreadDB_Create(&m_pThreadDB, PackageSize_p, PackageCacheLimit_p, rPackagesPath_p.empty()?0:rPackagesPath_p.c_str()))
110 throw std::runtime_error(
"Error creating the database.");
118 database(
const std::string& rIndexFileUTF8_p,
size_t PackageCacheLimit_p = std::numeric_limits<size_t>::max()) :
121 if (
ThreadDB_Import(&m_pThreadDB, rIndexFileUTF8_p.c_str(), PackageCacheLimit_p))
123 throw std::runtime_error(
"Error creating the database.");
149 void Save(
const char* pIndexFileUTF8_p)
158 const char*
NewThread(
const char* pDataFolder_p,
size_t MaxFileSize_p = std::numeric_limits<size_t>::max())
160 const char* pFileName_p = 0;
171 uint64_t packageID = 0;
291 size_t readBytes = 0;
329 void operator=(
const database&) =
delete;
size_t GetThreadCount() const
C++ wrapper to retrieve the number of running threads see ThreadDB_GetThreadCount.
Definition: threaddbCPP.h:180
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.
size_t GetFileCount() const
C++ wrapper to retrieve the number of registered temporary database files see ThreadDB_GetFileCount.
Definition: threaddbCPP.h:198
C++ wrapper class to the threadDB_ReadInfo control structure.
Definition: threaddbCPP.h:70
DLLEXPORT_ size_t ThreadDB_GetThreadCount(void *pThreadDB_p)
Returns the number of currently running threads.
bool Unregistered() const
Definition: threaddbCPP.h:63
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.
C++ wrapper class to the threadDB_ItemInfo control structure.
Definition: threaddbCPP.h:52
const DLLEXPORT_ char * ThreadDB_GetVersionInfo(void *pThreadDB_p)
Interface for retrieving the package version info.
~ReadInfo()
Definition: threaddbCPP.h:78
LinkInfo()
Definition: threaddbCPP.h:38
DLLEXPORT_ threadDB_ReturnCode ThreadDB_Synchronize(void *pThreadDB_p)
Synchronizes the internal package buffers with the temporary database files.
database(const std::string &rIndexFileUTF8_p, size_t PackageCacheLimit_p=std::numeric_limits< size_t >::max())
C++ wrapper to construct a threadDB database object from file see ThreadDB_Import.
Definition: threaddbCPP.h:118
size_t GetPackageCount() const
C++ wrapper to retrieve the number of registered packages see ThreadDB_GetPackageCount.
Definition: threaddbCPP.h:189
ReadInfo(threadDB_ReadInfo *pReadInfo_p, void *pThreadDB_p)
Definition: threaddbCPP.h:73
~database()
C++ wrapper to destruct a threadDB database object see ThreadDB_Destroy.
Definition: threaddbCPP.h:131
DLLEXPORT_ size_t ThreadDB_GetPackageCount(void *pThreadDB_p)
Returns the number of currently registered packages.
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 disk see ThreadDB_RelocateFileTo.
Definition: threaddbCPP.h:225
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.
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:234
DLLEXPORT_ size_t ThreadDB_GetFileCount(void *pThreadDB_p)
Returns the number of currently registered temporary database files.
Data item entry index.
Definition: threaddbTypes.h:46
DLLEXPORT_ threadDB_ReturnCode ThreadDB_Save(const char *pIndexFileUTF8_p, void *pThreadDB_p)
Interface to save the stored data.
~ItemInfo()
Definition: threaddbCPP.h:59
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:158
Definition: threaddbCPP.h:28
List of interface methods to the database.
database(size_t PackageSize_p=4096, size_t PackageCacheLimit_p=std::numeric_limits< size_t >::max(), const std::string &rPackagesPath_p="")
C++ wrapper to construct a threadDB database object see ThreadDB_Create.
Definition: threaddbCPP.h:105
bool End(const tdb::ReadInfo &rReadInfo_p) const
C++ wrapper for stream end indicator see ThreadDB_PackageEnd.
Definition: threaddbCPP.h:302
const char * GetVersionInfo() const
C++ wrapper to retrieve the version information of the current installation see ThreadDB_GetVersionIn...
Definition: threaddbCPP.h:140
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.
void Synchronize(uint64_t Package_p)
C++ wrapper to synchronize the package buffers prior reading see ThreadDB_Synchronize.
Definition: threaddbCPP.h:243
void Recover(uint32_t Size_p, char pData_p[], const tdb::ItemInfo &rItemHandle_p, uint64_t Package_p)
C++ wrapper for random reading of data items see ThreadDB_RecoverRandom.
Definition: threaddbCPP.h:313
DLLEXPORT_ size_t ThreadDB_GetPackageSize(void *pThreadDB_p)
Returns the package buffer size.
const DLLEXPORT_ char * ThreadDB_GetDatabaseFileName(size_t FileIndex_p, void *pThreadDB_p)
Returns the filename of a currently registered temporary database files.
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.
size_t GetPackageSize() const
C++ wrapper to retrieve the size of the internally allocated package buffers see ThreadDB_GetPackageS...
Definition: threaddbCPP.h:207
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 * Get() const
Definition: threaddbCPP.h:83
void Save(const char *pIndexFileUTF8_p)
C++ wrapper to save the contents of a threadDB database see ThreadDB_Save.
Definition: threaddbCPP.h:149
void Synchronize()
C++ wrapper to synchronize the package buffers prior reading see ThreadDB_Synchronize.
Definition: threaddbCPP.h:252
C++ wrapper class of the threadDB file mapped memory container extension.
Definition: threaddbCPP.h:97
Stream reading control information.
Definition: threaddbTypes.h:81
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_RecoverContinous.
Definition: threaddbCPP.h:289
Random access managment information.
Definition: threaddbTypes.h:63
tdb::ReadInfo Open(const tdb::ItemInfo &rItemHandle_p)
C++ wrapper to open a package for stream reading see ThreadDB_OpenItem.
Definition: threaddbCPP.h:276
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:169
DLLEXPORT_ bool ThreadDB_PackageEnd(threadDB_ReadInfo *pReadInfo_p, void *pThreadDB_p)
Stream reading operation through the data items stored in a package.
C++ wrapper class to the threadDB_LinkInfo control structure.
Definition: threaddbCPP.h:35
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.
DLLEXPORT_ threadDB_ReturnCode ThreadDB_SynchronizePackage(uint64_t Package_p, void *pThreadDB_p)
Synchronizes the internal package buffers with the temporary database files.
DLLEXPORT_ threadDB_ReturnCode ThreadDB_Open(threadDB_ReadInfo **pReadInfo_p, uint64_t Package_p, void *pThreadDB_p)
This operation opens a package for stream reading.
#define threadDB_throw(a)
Definition: threaddbCPP.h:24
~LinkInfo()
Definition: threaddbCPP.h:42
tdb::ReadInfo Open(uint64_t Package_p)
C++ wrapper to open a package for stream reading see ThreadDB_Open.
Definition: threaddbCPP.h:263
void Replace(size_t Size_p, const char pData_p[], tdb::ItemInfo &rItemHandle_p)
C++ wrapper for replacing the contents of a data item see ThreadDB_Replace.
Definition: threaddbCPP.h:322
ItemInfo()
Definition: threaddbCPP.h:55
volatile uint32_t m_PackageSize
Size of the data record in bytes.
Definition: threaddbTypes.h:67
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:98
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:216