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

Function revCacheLoaderForCv

db/revision_cache_interface.go:424–435  ·  view source on GitHub ↗

revCacheLoaderForCv will load a document from the bucket using the CV, compare the fetched doc and the CV specified in the function, and will still return revid for purpose of populating the Rev ID lookup map on the cache

(ctx context.Context, backingStore RevisionCacheBackingStore, id IDandCV, loadBackup bool)

Source from the content-addressed store, hash-verified

422// revCacheLoaderForCv will load a document from the bucket using the CV, compare the fetched doc and the CV specified in the function,
423// and will still return revid for purpose of populating the Rev ID lookup map on the cache
424func revCacheLoaderForCv(ctx context.Context, backingStore RevisionCacheBackingStore, id IDandCV, loadBackup bool) (bodyBytes []byte, history Revisions, channels base.Set, removed bool, attachments AttachmentsMeta, deleted bool, expiry *time.Time, revid string, hlv *HybridLogicalVector, err error) {
425 cv := Version{
426 Value: id.Version,
427 SourceID: id.Source,
428 }
429 var doc *Document
430 if doc, err = backingStore.GetDocument(ctx, id.DocID, DocUnmarshalSync); doc == nil {
431 return bodyBytes, history, channels, removed, attachments, deleted, expiry, revid, hlv, err
432 }
433
434 return revCacheLoaderForDocumentCV(ctx, backingStore, doc, cv, loadBackup)
435}
436
437// Common revCacheLoader functionality used either during a cache miss (from revCacheLoader), or directly when retrieving current rev from cache
438

Callers 1

loadMethod · 0.85

Calls 2

GetDocumentMethod · 0.65

Tested by

no test coverage detected