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

Method _connect

db/active_replicator_pull.go:37–75  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35}
36
37func (apr *ActivePullReplicator) _connect() error {
38 var err error
39 apr.blipSender, apr.blipSyncContext, err = connect(apr.activeReplicatorCommon, "-pull")
40 if err != nil {
41 return err
42 }
43
44 // setup conflict resolver functions for both revTree documents and HLV documents, we
45 // need this in the eventually that a replication is pulling a doc that is a legacy doc both locally
46 // and on the remote side. Here we fall back to revTree conflict resolver.
47 if apr.config.ConflictResolverFunc != nil {
48 apr.blipSyncContext.conflictResolver.revTreeConflictResolver = NewConflictResolver(apr.config.ConflictResolverFunc, apr.config.ReplicationStatsMap)
49 }
50 if apr.blipSyncContext.useHLV() {
51 if apr.config.ConflictResolverFuncForHLV != nil {
52 apr.blipSyncContext.conflictResolver.hlvConflictResolver = NewConflictResolver(apr.config.ConflictResolverFuncForHLV, apr.config.ReplicationStatsMap)
53 }
54 }
55 apr.blipSyncContext.purgeOnRemoval = apr.config.PurgeOnRemoval
56
57 if apr.config.CollectionsEnabled {
58 if err := apr._startPullWithCollections(); err != nil {
59 return err
60 }
61 } else {
62 // for backwards compatibility use no collection-specific handling/messages
63 if err := apr._startPullNonCollection(); err != nil {
64 return err
65 }
66 }
67
68 if apr.blipSyncContext.activeCBMobileSubprotocol <= CBMobileReplicationV2 && apr.config.PurgeOnRemoval {
69 base.ErrorfCtx(apr.ctx, "Pull replicator ID:%s running with revocations enabled but target does not support revocations. Sync Gateway 3.0 required.", apr.config.ID)
70 }
71
72 apr.setState(ReplicationStateRunning)
73
74 return nil
75}
76
77// _startPullNonCollection starts a pull replication without collection-specific handling
78// for backwards compatibility with SG 3.0 and earlier

Callers

nothing calls this directly

Calls 7

ErrorfCtxFunction · 0.92
connectFunction · 0.85
NewConflictResolverFunction · 0.85
setStateMethod · 0.80
useHLVMethod · 0.45

Tested by

no test coverage detected