MCPcopy Index your code
hub / github.com/kopia/kopia / runLocal

Method runLocal

internal/server/source_manager.go:178–214  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

176}
177
178func (s *sourceManager) runLocal(ctx context.Context) {
179 if s.isPaused() {
180 s.setStatus("PAUSED")
181 } else {
182 s.setStatus("IDLE")
183 }
184
185 for {
186 select {
187 case <-s.closed:
188 return
189
190 case <-s.snapshotRequests:
191 if s.isPaused() {
192 s.setStatus("PAUSED")
193
194 continue
195 }
196
197 s.setStatus("PENDING")
198
199 userLog(ctx).Debugw("snapshotting", "source", s.src)
200
201 if err := s.server.runSnapshotTask(ctx, s.src, s.snapshotInternal); err != nil {
202 userLog(ctx).Errorf("snapshot error: %v", err)
203
204 s.backoffBeforeNextSnapshot()
205 } else {
206 s.refreshStatus(ctx)
207 }
208
209 s.server.refreshScheduler("snapshot finished")
210
211 s.setStatus("IDLE")
212 }
213 }
214}
215
216func (s *sourceManager) backoffBeforeNextSnapshot() {
217 if _, ok := s.getNextSnapshotTime(); !ok {

Callers 1

runMethod · 0.95

Calls 7

isPausedMethod · 0.95
setStatusMethod · 0.95
refreshStatusMethod · 0.95
ErrorfMethod · 0.80
runSnapshotTaskMethod · 0.65
refreshSchedulerMethod · 0.65

Tested by

no test coverage detected