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

Function removeLocalStatus

db/active_replicator_common.go:573–589  ·  view source on GitHub ↗

removeLocalStatus removes a replication status from the given metadataStore. This is done when a replication is reset.

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

Source from the content-addressed store, hash-verified

571
572// removeLocalStatus removes a replication status from the given metadataStore. This is done when a replication is reset.
573func removeLocalStatus(ctx context.Context, metadataStore base.DataStore, statusKey string) (err error) {
574 base.TracefCtx(ctx, base.KeyReplicate, "removeLocalStatus() for %q", statusKey)
575
576 // obtain current rev
577 currentStatus, err := getLocalStatusDoc(ctx, metadataStore, statusKey)
578 if err != nil {
579 base.WarnfCtx(ctx, "Unable to retrieve local status doc for %s, status not removed", statusKey)
580 return nil
581 }
582 if currentStatus == nil {
583 // nothing to do - status already doesn't exist
584 return nil
585 }
586
587 _, _, err = putDocWithRevision(metadataStore, statusKey, currentStatus.Rev, nil, 0)
588 return err
589}
590
591// registerFunctions must be called once after immediately after newActiveReplicatorCommon to set the functions that require a circular definition from parent (ActiveReplicatorPush/ActiveReplicatorPull) and activeReplicatorCommon.
592func (arc *activeReplicatorCommon) registerFunctions(getStatusFn func() *ReplicationStatus, connectFn func() error, registerCheckpointerCallbacksFn func(*activeReplicatorCollection) error) {

Callers 1

resetMethod · 0.85

Calls 4

TracefCtxFunction · 0.92
WarnfCtxFunction · 0.92
getLocalStatusDocFunction · 0.85
putDocWithRevisionFunction · 0.85

Tested by

no test coverage detected