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

Method getCurrentVersion

db/revision_cache_test.go:85–104  ·  view source on GitHub ↗
(ctx context.Context, doc *Document, cv Version, loadBackup bool)

Source from the content-addressed store, hash-verified

83}
84
85func (t *testBackingStore) getCurrentVersion(ctx context.Context, doc *Document, cv Version, loadBackup bool) ([]byte, AttachmentsMeta, base.Set, bool, error) {
86 t.getRevisionCounter.Add(1)
87
88 revTreeID := doc.GetRevTreeID()
89 ch, _ := doc.channelsForRevTreeID(revTreeID)
90 b := Body{
91 "testing": true,
92 BodyId: doc.ID,
93 BodyRev: revTreeID,
94 BodyRevisions: Revisions{RevisionsStart: 1},
95 }
96 if doc.HLV != nil {
97 b[BodyCV] = doc.HLV.GetCurrentVersionString()
98 }
99 if err := doc.HasCurrentVersion(ctx, cv); err != nil {
100 return nil, nil, nil, false, err
101 }
102 bodyBytes, err := base.JSONMarshal(b)
103 return bodyBytes, nil, ch, false, err
104}
105
106type noopBackingStore struct{}
107

Callers

nothing calls this directly

Calls 6

JSONMarshalFunction · 0.92
channelsForRevTreeIDMethod · 0.80
HasCurrentVersionMethod · 0.80
AddMethod · 0.45
GetRevTreeIDMethod · 0.45

Tested by

no test coverage detected