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

Method reset

db/active_replicator_common.go:222–241  ·  view source on GitHub ↗

reset performs a reset on the replication by removing the local checkpoint document.

()

Source from the content-addressed store, hash-verified

220
221// reset performs a reset on the replication by removing the local checkpoint document.
222func (arc *activeReplicatorCommon) reset() error {
223 if arc.state != ReplicationStateStopped {
224 return fmt.Errorf("reset invoked for replication %s when the replication was not stopped", arc.config.ID)
225 }
226
227 arc.lock.Lock()
228 defer arc.lock.Unlock()
229
230 if err := arc.forEachCollection(func(c *activeReplicatorCollection) error {
231 if err := resetLocalCheckpoint(c.collectionDataStore, arc.CheckpointID); err != nil {
232 return err
233 }
234 c.Checkpointer = nil
235 return nil
236 }); err != nil {
237 return err
238 }
239
240 return removeLocalStatus(arc.ctx, arc.config.ActiveDB.MetadataStore, arc.statusKey)
241}
242
243// reconnect asynchronously calls replicatorConnectFn until successful, or times out trying. Retry loop can be stopped by cancelling ctx
244func (arc *activeReplicatorCommon) reconnect() {

Callers

nothing calls this directly

Calls 6

forEachCollectionMethod · 0.95
resetLocalCheckpointFunction · 0.85
removeLocalStatusFunction · 0.85
ErrorfMethod · 0.80
LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected