strus  0.17
Public Member Functions | List of all members
strus::DatabaseClientInterface Class Referenceabstract

Interface for accessing the strus key value storage database. More...

#include <databaseClientInterface.hpp>

Public Member Functions

virtual ~DatabaseClientInterface ()
 Destructor. More...
 
virtual
DatabaseTransactionInterface
createTransaction ()=0
 Create a transaction object for the database. More...
 
virtual DatabaseCursorInterfacecreateCursor (const DatabaseOptions &options) const =0
 Create an object for reading values from and iterating on the key value store database. More...
 
virtual
DatabaseBackupCursorInterface
createBackupCursor () const =0
 Creates an object for iterating on a snapshot of the database that can be used for backup. More...
 
virtual void writeImm (const char *key, std::size_t keysize, const char *value, std::size_t valuesize)=0
 Write a key value immediately (synchronized) More...
 
virtual void removeImm (const char *key, std::size_t keysize)=0
 Delete a key value stored immediately (synchronized) More...
 
virtual bool readValue (const char *key, std::size_t keysize, std::string &value, const DatabaseOptions &options) const =0
 Read a value by key. More...
 
virtual std::string config () const =0
 Get the interpreted configuration this database client was created with. More...
 
virtual bool compactDatabase ()=0
 Compact database structures for faster read access after the first open. More...
 
virtual void close ()=0
 Close client connection and eventually do some cleanup. More...
 

Detailed Description

Interface for accessing the strus key value storage database.

Constructor & Destructor Documentation

virtual strus::DatabaseClientInterface::~DatabaseClientInterface ( )
inlinevirtual

Destructor.

Remarks
Should call call 'close()' but ignore errors there silently

Member Function Documentation

virtual void strus::DatabaseClientInterface::close ( )
pure virtual

Close client connection and eventually do some cleanup.

Remarks
This method is not implicitely called with the destructor because it might be a complicated operation that cannot be afforded in panic shutdown.
virtual bool strus::DatabaseClientInterface::compactDatabase ( )
pure virtual

Compact database structures for faster read access after the first open.

Note
Calling this method speeds up the first open for some database implementations like LevelDB after big inserts.
Remarks
This method does not have to be called, it is automatically called on the first open. It may last some minutes for larger databases.
virtual std::string strus::DatabaseClientInterface::config ( ) const
pure virtual

Get the interpreted configuration this database client was created with.

Returns
the configuration as string
virtual DatabaseBackupCursorInterface* strus::DatabaseClientInterface::createBackupCursor ( ) const
pure virtual

Creates an object for iterating on a snapshot of the database that can be used for backup.

Returns
the created cursor interface to be disposed with delete by the caller
virtual DatabaseCursorInterface* strus::DatabaseClientInterface::createCursor ( const DatabaseOptions options) const
pure virtual

Create an object for reading values from and iterating on the key value store database.

Parameters
[in]optionsoptions for the created cursor
Returns
the created cursor interface to be disposed with delete by the caller
virtual DatabaseTransactionInterface* strus::DatabaseClientInterface::createTransaction ( )
pure virtual

Create a transaction object for the database.

Returns
the created transaction interface to be disposed with delete by the caller
virtual bool strus::DatabaseClientInterface::readValue ( const char *  key,
std::size_t  keysize,
std::string &  value,
const DatabaseOptions options 
) const
pure virtual

Read a value by key.

Parameters
[in]keypointer to the key of the item to fetch
[in]keysizesize of the key of the item to fetch in bytes
[out]valuethe value as string
[in]optionsoptions as hints for the database
Returns
true, if it was found
virtual void strus::DatabaseClientInterface::removeImm ( const char *  key,
std::size_t  keysize 
)
pure virtual

Delete a key value stored immediately (synchronized)

Parameters
[in]keypointer to the key of the item to write
[in]keysizesize of the key of the item to write in bytes
virtual void strus::DatabaseClientInterface::writeImm ( const char *  key,
std::size_t  keysize,
const char *  value,
std::size_t  valuesize 
)
pure virtual

Write a key value immediately (synchronized)

Parameters
[in]keypointer to the key of the item to write
[in]keysizesize of the key of the item to write in bytes
[in]valuepointer to value to write
[in]valuesizesize of value to write in bytes
Note
Replaces existing duplicate entry in the database (not issuing an error)

The documentation for this class was generated from the following file: