13#include <Ice/Initialize.h>
14#include <Ice/InputStream.h>
15#include <Ice/OutputStream.h>
16#include <IceUtil/Exception.h>
17#include <IceUtil/FileUtil.h>
22#if defined(ICE_STATIC_LIBS)
24#elif defined(ICE_DB_API_EXPORTS)
25#define ICE_DB_API ICE_DECLSPEC_EXPORT
27#define ICE_DB_API ICE_DECLSPEC_IMPORT
34#if !defined(ICE_BUILDING_ICE_DB) && defined(ICE_DB_API_EXPORTS)
35#define ICE_BUILDING_ICE_DB
38#if defined(_MSC_VER) && !defined(ICE_BUILDING_ICE_DB)
39#pragma comment(lib, ICE_LIBNAME("IceDB"))
55#ifndef ICE_CPP11_COMPILER
61#ifndef ICE_CPP11_MAPPING
70 static const char* _name;
81#ifndef ICE_CPP11_COMPILER
87#ifndef ICE_CPP11_MAPPING
94 static const char* _name;
105#ifndef ICE_CPP11_COMPILER
111#ifndef ICE_CPP11_MAPPING
118 static const char* _name;
141 template <
typename T,
typename C,
typename H>
147 explicit Env(
const std::string&, MDB_dbi = 0,
size_t = 0,
unsigned int = 0);
157 void operator=(
const Env&);
180 void operator=(
const Txn&);
211 DbiBase(
const Txn&,
const std::string&,
unsigned int, MDB_cmp_func*);
216 bool get(
const Txn&, MDB_val*, MDB_val*)
const;
225 template <
typename K,
typename D,
typename C,
typename H>
230 const std::string& name,
232 unsigned int flags = 0,
233 MDB_cmp_func* cmp = 0) :
234 DbiBase(txn, name, flags, cmp), _marshalingContext(ctx)
330 return _marshalingContext;
334 C _marshalingContext;
349 bool get(MDB_val*, MDB_val*, MDB_cursor_op);
350 void put(MDB_val*, MDB_val*,
unsigned int);
361 MDB_cursor* _mcursor;
362 const bool _readOnly;
365 template <
typename K,
typename D,
typename C,
typename H>
434 template <
typename K,
typename D,
typename C,
typename H>
439 Cursor<K, D, C, H>(dbi, txn)
444 put(
const K& key,
const D&
data,
unsigned int flags = 0)
462 del(
unsigned int flags = 0)
468 template <
typename K,
typename D,
typename C,
typename H>
473 Cursor<K, D, C, H>(dbi, txn)
493 template <
typename T>
499 std::pair<const Ice::Byte*, const Ice::Byte*> p(
500 static_cast<const Ice::Byte*
>(val.mv_data),
501 static_cast<const Ice::Byte*
>(val.mv_data) + val.mv_size);
511 val.mv_size = holder.b.size();
512 val.mv_data = &holder.b[0];
518 const size_t limit = val.mv_size;
519 std::pair<Ice::Byte*, Ice::Byte*> p(
reinterpret_cast<Ice::Byte*
>(val.mv_data),
520 reinterpret_cast<Ice::Byte*
>(val.mv_data) + limit);
523 val.mv_size = stream.b.size();
524 return stream.b.size() > limit ? false :
true;
virtual ~BadEnvException()
virtual BadEnvException * ice_clone() const
virtual void ice_print(std::ostream &) const
virtual void ice_throw() const
virtual std::string ice_id() const
BadEnvException(const char *, int, size_t)
MDB_cursor * mcursor() const
void put(MDB_val *, MDB_val *, unsigned int)
void renew(const ReadOnlyTxn &)
bool find(MDB_val *, MDB_val *)
CursorBase(MDB_dbi dbi, const Txn &txn, bool)
bool get(MDB_val *, MDB_val *, MDB_cursor_op)
bool get(K &key, D &data, MDB_cursor_op op)
Cursor(const Dbi< K, D, C, H > &dbi, const ReadWriteTxn &txn)
bool find(const K &key, D &data)
Cursor(const Dbi< K, D, C, H > &dbi, const Txn &txn)
Cursor(const Dbi< K, D, C, H > &dbi, const ReadOnlyTxn &txn)
DbiBase(const Txn &, const std::string &, unsigned int, MDB_cmp_func *)
bool get(const Txn &, MDB_val *, MDB_val *) const
bool del(const ReadWriteTxn &, MDB_val *, MDB_val *)
void put(const ReadWriteTxn &, MDB_val *, MDB_val *, unsigned int)
bool find(const Txn &, MDB_val *) const
void clear(const ReadWriteTxn &)
void put(const ReadWriteTxn &txn, const K &key, const D &data, unsigned int flags=0)
bool get(const Txn &txn, const K &key, D &data) const
bool del(const ReadWriteTxn &txn, const K &key)
bool del(const ReadWriteTxn &txn, const K &key, const D &data)
bool find(const Txn &txn, const K &key) const
Dbi(const Txn &txn, const std::string &name, const C &ctx, unsigned int flags=0, MDB_cmp_func *cmp=0)
C marshalingContext() const
Env(const std::string &, MDB_dbi=0, size_t=0, unsigned int=0)
LMDBException(const char *, int, int)
virtual void ice_print(std::ostream &) const
virtual LMDBException * ice_clone() const
virtual void ice_throw() const
virtual std::string ice_id() const
ReadOnlyCursor(const Dbi< K, D, C, H > &dbi, const ReadOnlyTxn &txn)
void renew(const ReadOnlyTxn &txn)
void del(unsigned int flags=0)
ReadWriteCursor(const Dbi< K, D, C, H > &dbi, const ReadWriteTxn &txn)
void put(const K &key, const D &data, unsigned int flags=0)
ReadWriteTxn(const Env &)
Txn(const Env &, unsigned int)
ICE_DB_API size_t getMapSize(int)
::IceInternal::Handle<::Ice::Communicator > CommunicatorPtr
static void write(const T &t, MDB_val &val, Ice::OutputStream &holder, const IceContext &ctx)
static void read(T &t, const MDB_val &val, const IceContext &ctx)
static bool write(const T &t, MDB_val &val, const IceContext &ctx)
Ice::CommunicatorPtr communicator
Ice::EncodingVersion encoding