strus  0.17
databaseClientInterface.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 Patrick P. Frey
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
10 #ifndef _STRUS_DATABASE_CLIENT_INTERFACE_HPP_INCLUDED
11 #define _STRUS_DATABASE_CLIENT_INTERFACE_HPP_INCLUDED
12 #include <string>
13 
14 namespace strus
15 {
16 
18 class DatabaseTransactionInterface;
20 class DatabaseCursorInterface;
22 class DatabaseBackupCursorInterface;
24 class DatabaseOptions;
25 
28 {
29 public:
33 
37 
41  virtual DatabaseCursorInterface* createCursor( const DatabaseOptions& options) const=0;
42 
46 
53  virtual void writeImm(
54  const char* key,
55  std::size_t keysize,
56  const char* value,
57  std::size_t valuesize)=0;
58 
62  virtual void removeImm(
63  const char* key,
64  std::size_t keysize)=0;
65 
72  virtual bool readValue(
73  const char* key,
74  std::size_t keysize,
75  std::string& value,
76  const DatabaseOptions& options) const=0;
77 
80  virtual std::string config() const=0;
81 
85  virtual bool compactDatabase()=0;
86 
89  virtual void close()=0;
90 };
91 
92 }//namespace
93 #endif
94 
95 
virtual DatabaseCursorInterface * createCursor(const DatabaseOptions &options) const =0
Create an object for reading values from and iterating on the key value store database.
Interface to database cursor.
Definition: databaseCursorInterface.hpp:18
virtual DatabaseTransactionInterface * createTransaction()=0
Create a transaction object for the database.
Interface for accessing the strus key value storage database.
Definition: databaseClientInterface.hpp:27
virtual bool compactDatabase()=0
Compact database structures for faster read access after the first open.
virtual DatabaseBackupCursorInterface * createBackupCursor() const =0
Creates an object for iterating on a snapshot of the database that can be used for backup...
virtual void close()=0
Close client connection and eventually do some cleanup.
virtual void removeImm(const char *key, std::size_t keysize)=0
Delete a key value stored immediately (synchronized)
virtual ~DatabaseClientInterface()
Destructor.
Definition: databaseClientInterface.hpp:32
virtual std::string config() const =0
Get the interpreted configuration this database client was created with.
virtual bool readValue(const char *key, std::size_t keysize, std::string &value, const DatabaseOptions &options) const =0
Read a value by key.
virtual void writeImm(const char *key, std::size_t keysize, const char *value, std::size_t valuesize)=0
Write a key value immediately (synchronized)
Interface for transactions for writing on the strus key value storage database.
Definition: databaseTransactionInterface.hpp:22
Database cursor interface that can be used for backup.
Definition: databaseBackupCursorInterface.hpp:18
Structure for passing some options to the strus key value storage database.
Definition: databaseOptions.hpp:17