public static int mdb_cursor_get(IntPtr cursor, byte[] key, out ValueStructure keyStructure, out ValueStructure valueStructure, CursorOperation op) { valueStructure = default(ValueStructure); using (var marshal = new MarshalValueStructure(key)) { keyStructure = marshal.Key; return(checkRead(LmdbMethods.mdb_cursor_get(cursor, ref keyStructure, ref valueStructure, op))); } }
public static int mdb_dbi_open(IntPtr txn, string name, DatabaseOpenFlags flags, out uint db) { var statusCode = LmdbMethods.mdb_dbi_open(txn, name, flags, out db); if (statusCode == MDB_NOTFOUND) { throw new LMDBException($"Error opening database {name}: {mdb_strerror(statusCode)}", statusCode); } return(check(statusCode)); }
public static int mdb_get(IntPtr txn, uint dbi, byte[] key, out byte[] data) { using (var marshal = new MarshalValueStructure(key)) { ValueStructure value; var result = checkRead(LmdbMethods.mdb_get(txn, dbi, ref marshal.Key, out value)); if (result == MDB_NOTFOUND) { data = null; return(result); } data = value.GetBytes(); return(result); } }
public static int mdb_del(IntPtr txn, uint dbi, byte[] key) { using (var marshal = new MarshalValueStructure(key)) return(check(LmdbMethods.mdb_del(txn, dbi, ref marshal.Key, IntPtr.Zero))); }
public static int mdb_cursor_open(IntPtr txn, uint dbi, out IntPtr cursor) { return(check(LmdbMethods.mdb_cursor_open(txn, dbi, out cursor))); }
public static int mdb_env_create(out IntPtr env) { return(check(LmdbMethods.mdb_env_create(out env))); }
public static void mdb_txn_reset(IntPtr txn) { LmdbMethods.mdb_txn_reset(txn); }
public static int mdb_cursor_get(IntPtr cursor, out ValueStructure key, out ValueStructure value, CursorOperation op) { key = value = default(ValueStructure); return(checkRead(LmdbMethods.mdb_cursor_get(cursor, ref key, ref value, op))); }
public static int mdb_cursor_put(IntPtr cursor, byte[] key, byte[] value, CursorPutOptions flags) { using (var marshal = new MarshalValueStructure(key, value)) return(check(LmdbMethods.mdb_cursor_put(cursor, ref marshal.Key, ref marshal.Value, flags))); }
public static int mdb_env_copy2(IntPtr env, string path, EnvironmentCopyFlags copyFlags) { return(check(LmdbMethods.mdb_env_copy2(env, path, copyFlags))); }
public static int mdb_txn_begin(IntPtr env, IntPtr parent, TransactionBeginFlags flags, out IntPtr txn) { return(check(LmdbMethods.mdb_txn_begin(env, parent, flags, out txn))); }
public static int mdb_stat(IntPtr txn, uint dbi, out MDBStat stat) { return(check(LmdbMethods.mdb_stat(txn, dbi, out stat))); }
public static int mdb_env_copy(IntPtr env, string path) { return(check(LmdbMethods.mdb_env_copy(env, path))); }
public static string mdb_strerror(int err) { var ptr = LmdbMethods.mdb_strerror(err); return(Marshal.PtrToStringAnsi(ptr)); }
public static IntPtr mdb_version(out int major, out int minor, out int patch) { return(LmdbMethods.mdb_version(out major, out minor, out patch)); }
public static int mdb_txn_renew(IntPtr txn) { return(check(LmdbMethods.mdb_txn_renew(txn))); }
public static void mdb_cursor_close(IntPtr cursor) { LmdbMethods.mdb_cursor_close(cursor); }
public static int mdb_env_info(IntPtr env, out MDBEnvInfo stat) { return(check(LmdbMethods.mdb_env_info(env, out stat))); }
public static int mdb_cursor_renew(IntPtr txn, IntPtr cursor) { return(check(LmdbMethods.mdb_cursor_renew(txn, cursor))); }
public static int mdb_env_stat(IntPtr env, out MDBStat stat) { return(check(LmdbMethods.mdb_env_stat(env, out stat))); }
public static int mdb_cursor_get(IntPtr cursor, byte[] key, byte[] value, CursorOperation op) { using (var marshal = new MarshalValueStructure(key, value)) return(checkRead(LmdbMethods.mdb_cursor_get(cursor, ref marshal.Key, ref marshal.Value, op))); }
public static int mdb_env_sync(IntPtr env, bool force) { return(check(LmdbMethods.mdb_env_sync(env, force))); }
public static int mdb_cursor_get_multiple(IntPtr cursor, ref ValueStructure key, ref ValueStructure value, CursorOperation op) { return(checkRead(LmdbMethods.mdb_cursor_get(cursor, ref key, ref value, op))); }
public static int mdb_env_open(IntPtr env, string path, EnvironmentOpenFlags flags, UnixAccessMode mode) { return(check(LmdbMethods.mdb_env_open(env, path, flags, mode))); }
public static int mdb_cursor_del(IntPtr cursor, CursorDeleteOption flags) { return(check(LmdbMethods.mdb_cursor_del(cursor, flags))); }
public static int mdb_drop(IntPtr txn, uint dbi, bool del) { return(check(LmdbMethods.mdb_drop(txn, dbi, del))); }
public static void mdb_env_close(IntPtr env) { LmdbMethods.mdb_env_close(env); }
public static int mdb_txn_commit(IntPtr txn) { return(check(LmdbMethods.mdb_txn_commit(txn))); }
public static int mdb_env_set_mapsize(IntPtr env, long size) { return(check(LmdbMethods.mdb_env_set_mapsize(env, new IntPtr(size)))); }
public static int mdb_put(IntPtr txn, uint dbi, byte[] key, byte[] value, PutOptions flags) { using (var marshal = new MarshalValueStructure(key, value)) return(check(LmdbMethods.mdb_put(txn, dbi, ref marshal.Key, ref marshal.Value, flags))); }