MCPcopy Index your code
hub / github.com/devspace-sh/devspace / Remove

Method Remove

helper/server/upstream.go:109–139  ·  view source on GitHub ↗

Remove implements the server

(stream remote.Upstream_RemoveServer)

Source from the content-addressed store, hash-verified

107
108// Remove implements the server
109func (u *Upstream) Remove(stream remote.Upstream_RemoveServer) error {
110 // Receive file
111 for {
112 paths, err := stream.Recv()
113 if paths != nil {
114 for _, path := range paths.Paths {
115 // Just remove everything inside and ignore any errors
116 absolutePath := filepath.Join(u.options.UploadPath, path)
117
118 // Stat the path
119 stat, err := os.Stat(absolutePath)
120 if err != nil {
121 continue
122 }
123
124 if stat.IsDir() {
125 _ = u.removeRecursive(absolutePath)
126 } else {
127 _ = os.Remove(absolutePath)
128 }
129 }
130 }
131
132 if err == io.EOF {
133 return stream.SendAndClose(&remote.Empty{})
134 }
135 if err != nil {
136 return err
137 }
138 }
139}
140
141func (u *Upstream) Checksums(ctx context.Context, paths *remote.TouchPaths) (*remote.PathsChecksum, error) {
142 if paths != nil {

Callers

nothing calls this directly

Calls 5

removeRecursiveMethod · 0.95
RecvMethod · 0.65
RemoveMethod · 0.65
SendAndCloseMethod · 0.65
IsDirMethod · 0.45

Tested by

no test coverage detected