MCPcopy Create free account
hub / github.com/convox/rack / syncOutgoingRemoves

Method syncOutgoingRemoves

pkg/sync/sync.go:305–336  ·  view source on GitHub ↗
(removes []changes.Change, st Stream)

Source from the content-addressed store, hash-verified

303}
304
305func (s *Sync) syncOutgoingRemoves(removes []changes.Change, st Stream) {
306 if len(removes) == 0 {
307 return
308 }
309
310 cmd := []string{"rm", "-f"}
311
312 for _, r := range removes {
313 cmd = append(cmd, filepath.Join(s.Remote, r.Path))
314 }
315
316 res, err := s.docker.CreateExec(docker.CreateExecOptions{
317 Container: s.Container,
318 Cmd: cmd,
319 })
320
321 if err != nil {
322 st <- fmt.Sprintf("error: %s", err)
323 return
324 }
325
326 err = s.docker.StartExec(res.ID, docker.StartExecOptions{
327 Detach: true,
328 })
329
330 if err != nil {
331 st <- fmt.Sprintf("error: %s", err)
332 return
333 }
334
335 st <- fmt.Sprintf("%d files removed", len(removes))
336}
337
338func (s *Sync) uploadChangesDaemon(st Stream) {
339 var buf bytes.Buffer

Callers 1

StartMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected