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

Function createThenRemoveFromRevCache

db/revision_cache_test.go:1785–1797  ·  view source on GitHub ↗

createThenRemoveFromRevCache will create a doc and then immediately remove it from the rev cache

(t *testing.T, ctx context.Context, docID string, db *Database, collection *DatabaseCollectionWithUser)

Source from the content-addressed store, hash-verified

1783
1784// createThenRemoveFromRevCache will create a doc and then immediately remove it from the rev cache
1785func createThenRemoveFromRevCache(t *testing.T, ctx context.Context, docID string, db *Database, collection *DatabaseCollectionWithUser) DocVersion {
1786 revIDDoc, doc, err := collection.Put(ctx, docID, Body{"test": "doc"})
1787 require.NoError(t, err)
1788
1789 db.revisionCache.RemoveWithRev(ctx, docID, revIDDoc, collection.GetCollectionID())
1790 docVersion := DocVersion{
1791 RevTreeID: doc.GetRevTreeID(),
1792 }
1793 if doc.HLV != nil {
1794 docVersion.CV = *doc.HLV.ExtractCurrentVersionFromHLV()
1795 }
1796 return docVersion
1797}
1798
1799// createDocAndReturnSizeAndRev creates a rev and measures its size based on rev cache measurements
1800func createDocAndReturnSizeAndRev(t *testing.T, ctx context.Context, docID string, collection *DatabaseCollectionWithUser, body Body) (int, string, *Version) {

Calls 5

PutMethod · 0.65
RemoveWithRevMethod · 0.65
GetCollectionIDMethod · 0.45
GetRevTreeIDMethod · 0.45

Tested by

no test coverage detected