rclone: github.com/ncw/rclone/lib/bucket Index | Files

package bucket

import "github.com/ncw/rclone/lib/bucket"

Package bucket is contains utilities for managing bucket based backends


Package Files



var (
    // ErrAlreadyDeleted is returned when an already deleted
    // bucket is passed to Remove
    ErrAlreadyDeleted = errors.New("bucket already deleted")

func Split Uses

func Split(absPath string) (bucket, bucketPath string)

Split takes an absolute path which includes the bucket and splits it into a bucket and a path in that bucket bucketPath

type Cache Uses

type Cache struct {
    // contains filtered or unexported fields

Cache stores whether buckets are available and their IDs

func NewCache Uses

func NewCache() *Cache

NewCache creates an empty Cache

func (*Cache) Create Uses

func (c *Cache) Create(bucket string, create CreateFn, exists ExistsFn) (err error)

Create the bucket with create() if it doesn't exist

If exists is set then if the bucket has been deleted it will call exists() to see if it still exists.

If f returns an error we assume the bucket was not created

func (*Cache) IsDeleted Uses

func (c *Cache) IsDeleted(bucket string) bool

IsDeleted returns true if the bucket has definitely been deleted by us, false otherwise.

func (*Cache) MarkDeleted Uses

func (c *Cache) MarkDeleted(bucket string)

MarkDeleted marks the bucket as being deleted

func (*Cache) MarkOK Uses

func (c *Cache) MarkOK(bucket string)

MarkOK marks the bucket as being present

func (*Cache) Remove Uses

func (c *Cache) Remove(bucket string, f func() error) error

Remove the bucket with f if it exists

If f returns an error we assume the bucket was not removed

If the bucket has already been deleted it returns ErrAlreadyDeleted

type CreateFn Uses

type CreateFn func() error

CreateFn should be passed to Create to make a bucket

type ExistsFn Uses

type ExistsFn func() (found bool, err error)

ExistsFn should be passed to Create to see if a bucket exists or not

Package bucket imports 3 packages (graph). Updated 2020-08-05. Refresh now. Tools for package owners.