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

Method runSyncFn

db/crud.go:2313–2320  ·  view source on GitHub ↗

Run the sync function on the given document and body. Need to inject the document ID and rev ID temporarily to run the sync function.

(ctx context.Context, doc *Document, body Body, metaMap map[string]interface{}, newRevId string)

Source from the content-addressed store, hash-verified

2311// Run the sync function on the given document and body. Need to inject the document ID and rev ID temporarily to run
2312// the sync function.
2313func (db *DatabaseCollectionWithUser) runSyncFn(ctx context.Context, doc *Document, body Body, metaMap map[string]interface{}, newRevId string) (*uint32, string, base.Set, channels.AccessMap, channels.AccessMap, error) {
2314 channelSet, access, roles, syncExpiry, oldBody, err := db.getChannelsAndAccess(ctx, doc, body, metaMap, newRevId)
2315 if err != nil {
2316 return nil, ``, nil, nil, nil, err
2317 }
2318 db.checkDocChannelsAndGrantsLimits(ctx, doc.ID, channelSet, access, roles)
2319 return syncExpiry, oldBody, channelSet, access, roles, nil
2320}
2321
2322func (db *DatabaseCollectionWithUser) recalculateSyncFnForActiveRev(ctx context.Context, doc *Document, metaMap map[string]interface{}, newRevID string) (channelSet base.Set, access, roles channels.AccessMap, syncExpiry *uint32, oldBodyJSON string, err error) {
2323 // In some cases an older revision might become the current one. If so, get its

Callers 3

PutMethod · 0.95
documentUpdateFuncMethod · 0.95
CreateDocNoHLVMethod · 0.95

Calls 2

getChannelsAndAccessMethod · 0.95

Tested by

no test coverage detected