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

Method refreshOldRevisionJSON

db/revision.go:367–373  ·  view source on GitHub ↗

Extends the expiry on a revision backup. If this fails w/ key not found, will attempt to recreate the revision backup when body is non-empty.

(ctx context.Context, docid string, revid string, body []byte, expiry uint32, channels base.Set, deleted bool)

Source from the content-addressed store, hash-verified

365
366// Extends the expiry on a revision backup. If this fails w/ key not found, will attempt to recreate the revision backup when body is non-empty.
367func (db *DatabaseCollectionWithUser) refreshOldRevisionJSON(ctx context.Context, docid string, revid string, body []byte, expiry uint32, channels base.Set, deleted bool) error {
368 _, err := db.dataStore.Touch(oldRevisionKey(docid, revid), expiry)
369 if base.IsDocNotFoundError(err) && len(body) > 0 {
370 return db.setOldRevisionJSON(ctx, docid, revid, body, deleted, expiry, channels)
371 }
372 return err
373}
374
375// Currently only used by unit tests - deletes an archived old revision from the database
376func (c *DatabaseCollection) PurgeOldRevisionJSON(ctx context.Context, docid string, revid string) error {

Callers 1

backupRevisionJSONMethod · 0.95

Calls 4

setOldRevisionJSONMethod · 0.95
IsDocNotFoundErrorFunction · 0.92
oldRevisionKeyFunction · 0.85
TouchMethod · 0.45

Tested by

no test coverage detected