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

Function getLocalStatusDoc

db/active_replicator_common.go:522–534  ·  view source on GitHub ↗

getLocalStatusDoc retrieves replication status document for a given client ID from the given metadataStore

(ctx context.Context, metadataStore base.DataStore, statusKey string)

Source from the content-addressed store, hash-verified

520
521// getLocalStatusDoc retrieves replication status document for a given client ID from the given metadataStore
522func getLocalStatusDoc(ctx context.Context, metadataStore base.DataStore, statusKey string) (*ReplicationStatusDoc, error) {
523 statusDocBytes, err := getWithTouch(metadataStore, statusKey, 0)
524 if err != nil {
525 if !base.IsDocNotFoundError(err) {
526 return nil, err
527 }
528 base.DebugfCtx(ctx, base.KeyReplicate, "couldn't find existing local checkpoint for ID %q", statusKey)
529 return nil, nil
530 }
531 var statusDoc *ReplicationStatusDoc
532 err = base.JSONUnmarshal(statusDocBytes, &statusDoc)
533 return statusDoc, err
534}
535
536// getLocalStatus retrieves replication status for a given client ID from the given metadataStore
537func getLocalStatus(ctx context.Context, metadataStore base.DataStore, statusKey string) (*ReplicationStatus, error) {

Callers 3

getLocalStatusFunction · 0.85
setLocalStatusFunction · 0.85
removeLocalStatusFunction · 0.85

Calls 4

IsDocNotFoundErrorFunction · 0.92
DebugfCtxFunction · 0.92
JSONUnmarshalFunction · 0.92
getWithTouchFunction · 0.85

Tested by

no test coverage detected