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

Method GetDocSyncDataNoImport

db/crud.go:229–242  ·  view source on GitHub ↗

GetDocSyncDataNoImport returns unmarshalled value of the _sync xattr. This gets *just* the Sync Metadata (_sync field) rather than the entire doc, for efficiency reasons. Unlike GetDocSyncData it does not check for on-demand import; this means it does not need to read the doc body from the bucket.

(ctx context.Context, docid string, level DocumentUnmarshalLevel)

Source from the content-addressed store, hash-verified

227// reasons. Unlike GetDocSyncData it does not check for on-demand import; this means it does not
228// need to read the doc body from the bucket.
229func (db *DatabaseCollection) GetDocSyncDataNoImport(ctx context.Context, docid string, level DocumentUnmarshalLevel) (*SyncData, *HybridLogicalVector, error) {
230 xattrs, cas, err := db.dataStore.GetXattrs(ctx, docid, []string{base.SyncXattrName, base.VvXattrName})
231 if err != nil {
232 return nil, nil, err
233 }
234 if len(xattrs[base.SyncXattrName]) == 0 {
235 return nil, nil, base.ErrXattrNotFound
236 }
237 doc, err := db.unmarshalDocumentWithXattrs(ctx, docid, nil, xattrs, cas, level)
238 if err != nil {
239 return nil, nil, err
240 }
241 return &doc.SyncData, doc.HLV, nil
242}
243
244// OnDemandImportForGet. Attempts to import the doc based on the provided id, contents and cas. ImportDocRaw does cas retry handling
245// if the document gets updated after the initial retrieval attempt that triggered this.

Callers 4

CheckChangeVersionMethod · 0.80
RevDiffMethod · 0.80
CheckProposedRevMethod · 0.80
CheckProposedVersionMethod · 0.80

Calls 2

GetXattrsMethod · 0.45

Tested by

no test coverage detected