MCPcopy Create free account
hub / github.com/pydio/cells / Start

Method Start

common/sync/task/sync.go:100–137  ·  view source on GitHub ↗

Start makes a first sync and setup watchers

(ctx context.Context, withWatches bool)

Source from the content-addressed store, hash-verified

98
99// Start makes a first sync and setup watchers
100func (s *Sync) Start(ctx context.Context, withWatches bool) {
101
102 // Init processor
103 s.processor = proc.NewConnectedProcessor(ctx, s.cmd)
104 if s.SkipTargetChecks {
105 s.processor.SkipTargetChecks = true
106 }
107 s.patchChan = s.processor.PatchChan
108 if s.patchListener != nil {
109 s.processor.PatchListener = s.patchListener
110 }
111 s.processor.Ignores = s.Ignores
112 s.processor.Start()
113
114 // Init EchoFilter
115 if s.Direction == model.DirectionBi {
116 s.echoFilter = filters.NewEchoFilter()
117 s.processor.SetLocksChan(s.echoFilter.GetLocksChan())
118 s.echoFilter.Start()
119 }
120
121 if withWatches {
122 s.startWatchers(ctx)
123 } else if s.watchConn != nil {
124 go func() {
125 <-time.After(2 * time.Second)
126 s.watchConn <- &model.EndpointStatus{
127 WatchConnection: model.WatchConnected,
128 EndpointInfo: s.Source.GetEndpointInfo(),
129 }
130 s.watchConn <- &model.EndpointStatus{
131 WatchConnection: model.WatchConnected,
132 EndpointInfo: s.Target.GetEndpointInfo(),
133 }
134 }()
135 }
136
137}
138
139// Pause should pause the sync
140func (s *Sync) Pause(ctx context.Context) {

Callers 1

FlatSyncSnapshotMethod · 0.95

Calls 7

startWatchersMethod · 0.95
NewConnectedProcessorFunction · 0.92
NewEchoFilterFunction · 0.92
SetLocksChanMethod · 0.80
GetLocksChanMethod · 0.80
StartMethod · 0.65
GetEndpointInfoMethod · 0.65

Tested by

no test coverage detected