MCPcopy Create free account
hub / github.com/aptly-dev/aptly / Remove

Method Remove

gcs/public.go:183–205  ·  view source on GitHub ↗

Remove removes single file under public path.

(path string)

Source from the content-addressed store, hash-verified

181
182// Remove removes single file under public path.
183func (g *PublishedStorage) Remove(path string) error {
184 if g.debug {
185 log.Debug().Msgf("GCS: Remove '%s'", path)
186 }
187
188 err := g.objectHandle(path).Delete(context.TODO())
189 if err != nil {
190 if err == storage.ErrObjectNotExist {
191 return nil
192 }
193
194 var apiErr *googleapi.Error
195 if errors.As(err, &apiErr) && apiErr.Code == 404 {
196 return nil
197 }
198
199 return errors.Wrap(err, fmt.Sprintf("error deleting %s from %s", path, g))
200 }
201
202 delete(g.pathCache, path)
203
204 return nil
205}
206
207// RemoveDirs removes directory structure under public path.
208func (g *PublishedStorage) RemoveDirs(path string, _ aptly.Progress) error {

Callers 3

RemoveDirsMethod · 0.95
RenameFileMethod · 0.95
TestDebugModeMethod · 0.95

Calls 2

objectHandleMethod · 0.95
DeleteMethod · 0.65

Tested by 1

TestDebugModeMethod · 0.76