TransactionGetKey() public static method

public static TransactionGetKey ( TransactionHandle transaction, FdbKeySelector selector, bool snapshot ) : FutureHandle
transaction TransactionHandle
selector FdbKeySelector
snapshot bool
return FutureHandle
コード例 #1
0
        public Task <Slice[]> GetKeysAsync(KeySelector[] selectors, bool snapshot, CancellationToken ct)
        {
            Contract.Requires(selectors != null);

            if (selectors.Length == 0)
            {
                return(Task.FromResult(Array.Empty <Slice>()));
            }

            var futures = new FutureHandle[selectors.Length];

            try
            {
                for (int i = 0; i < selectors.Length; i++)
                {
                    futures[i] = FdbNative.TransactionGetKey(m_handle, selectors[i], snapshot);
                }
            }
            catch
            {
                for (int i = 0; i < selectors.Length; i++)
                {
                    if (futures[i] == null)
                    {
                        break;
                    }
                    futures[i].Dispose();
                }
                throw;
            }
            return(FdbFuture.CreateTaskFromHandleArray(futures, (h) => GetKeyResult(h), ct));
        }
コード例 #2
0
        public Task <Slice> GetKeyAsync(KeySelector selector, bool snapshot, CancellationToken ct)
        {
            var future = FdbNative.TransactionGetKey(m_handle, selector, snapshot);

            return(FdbFuture.CreateTaskFromHandle(
                       future,
                       (h) => GetKeyResult(h),
                       ct
                       ));
        }