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

Method getNonWinningRevisionBody

db/document.go:780–792  ·  view source on GitHub ↗

Retrieves a non-winning revision body. If not already loaded in the document (either because inline, or was previously requested), loader function is used to retrieve from the bucket.

(ctx context.Context, revid string, loader RevLoaderFunc)

Source from the content-addressed store, hash-verified

778// Retrieves a non-winning revision body. If not already loaded in the document (either because inline,
779// or was previously requested), loader function is used to retrieve from the bucket.
780func (doc *Document) getNonWinningRevisionBody(ctx context.Context, revid string, loader RevLoaderFunc) Body {
781 var body Body
782 bodyBytes, found := doc.History.getRevisionBody(revid, loader)
783 if !found || len(bodyBytes) == 0 {
784 return nil
785 }
786
787 if err := body.Unmarshal(bodyBytes); err != nil {
788 base.WarnfCtx(ctx, "Unexpected error parsing body of rev %q: %v", revid, err)
789 return nil
790 }
791 return body
792}
793
794// Fetches the body of a revision as JSON, or nil if it's not available.
795func (doc *Document) getRevisionBodyJSON(ctx context.Context, revid string, loader RevLoaderFunc) []byte {

Callers 1

Calls 3

UnmarshalMethod · 0.95
WarnfCtxFunction · 0.92
getRevisionBodyMethod · 0.80

Tested by

no test coverage detected