MCPcopy
hub / github.com/rclone/rclone / Rmdir

Method Rmdir

backend/googlecloudstorage/googlecloudstorage.go:1092–1119  ·  view source on GitHub ↗

Rmdir deletes the bucket if the fs is at the root Returns an error if it isn't empty: Error 409: The bucket you tried to delete was not empty.

(ctx context.Context, dir string)

Source from the content-addressed store, hash-verified

1090// Returns an error if it isn't empty: Error 409: The bucket you tried
1091// to delete was not empty.
1092func (f *Fs) Rmdir(ctx context.Context, dir string) (err error) {
1093 bucket, directory := f.split(dir)
1094 // Remove directory marker file
1095 if f.opt.DirectoryMarkers && bucket != "" && dir != "" {
1096 o := &Object{
1097 fs: f,
1098 remote: dir + "/",
1099 }
1100 fs.Debugf(o, "Removing directory marker")
1101 err := o.Remove(ctx)
1102 if err != nil {
1103 return fmt.Errorf("removing directory marker failed: %w", err)
1104 }
1105 }
1106 if bucket == "" || directory != "" {
1107 return nil
1108 }
1109 return f.cache.Remove(bucket, func() error {
1110 return f.pacer.Call(func() (bool, error) {
1111 deleteBucket := f.svc.Buckets.Delete(bucket).Context(ctx)
1112 if f.opt.UserProject != "" {
1113 deleteBucket = deleteBucket.UserProject(f.opt.UserProject)
1114 }
1115 err = deleteBucket.Do()
1116 return shouldRetry(ctx, err)
1117 })
1118 })
1119}
1120
1121// Precision returns the precision
1122func (f *Fs) Precision() time.Duration {

Callers

nothing calls this directly

Calls 9

splitMethod · 0.95
RemoveMethod · 0.95
DebugfFunction · 0.92
shouldRetryFunction · 0.70
RemoveMethod · 0.65
DeleteMethod · 0.65
DoMethod · 0.65
ErrorfMethod · 0.45
CallMethod · 0.45

Tested by

no test coverage detected