MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / GetWithCV

Method GetWithCV

db/revision_cache_bypass.go:61–85  ·  view source on GitHub ↗

GetWithCV fetches the Current Version for the given docID and CV immediately from the bucket.

(ctx context.Context, docID string, cv *Version, collectionID uint32, includeDelta bool, loadBackup bool)

Source from the content-addressed store, hash-verified

59
60// GetWithCV fetches the Current Version for the given docID and CV immediately from the bucket.
61func (rc *BypassRevisionCache) GetWithCV(ctx context.Context, docID string, cv *Version, collectionID uint32, includeDelta bool, loadBackup bool) (docRev DocumentRevision, err error) {
62
63 docRev = DocumentRevision{
64 CV: cv,
65 RevCacheValueDeltaLock: &sync.Mutex{}, // initialize the mutex for delta updates
66 }
67
68 doc, err := rc.backingStores[collectionID].GetDocument(ctx, docID, DocUnmarshalSync)
69 if err != nil {
70 return DocumentRevision{}, err
71 }
72
73 var hlv *HybridLogicalVector
74 docRev.BodyBytes, docRev.History, docRev.Channels, docRev.Removed, docRev.Attachments, docRev.Deleted, docRev.Expiry, docRev.RevID, hlv, err = revCacheLoaderForDocumentCV(ctx, rc.backingStores[collectionID], doc, *cv, loadBackup)
75 if err != nil {
76 return DocumentRevision{}, err
77 }
78 if hlv != nil {
79 docRev.HlvHistory = hlv.ToHistoryForHLV()
80 }
81
82 rc.bypassStat.Add(1)
83
84 return docRev, nil
85}
86
87// GetActive fetches the active revision for the given docID immediately from the bucket.
88func (rc *BypassRevisionCache) GetActive(ctx context.Context, docID string, collectionID uint32) (docRev DocumentRevision, err error) {

Callers

nothing calls this directly

Calls 4

ToHistoryForHLVMethod · 0.95
GetDocumentMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected