コード例 #1
0
        public Task <AtrEntry> FindEntryForTransaction(ICouchbaseCollection atrCollection, string atrId, string attemptId)
        {
            if (Atrs.TryGetValue(atrCollection.GetKey(atrId), out var atr))
            {
                return(Task.FromResult(atr));
            }

            throw new PathNotFoundException();
        }
 public Task <DocumentLookupResult> LookupDocumentAsync(ICouchbaseCollection collection, string docId, bool fullDocument = true)
 {
     if (Docs.TryGetValue(collection.GetKey(docId), out var doc))
     {
         return(Task.FromResult(doc));
     }
     else
     {
         throw new DocumentNotFoundException();
     }
 }
        // intentionally *not* the scheme CB server actually uses, because we want it to break if the code is using "_default._default" as a collection name
        // rather than splitting it up properly among Collection/Scope/Bucket.

        public Task ClearTransactionMetadata(ICouchbaseCollection collection, string docId, ulong cas, bool isDelted)
        {
            if (Docs.TryGetValue(collection.GetKey(docId), out var doc))
            {
                Interlocked.Increment(ref _rollingCas);
                doc.TransactionXattrs = null;
            }
            else
            {
                throw new DocumentNotFoundException();
            }

            return(Task.CompletedTask);
        }
 public void Add(ICouchbaseCollection collection, string docId, DocumentLookupResult doc) => Docs.Add(collection.GetKey(docId), doc);