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

Method Get1xRevBodyWithHistory

db/crud.go:313–330  ·  view source on GitHub ↗

Retrieves rev with request history specified as collection of revids (historyFrom)

(ctx context.Context, docid, revOrCV string, opts Get1xRevBodyOptions)

Source from the content-addressed store, hash-verified

311
312// Retrieves rev with request history specified as collection of revids (historyFrom)
313func (db *DatabaseCollectionWithUser) Get1xRevBodyWithHistory(ctx context.Context, docid, revOrCV string, opts Get1xRevBodyOptions) (Body, error) {
314 rev, err := db.getRev(ctx, docid, revOrCV, opts.MaxHistory, opts.HistoryFrom)
315 if err != nil {
316 return nil, err
317 }
318
319 // RequestedHistory is the _revisions returned in the body. Avoids mutating revision.History, in case it's needed
320 // during attachment processing below
321 requestedHistory := rev.History
322 if opts.MaxHistory == 0 {
323 requestedHistory = nil
324 }
325 if requestedHistory != nil {
326 _, requestedHistory = trimEncodedRevisionsToAncestor(ctx, requestedHistory, opts.HistoryFrom, opts.MaxHistory)
327 }
328
329 return rev.Mutable1xBody(ctx, db, requestedHistory, opts.AttachmentsSince, opts.ShowExp, opts.ShowCV)
330}
331
332// Underlying revision retrieval used by Get1xRevBody, Get1xRevBodyWithHistory, GetRevCopy.
333// Returns the revision of a document using the revision cache.

Callers 3

Get1xRevBodyMethod · 0.95
handleGetDocMethod · 0.80
handleBulkGetMethod · 0.80

Calls 3

getRevMethod · 0.95
Mutable1xBodyMethod · 0.80

Tested by

no test coverage detected