Inheritance: FdbSafeHandle
Example #1
0
        public static void TransactionCancel(TransactionHandle transaction)
        {
#if DEBUG_NATIVE_CALLS
            Debug.WriteLine("fdb_transaction_cancel(0x" + transaction.Handle.ToString("x") + ")");
#endif
            NativeMethods.fdb_transaction_cancel(transaction);
        }
Example #2
0
        public static void TransactionSetReadVersion(TransactionHandle transaction, long version)
        {
#if DEBUG_NATIVE_CALLS
            Debug.WriteLine("fdb_transaction_set_read_version(0x" + transaction.Handle.ToString("x") + ", version: " + version.ToString() + ")");
#endif
            NativeMethods.fdb_transaction_set_read_version(transaction, version);
        }
Example #3
0
        public static FdbError TransactionGetCommittedVersion(TransactionHandle transaction, out long version)
        {
#if DEBUG_NATIVE_CALLS
            Debug.WriteLine("fdb_transaction_get_committed_version(0x" + transaction.Handle.ToString("x") + ")");
#endif
            return(NativeMethods.fdb_transaction_get_committed_version(transaction, out version));
        }
Example #4
0
        public static FdbError DatabaseCreateTransaction(DatabaseHandle database, out TransactionHandle transaction)
        {
            var err = NativeMethods.fdb_database_create_transaction(database, out transaction);

#if DEBUG_NATIVE_CALLS
            Debug.WriteLine("fdb_database_create_transaction(0x" + database.Handle.ToString("x") + ") => err=" + err + ", handle=0x" + transaction.Handle.ToString("x"));
#endif
            return(err);
        }
Example #5
0
        public static FutureHandle TransactionOnError(TransactionHandle transaction, FdbError errorCode)
        {
            var future = NativeMethods.fdb_transaction_on_error(transaction, errorCode);

            Contract.Assert(future != null);
#if DEBUG_NATIVE_CALLS
            Debug.WriteLine("fdb_transaction_on_error(0x" + transaction.Handle.ToString("x") + ", " + errorCode + ") => 0x" + future.Handle.ToString("x"));
#endif
            return(future);
        }
Example #6
0
        public static FutureHandle TransactionGetReadVersion(TransactionHandle transaction)
        {
            var future = NativeMethods.fdb_transaction_get_read_version(transaction);

            Contract.Assert(future != null);
#if DEBUG_NATIVE_CALLS
            Debug.WriteLine("fdb_transaction_get_read_version(0x" + transaction.Handle.ToString("x") + ") => 0x" + future.Handle.ToString("x"));
#endif
            return(future);
        }
		public FdbNativeTransaction(FdbNativeDatabase db, TransactionHandle handle)
		{
			if (db == null) throw new ArgumentNullException("db");
			if (handle == null) throw new ArgumentNullException("handle");

			m_database = db;
			m_handle = handle;
#if CAPTURE_STACKTRACES
			m_stackTrace = new StackTrace();
#endif
		}
Example #8
0
        public FdbNativeTransaction(FdbNativeDatabase db, TransactionHandle handle)
        {
            Contract.NotNull(db, nameof(db));
            Contract.NotNull(handle, nameof(handle));

            m_database = db;
            m_handle   = handle;
#if CAPTURE_STACKTRACES
            m_stackTrace = new StackTrace();
#endif
        }
        public FdbNativeTransaction(FdbNativeDatabase db, TransactionHandle handle)
        {
            if (db == null)
            {
                throw new ArgumentNullException("db");
            }
            if (handle == null)
            {
                throw new ArgumentNullException("handle");
            }

            m_database = db;
            m_handle   = handle;
#if CAPTURE_STACKTRACES
            m_stackTrace = new StackTrace();
#endif
        }
Example #10
0
        public static FutureHandle TransactionWatch(TransactionHandle transaction, Slice key)
        {
            if (key.IsNullOrEmpty)
            {
                throw new ArgumentException("Key cannot be null or empty", "key");

                fixed(byte *ptrKey = key.Array)
                {
                    var future = NativeMethods.fdb_transaction_watch(transaction, ptrKey + key.Offset, key.Count);

                    Contract.Assert(future != null);
#if DEBUG_NATIVE_CALLS
                    Debug.WriteLine("fdb_transaction_watch(0x" + transaction.Handle.ToString("x") + ", key: '" + FdbKey.Dump(key) + "') => 0x" + future.Handle.ToString("x"));
#endif
                    return(future);
                }
        }
Example #11
0
        public IFdbTransactionHandler CreateTransaction(FdbOperationContext context)
        {
            TransactionHandle handle = null;

            try
            {
                var err = FdbNative.DatabaseCreateTransaction(m_handle, out handle);
                if (Fdb.Failed(err))
                {
                    throw Fdb.MapToException(err);
                }
                return(new FdbNativeTransaction(this, handle));
            }
            catch (Exception)
            {
                handle?.Dispose();
                throw;
            }
        }
Example #12
0
 public static extern void fdb_transaction_set(TransactionHandle transaction, byte *keyName, int keyNameLength, byte *value, int valueLength);
Example #13
0
 public static extern FutureHandle fdb_transaction_get_key(TransactionHandle transaction, byte *keyName, int keyNameLength, bool orEqual, int offset, bool snapshot);
			public static extern FutureHandle fdb_transaction_on_error(TransactionHandle transaction, FdbError error);
			public static extern void fdb_transaction_set(TransactionHandle transaction, byte* keyName, int keyNameLength, byte* value, int valueLength);
Example #16
0
 public static extern void fdb_transaction_cancel(TransactionHandle transaction);
Example #17
0
 public static extern FutureHandle fdb_transaction_get_versionstamp(TransactionHandle transaction);
		public static FutureHandle TransactionOnError(TransactionHandle transaction, FdbError errorCode)
		{
			var future = NativeMethods.fdb_transaction_on_error(transaction, errorCode);
			Contract.Assert(future != null);
#if DEBUG_NATIVE_CALLS
			Debug.WriteLine("fdb_transaction_on_error(0x" + transaction.Handle.ToString("x") + ", " + errorCode + ") => 0x" + future.Handle.ToString("x"));
#endif
			return future;
		}
		public static FdbError DatabaseCreateTransaction(DatabaseHandle database, out TransactionHandle transaction)
		{
			var err = NativeMethods.fdb_database_create_transaction(database, out transaction);
#if DEBUG_NATIVE_CALLS
			Debug.WriteLine("fdb_database_create_transaction(0x" + database.Handle.ToString("x") + ") => err=" + err + ", handle=0x" + transaction.Handle.ToString("x"));
#endif
			return err;
		}
		public static FdbError TransactionSetOption(TransactionHandle transaction, FdbTransactionOption option, byte* value, int valueLength)
		{
			return NativeMethods.fdb_transaction_set_option(transaction, option, value, valueLength);
		}
			public static extern FdbError fdb_transaction_add_conflict_range(TransactionHandle transaction, byte* beginKeyName, int beginKeyNameLength, byte* endKeyName, int endKeyNameLength, FdbConflictRangeType type);
			public static extern void fdb_transaction_cancel(TransactionHandle transaction);
			public static extern void fdb_transaction_reset(TransactionHandle transaction);
Example #24
0
 public static extern void fdb_transaction_clear_range(
     TransactionHandle transaction,
     byte *beginKeyName, int beginKeyNameLength,
     byte *endKeyName, int endKeyNameLength
     );
Example #25
0
 public static extern FutureHandle fdb_transaction_commit(TransactionHandle transaction);
		public static void TransactionCancel(TransactionHandle transaction)
		{
#if DEBUG_NATIVE_CALLS
			Debug.WriteLine("fdb_transaction_cancel(0x" + transaction.Handle.ToString("x") + ")");
#endif
			NativeMethods.fdb_transaction_cancel(transaction);
		}
Example #27
0
 public static extern FutureHandle fdb_transaction_on_error(TransactionHandle transaction, FdbError error);
		public static void TransactionSetReadVersion(TransactionHandle transaction, long version)
		{
#if DEBUG_NATIVE_CALLS
			Debug.WriteLine("fdb_transaction_set_read_version(0x" + transaction.Handle.ToString("x") + ", version: " + version.ToString() + ")");
#endif
			NativeMethods.fdb_transaction_set_read_version(transaction, version);
		}
Example #29
0
 public static FdbError TransactionSetOption(TransactionHandle transaction, FdbTransactionOption option, byte *value, int valueLength)
 {
     return(NativeMethods.fdb_transaction_set_option(transaction, option, value, valueLength));
 }
		public static FutureHandle TransactionGetReadVersion(TransactionHandle transaction)
		{
			var future = NativeMethods.fdb_transaction_get_read_version(transaction);
			Contract.Assert(future != null);
#if DEBUG_NATIVE_CALLS
			Debug.WriteLine("fdb_transaction_get_read_version(0x" + transaction.Handle.ToString("x") + ") => 0x" + future.Handle.ToString("x"));
#endif
			return future;
		}
			public static extern void fdb_transaction_clear_range(
				TransactionHandle transaction,
				byte* beginKeyName, int beginKeyNameLength,
				byte* endKeyName, int endKeyNameLength
			);
		public static FdbError TransactionGetCommittedVersion(TransactionHandle transaction, out long version)
		{
#if DEBUG_NATIVE_CALLS
			Debug.WriteLine("fdb_transaction_get_committed_version(0x" + transaction.Handle.ToString("x") + ")");
#endif
			return NativeMethods.fdb_transaction_get_committed_version(transaction, out version);
		}
Example #33
0
 public static FutureHandle TransactionGet(TransactionHandle transaction, Slice key, bool snapshot)
 {
     if (key.IsNull)
         throw new ArgumentException("Key cannot be null", "key"); }
		public static FutureHandle TransactionGet(TransactionHandle transaction, Slice key, bool snapshot)
		{
			if (key.IsNull) throw new ArgumentException("Key cannot be null", "key");

			// the empty key is allowed !
			if (key.Count == 0) key = Slice.Empty;

			fixed (byte* ptrKey = key.Array)
			{
				var future = NativeMethods.fdb_transaction_get(transaction, ptrKey + key.Offset, key.Count, snapshot);
				Contract.Assert(future != null);
#if DEBUG_NATIVE_CALLS
				Debug.WriteLine("fdb_transaction_get(0x" + transaction.Handle.ToString("x") + ", key: '" + FdbKey.Dump(key) + "', snapshot: " + snapshot + ") => 0x" + future.Handle.ToString("x"));
#endif
				return future;
			}
		}
Example #35
0
 public static extern FutureHandle fdb_transaction_get_addresses_for_key(TransactionHandle transaction, byte *keyName, int keyNameLength);
		public static FutureHandle TransactionGetRange(TransactionHandle transaction, FdbKeySelector begin, FdbKeySelector end, int limit, int targetBytes, FdbStreamingMode mode, int iteration, bool snapshot, bool reverse)
		{
			fixed (byte* ptrBegin = begin.Key.Array)
			fixed (byte* ptrEnd = end.Key.Array)
			{
				var future = NativeMethods.fdb_transaction_get_range(
					transaction,
					ptrBegin + begin.Key.Offset, begin.Key.Count, begin.OrEqual, begin.Offset,
					ptrEnd + end.Key.Offset, end.Key.Count, end.OrEqual, end.Offset,
					limit, targetBytes, mode, iteration, snapshot, reverse);
				Contract.Assert(future != null);
#if DEBUG_NATIVE_CALLS
					Debug.WriteLine("fdb_transaction_get_range(0x" + transaction.Handle.ToString("x") + ", begin: " + begin.PrettyPrint(FdbKey.PrettyPrintMode.Begin) + ", end: " + end.PrettyPrint(FdbKey.PrettyPrintMode.End) + ", " + snapshot + ") => 0x" + future.Handle.ToString("x"));
#endif
				return future;
			}
		}
Example #37
0
 public static extern FutureHandle fdb_transaction_get_range(
     TransactionHandle transaction,
     byte *beginKeyName, int beginKeyNameLength, bool beginOrEqual, int beginOffset,
     byte *endKeyName, int endKeyNameLength, bool endOrEqual, int endOffset,
     int limit, int targetBytes, FdbStreamingMode mode, int iteration, bool snapshot, bool reverse
     );
		public static FutureHandle TransactionGetKey(TransactionHandle transaction, FdbKeySelector selector, bool snapshot)
		{
			if (selector.Key.IsNull) throw new ArgumentException("Key cannot be null", "selector");

			fixed (byte* ptrKey = selector.Key.Array)
			{
				var future = NativeMethods.fdb_transaction_get_key(transaction, ptrKey + selector.Key.Offset, selector.Key.Count, selector.OrEqual, selector.Offset, snapshot);
				Contract.Assert(future != null);
#if DEBUG_NATIVE_CALLS
				Debug.WriteLine("fdb_transaction_get_key(0x" + transaction.Handle.ToString("x") + ", " + selector.ToString() + ", " + snapshot + ") => 0x" + future.Handle.ToString("x"));
#endif
				return future;
			}
		}
Example #39
0
 public static extern void fdb_transaction_clear(TransactionHandle transaction, byte *keyName, int keyNameLength);
		public static FutureHandle TransactionGetAddressesForKey(TransactionHandle transaction, Slice key)
		{
			if (key.IsNullOrEmpty) throw new ArgumentException("Key cannot be null or empty", "key");

			fixed (byte* ptrKey = key.Array)
			{
				var future = NativeMethods.fdb_transaction_get_addresses_for_key(transaction, ptrKey + key.Offset, key.Count);
				Contract.Assert(future != null);
#if DEBUG_NATIVE_CALLS
				Debug.WriteLine("fdb_transaction_get_addresses_for_key(0x" + transaction.Handle.ToString("x") + ", key: '" + FdbKey.Dump(key) + "') => 0x" + future.Handle.ToString("x"));
#endif
				return future;
			}
		}
Example #41
0
 public static extern void fdb_transaction_atomic_op(TransactionHandle transaction, byte *keyName, int keyNameLength, byte *param, int paramLength, FdbMutationType operationType);
		public static void TransactionSet(TransactionHandle transaction, Slice key, Slice value)
		{
			fixed (byte* pKey = key.Array)
			fixed (byte* pValue = value.Array)
			{
#if DEBUG_NATIVE_CALLS
				Debug.WriteLine("fdb_transaction_set(0x" + transaction.Handle.ToString("x") + ", key: '" + FdbKey.Dump(key) + "', value: '" + FdbKey.Dump(value) + "')");
#endif
				NativeMethods.fdb_transaction_set(transaction, pKey + key.Offset, key.Count, pValue + value.Offset, value.Count);
			}
		}
Example #43
0
 public static extern FdbError fdb_transaction_get_committed_version(TransactionHandle transaction, out long version);
		public static void TransactionAtomicOperation(TransactionHandle transaction, Slice key, Slice param, FdbMutationType operationType)
		{
			fixed (byte* pKey = key.Array)
			fixed (byte* pParam = param.Array)
			{
#if DEBUG_NATIVE_CALLS
				Debug.WriteLine("fdb_transaction_atomic_op(0x" + transaction.Handle.ToString("x") + ", key: '" + FdbKey.Dump(key) + "', param: '" + FdbKey.Dump(param) + "', " + operationType.ToString() + ")");
#endif
				NativeMethods.fdb_transaction_atomic_op(transaction, pKey + key.Offset, key.Count, pParam + param.Offset, param.Count, operationType);
			}
		}
Example #45
0
 public static extern FutureHandle fdb_transaction_watch(TransactionHandle transaction, byte *keyName, int keyNameLength);
		public static void TransactionClear(TransactionHandle transaction, Slice key)
		{
			fixed (byte* pKey = key.Array)
			{
#if DEBUG_NATIVE_CALLS
				Debug.WriteLine("fdb_transaction_clear(0x" + transaction.Handle.ToString("x") + ", key: '" + FdbKey.Dump(key) + "')");
#endif
				NativeMethods.fdb_transaction_clear(transaction, pKey + key.Offset, key.Count);
			}
		}
Example #47
0
 public static extern void fdb_transaction_reset(TransactionHandle transaction);
		public static void TransactionClearRange(TransactionHandle transaction, Slice beginKey, Slice endKey)
		{
			fixed (byte* pBeginKey = beginKey.Array)
			fixed (byte* pEndKey = endKey.Array)
			{
#if DEBUG_NATIVE_CALLS
				Debug.WriteLine("fdb_transaction_clear_range(0x" + transaction.Handle.ToString("x") + ", beginKey: '" + FdbKey.Dump(beginKey) + ", endKey: '" + FdbKey.Dump(endKey) + "')");
#endif
				NativeMethods.fdb_transaction_clear_range(transaction, pBeginKey + beginKey.Offset, beginKey.Count, pEndKey + endKey.Offset, endKey.Count);
			}
		}
Example #49
0
 public static extern FdbError fdb_transaction_add_conflict_range(TransactionHandle transaction, byte *beginKeyName, int beginKeyNameLength, byte *endKeyName, int endKeyNameLength, FdbConflictRangeType type);
		public static FdbError TransactionAddConflictRange(TransactionHandle transaction, Slice beginKey, Slice endKey, FdbConflictRangeType type)
		{
			fixed (byte* pBeginKey = beginKey.Array)
			fixed (byte* pEndKey = endKey.Array)
			{
#if DEBUG_NATIVE_CALLS
				Debug.WriteLine("fdb_transaction_add_conflict_range(0x" + transaction.Handle.ToString("x") + ", beginKey: '" + FdbKey.Dump(beginKey) + ", endKey: '" + FdbKey.Dump(endKey) + "', " + type.ToString() + ")");
#endif
				return NativeMethods.fdb_transaction_add_conflict_range(transaction, pBeginKey + beginKey.Offset, beginKey.Count, pEndKey + endKey.Offset, endKey.Count, type);
			}
		}
			public static extern FutureHandle fdb_transaction_commit(TransactionHandle transaction);
			public static extern FutureHandle fdb_transaction_get_key(TransactionHandle transaction, byte* keyName, int keyNameLength, bool orEqual, int offset, bool snapshot);
			public static extern void fdb_transaction_atomic_op(TransactionHandle transaction, byte* keyName, int keyNameLength, byte* param, int paramLength, FdbMutationType operationType);
			public static extern FdbError fdb_transaction_get_committed_version(TransactionHandle transaction, out long version);
			public static extern void fdb_transaction_clear(TransactionHandle transaction, byte* keyName, int keyNameLength);
Example #56
0
 public static extern FdbError fdb_transaction_set_option(TransactionHandle handle, FdbTransactionOption option, byte *value, int valueLength);
			public static extern FutureHandle fdb_transaction_get_range(
				TransactionHandle transaction,
				byte* beginKeyName, int beginKeyNameLength, bool beginOrEqual, int beginOffset,
				byte* endKeyName, int endKeyNameLength, bool endOrEqual, int endOffset,
				int limit, int targetBytes, FdbStreamingMode mode, int iteration, bool snapshot, bool reverse
			);
Example #58
0
 public static extern void fdb_transaction_set_read_version(TransactionHandle handle, long version);
Example #59
0
 public static extern FutureHandle fdb_transaction_get(TransactionHandle transaction, byte *keyName, int keyNameLength, bool snapshot);
			public static extern FutureHandle fdb_transaction_watch(TransactionHandle transaction, byte* keyName, int keyNameLength);