Inheritance: FdbSafeHandle
コード例 #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);
        }
コード例 #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);
        }
コード例 #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));
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #7
0
		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
		}
コード例 #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
        }
コード例 #9
0
        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
        }
コード例 #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);
                }
        }
コード例 #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;
            }
        }
コード例 #12
0
 public static extern void fdb_transaction_set(TransactionHandle transaction, byte *keyName, int keyNameLength, byte *value, int valueLength);
コード例 #13
0
 public static extern FutureHandle fdb_transaction_get_key(TransactionHandle transaction, byte *keyName, int keyNameLength, bool orEqual, int offset, bool snapshot);
コード例 #14
0
			public static extern FutureHandle fdb_transaction_on_error(TransactionHandle transaction, FdbError error);
コード例 #15
0
			public static extern void fdb_transaction_set(TransactionHandle transaction, byte* keyName, int keyNameLength, byte* value, int valueLength);
コード例 #16
0
 public static extern void fdb_transaction_cancel(TransactionHandle transaction);
コード例 #17
0
 public static extern FutureHandle fdb_transaction_get_versionstamp(TransactionHandle transaction);
コード例 #18
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;
		}
コード例 #19
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;
		}
コード例 #20
0
		public static FdbError TransactionSetOption(TransactionHandle transaction, FdbTransactionOption option, byte* value, int valueLength)
		{
			return NativeMethods.fdb_transaction_set_option(transaction, option, value, valueLength);
		}
コード例 #21
0
			public static extern FdbError fdb_transaction_add_conflict_range(TransactionHandle transaction, byte* beginKeyName, int beginKeyNameLength, byte* endKeyName, int endKeyNameLength, FdbConflictRangeType type);
コード例 #22
0
			public static extern void fdb_transaction_cancel(TransactionHandle transaction);
コード例 #23
0
			public static extern void fdb_transaction_reset(TransactionHandle transaction);
コード例 #24
0
 public static extern void fdb_transaction_clear_range(
     TransactionHandle transaction,
     byte *beginKeyName, int beginKeyNameLength,
     byte *endKeyName, int endKeyNameLength
     );
コード例 #25
0
 public static extern FutureHandle fdb_transaction_commit(TransactionHandle transaction);
コード例 #26
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);
		}
コード例 #27
0
 public static extern FutureHandle fdb_transaction_on_error(TransactionHandle transaction, FdbError error);
コード例 #28
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);
		}
コード例 #29
0
 public static FdbError TransactionSetOption(TransactionHandle transaction, FdbTransactionOption option, byte *value, int valueLength)
 {
     return(NativeMethods.fdb_transaction_set_option(transaction, option, value, valueLength));
 }
コード例 #30
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;
		}
コード例 #31
0
			public static extern void fdb_transaction_clear_range(
				TransactionHandle transaction,
				byte* beginKeyName, int beginKeyNameLength,
				byte* endKeyName, int endKeyNameLength
			);
コード例 #32
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);
		}
コード例 #33
0
 public static FutureHandle TransactionGet(TransactionHandle transaction, Slice key, bool snapshot)
 {
     if (key.IsNull)
         throw new ArgumentException("Key cannot be null", "key"); }
コード例 #34
0
		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;
			}
		}
コード例 #35
0
 public static extern FutureHandle fdb_transaction_get_addresses_for_key(TransactionHandle transaction, byte *keyName, int keyNameLength);
コード例 #36
0
		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;
			}
		}
コード例 #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
     );
コード例 #38
0
		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;
			}
		}
コード例 #39
0
 public static extern void fdb_transaction_clear(TransactionHandle transaction, byte *keyName, int keyNameLength);
コード例 #40
0
		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;
			}
		}
コード例 #41
0
 public static extern void fdb_transaction_atomic_op(TransactionHandle transaction, byte *keyName, int keyNameLength, byte *param, int paramLength, FdbMutationType operationType);
コード例 #42
0
		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);
			}
		}
コード例 #43
0
 public static extern FdbError fdb_transaction_get_committed_version(TransactionHandle transaction, out long version);
コード例 #44
0
		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);
			}
		}
コード例 #45
0
 public static extern FutureHandle fdb_transaction_watch(TransactionHandle transaction, byte *keyName, int keyNameLength);
コード例 #46
0
		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);
			}
		}
コード例 #47
0
 public static extern void fdb_transaction_reset(TransactionHandle transaction);
コード例 #48
0
		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);
			}
		}
コード例 #49
0
 public static extern FdbError fdb_transaction_add_conflict_range(TransactionHandle transaction, byte *beginKeyName, int beginKeyNameLength, byte *endKeyName, int endKeyNameLength, FdbConflictRangeType type);
コード例 #50
0
		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);
			}
		}
コード例 #51
0
			public static extern FutureHandle fdb_transaction_commit(TransactionHandle transaction);
コード例 #52
0
			public static extern FutureHandle fdb_transaction_get_key(TransactionHandle transaction, byte* keyName, int keyNameLength, bool orEqual, int offset, bool snapshot);
コード例 #53
0
			public static extern void fdb_transaction_atomic_op(TransactionHandle transaction, byte* keyName, int keyNameLength, byte* param, int paramLength, FdbMutationType operationType);
コード例 #54
0
			public static extern FdbError fdb_transaction_get_committed_version(TransactionHandle transaction, out long version);
コード例 #55
0
			public static extern void fdb_transaction_clear(TransactionHandle transaction, byte* keyName, int keyNameLength);
コード例 #56
0
 public static extern FdbError fdb_transaction_set_option(TransactionHandle handle, FdbTransactionOption option, byte *value, int valueLength);
コード例 #57
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
			);
コード例 #58
0
 public static extern void fdb_transaction_set_read_version(TransactionHandle handle, long version);
コード例 #59
0
 public static extern FutureHandle fdb_transaction_get(TransactionHandle transaction, byte *keyName, int keyNameLength, bool snapshot);
コード例 #60
0
			public static extern FutureHandle fdb_transaction_watch(TransactionHandle transaction, byte* keyName, int keyNameLength);