Ejemplo n.º 1
0
 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)));
     }
 }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
 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);
     }
 }
Ejemplo n.º 4
0
 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)));
 }
Ejemplo n.º 5
0
 public static int mdb_cursor_open(IntPtr txn, uint dbi, out IntPtr cursor)
 {
     return(check(LmdbMethods.mdb_cursor_open(txn, dbi, out cursor)));
 }
Ejemplo n.º 6
0
 public static int mdb_env_create(out IntPtr env)
 {
     return(check(LmdbMethods.mdb_env_create(out env)));
 }
Ejemplo n.º 7
0
 public static void mdb_txn_reset(IntPtr txn)
 {
     LmdbMethods.mdb_txn_reset(txn);
 }
Ejemplo n.º 8
0
 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)));
 }
Ejemplo n.º 9
0
 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)));
 }
Ejemplo n.º 10
0
 public static int mdb_env_copy2(IntPtr env, string path, EnvironmentCopyFlags copyFlags)
 {
     return(check(LmdbMethods.mdb_env_copy2(env, path, copyFlags)));
 }
Ejemplo n.º 11
0
 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)));
 }
Ejemplo n.º 12
0
 public static int mdb_stat(IntPtr txn, uint dbi, out MDBStat stat)
 {
     return(check(LmdbMethods.mdb_stat(txn, dbi, out stat)));
 }
Ejemplo n.º 13
0
 public static int mdb_env_copy(IntPtr env, string path)
 {
     return(check(LmdbMethods.mdb_env_copy(env, path)));
 }
Ejemplo n.º 14
0
        public static string mdb_strerror(int err)
        {
            var ptr = LmdbMethods.mdb_strerror(err);

            return(Marshal.PtrToStringAnsi(ptr));
        }
Ejemplo n.º 15
0
 public static IntPtr mdb_version(out int major, out int minor, out int patch)
 {
     return(LmdbMethods.mdb_version(out major, out minor, out patch));
 }
Ejemplo n.º 16
0
 public static int mdb_txn_renew(IntPtr txn)
 {
     return(check(LmdbMethods.mdb_txn_renew(txn)));
 }
Ejemplo n.º 17
0
 public static void mdb_cursor_close(IntPtr cursor)
 {
     LmdbMethods.mdb_cursor_close(cursor);
 }
Ejemplo n.º 18
0
 public static int mdb_env_info(IntPtr env, out MDBEnvInfo stat)
 {
     return(check(LmdbMethods.mdb_env_info(env, out stat)));
 }
Ejemplo n.º 19
0
 public static int mdb_cursor_renew(IntPtr txn, IntPtr cursor)
 {
     return(check(LmdbMethods.mdb_cursor_renew(txn, cursor)));
 }
Ejemplo n.º 20
0
 public static int mdb_env_stat(IntPtr env, out MDBStat stat)
 {
     return(check(LmdbMethods.mdb_env_stat(env, out stat)));
 }
Ejemplo n.º 21
0
 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)));
 }
Ejemplo n.º 22
0
 public static int mdb_env_sync(IntPtr env, bool force)
 {
     return(check(LmdbMethods.mdb_env_sync(env, force)));
 }
Ejemplo n.º 23
0
 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)));
 }
Ejemplo n.º 24
0
 public static int mdb_env_open(IntPtr env, string path, EnvironmentOpenFlags flags, UnixAccessMode mode)
 {
     return(check(LmdbMethods.mdb_env_open(env, path, flags, mode)));
 }
Ejemplo n.º 25
0
 public static int mdb_cursor_del(IntPtr cursor, CursorDeleteOption flags)
 {
     return(check(LmdbMethods.mdb_cursor_del(cursor, flags)));
 }
Ejemplo n.º 26
0
 public static int mdb_drop(IntPtr txn, uint dbi, bool del)
 {
     return(check(LmdbMethods.mdb_drop(txn, dbi, del)));
 }
Ejemplo n.º 27
0
 public static void mdb_env_close(IntPtr env)
 {
     LmdbMethods.mdb_env_close(env);
 }
Ejemplo n.º 28
0
 public static int mdb_txn_commit(IntPtr txn)
 {
     return(check(LmdbMethods.mdb_txn_commit(txn)));
 }
Ejemplo n.º 29
0
 public static int mdb_env_set_mapsize(IntPtr env, long size)
 {
     return(check(LmdbMethods.mdb_env_set_mapsize(env, new IntPtr(size))));
 }
Ejemplo n.º 30
0
 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)));
 }