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

Function revCacheLoader

db/revision_cache_interface.go:414–420  ·  view source on GitHub ↗

This is the RevisionCacheLoaderFunc callback for the context's RevisionCache. Its job is to load a revision from the bucket when there's a cache miss.

(ctx context.Context, backingStore RevisionCacheBackingStore, id IDAndRev)

Source from the content-addressed store, hash-verified

412// This is the RevisionCacheLoaderFunc callback for the context's RevisionCache.
413// Its job is to load a revision from the bucket when there's a cache miss.
414func revCacheLoader(ctx context.Context, backingStore RevisionCacheBackingStore, id IDAndRev) (bodyBytes []byte, history Revisions, channels base.Set, removed bool, attachments AttachmentsMeta, deleted bool, expiry *time.Time, hlv *HybridLogicalVector, err error) {
415 var doc *Document
416 if doc, err = backingStore.GetDocument(ctx, id.DocID, DocUnmarshalSync); doc == nil {
417 return bodyBytes, history, channels, removed, attachments, deleted, expiry, hlv, err
418 }
419 return revCacheLoaderForDocument(ctx, backingStore, doc, id.RevID)
420}
421
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

Callers 1

loadMethod · 0.85

Calls 2

GetDocumentMethod · 0.65

Tested by

no test coverage detected