Rmdir deletes the bucket if the fs is at the root Returns an error if it isn't empty
(ctx context.Context, dir string)
| 2885 | // |
| 2886 | // Returns an error if it isn't empty |
| 2887 | func (f *Fs) Rmdir(ctx context.Context, dir string) error { |
| 2888 | bucket, directory := f.split(dir) |
| 2889 | // Remove directory marker file |
| 2890 | if f.opt.DirectoryMarkers && bucket != "" && dir != "" { |
| 2891 | o := &Object{ |
| 2892 | fs: f, |
| 2893 | remote: dir + "/", |
| 2894 | } |
| 2895 | fs.Debugf(o, "Removing directory marker") |
| 2896 | err := o.Remove(ctx) |
| 2897 | if err != nil { |
| 2898 | return fmt.Errorf("removing directory marker failed: %w", err) |
| 2899 | } |
| 2900 | } |
| 2901 | if bucket == "" || directory != "" { |
| 2902 | return nil |
| 2903 | } |
| 2904 | return f.cache.Remove(bucket, func() error { |
| 2905 | req := s3.DeleteBucketInput{ |
| 2906 | Bucket: &bucket, |
| 2907 | } |
| 2908 | err := f.pacer.Call(func() (bool, error) { |
| 2909 | _, err := f.c.DeleteBucket(ctx, &req) |
| 2910 | return f.shouldRetry(ctx, err) |
| 2911 | }) |
| 2912 | if err == nil { |
| 2913 | fs.Infof(f, "Bucket %q deleted", bucket) |
| 2914 | } |
| 2915 | return err |
| 2916 | }) |
| 2917 | } |
| 2918 | |
| 2919 | // Precision of the remote |
| 2920 | func (f *Fs) Precision() time.Duration { |
no test coverage detected