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

Method GetDocument

db/revision_cache_test.go:36–65  ·  view source on GitHub ↗
(ctx context.Context, docid string, unmarshalLevel DocumentUnmarshalLevel)

Source from the content-addressed store, hash-verified

34}
35
36func (t *testBackingStore) GetDocument(ctx context.Context, docid string, unmarshalLevel DocumentUnmarshalLevel) (doc *Document, err error) {
37 t.getDocumentCounter.Add(1)
38
39 for _, d := range t.notFoundDocIDs {
40 if docid == d {
41 return nil, ErrMissing
42 }
43 }
44
45 doc = NewDocument(docid)
46 doc._body = Body{
47 "testing": true,
48 }
49 const revTreeID = "1-abc"
50 doc.SetRevTreeID(revTreeID)
51 doc.History = RevTree{
52 revTreeID: {},
53 }
54
55 doc.HLV = &HybridLogicalVector{
56 SourceID: "test",
57 Version: 123,
58 }
59 _, _, err = doc.updateChannels(ctx, base.SetOf("*"))
60 if err != nil {
61 return nil, err
62 }
63
64 return doc, nil
65}
66
67func (t *testBackingStore) getRevision(ctx context.Context, doc *Document, revid string) ([]byte, AttachmentsMeta, base.Set, error) {
68 t.getRevisionCounter.Add(1)

Callers

nothing calls this directly

Calls 5

SetOfFunction · 0.92
NewDocumentFunction · 0.85
SetRevTreeIDMethod · 0.80
updateChannelsMethod · 0.80
AddMethod · 0.45

Tested by

no test coverage detected