strus  0.17
databaseTransactionInterface.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_TRANSACTION_INTERFACE_HPP_INCLUDED
11 #define _STRUS_DATABASE_TRANSACTION_INTERFACE_HPP_INCLUDED
12 #include <cstddef>
13 
14 namespace strus
15 {
17 class DatabaseCursorInterface;
19 class DatabaseOptions;
20 
23 {
24 public:
28 
32  virtual DatabaseCursorInterface* createCursor( const DatabaseOptions& options) const=0;
33 
40  virtual void write(
41  const char* key,
42  std::size_t keysize,
43  const char* value,
44  std::size_t valuesize)=0;
45 
49  virtual void remove(
50  const char* key,
51  std::size_t keysize)=0;
52 
56  virtual void removeSubTree(
57  const char* domainkey,
58  std::size_t domainkeysize)=0;
59 
61  virtual bool commit()=0;
62 
64  virtual void rollback()=0;
65 };
66 
67 }//namespace
68 #endif
69 
70 
Interface to database cursor.
Definition: databaseCursorInterface.hpp:18
virtual DatabaseCursorInterface * createCursor(const DatabaseOptions &options) const =0
Get an interface for reading values in the context of this transaction.
virtual void removeSubTree(const char *domainkey, std::size_t domainkeysize)=0
Define a set of nodes defined by a key prefix to be deleted in the database as part of this transacti...
virtual void rollback()=0
Rollback of the transaction, no changes made.
virtual ~DatabaseTransactionInterface()
Destructor.
Definition: databaseTransactionInterface.hpp:27
virtual bool commit()=0
Executes all commands defined in the transaction or none if one operation fails.
virtual void write(const char *key, std::size_t keysize, const char *value, std::size_t valuesize)=0
Define a key/value pair to be written to the database as part of this transaction.
Interface for transactions for writing on the strus key value storage database.
Definition: databaseTransactionInterface.hpp:22
Structure for passing some options to the strus key value storage database.
Definition: databaseOptions.hpp:17