Documentation

Index

Constants

This section is empty.

Variables

View Source
var HEADER_NAMES = []string{"Content-MD5", "Content-Type", "Date"}
View Source
var UserAgent = fmt.Sprintf("juicesync/%s", versioninfo.Version())

Functions

func Register

func Register(name string, register Creator)

func Walk

func Walk(root string, walkFn filepath.WalkFunc) error

    Walk walks the file tree rooted at root, calling walkFn for each file or directory in the tree, including root. All errors that arise visiting files and directories are filtered by walkFn. The files are walked in lexical order, which makes the output deterministic but means that for very large directories Walk can be inefficient. Walk always follow symbolic links.

    Types

    type COS

    type COS struct {
    	// contains filtered or unexported fields
    }

    func (*COS) AbortUpload

    func (c *COS) AbortUpload(key string, uploadID string)

    func (*COS) CompleteUpload

    func (c *COS) CompleteUpload(key string, uploadID string, parts []*Part) error

    func (*COS) Copy

    func (c *COS) Copy(dst, src string) error

    func (*COS) Create

    func (c *COS) Create() error

    func (*COS) CreateMultipartUpload

    func (c *COS) CreateMultipartUpload(key string) (*MultipartUpload, error)

    func (*COS) Delete

    func (c *COS) Delete(key string) error

    func (*COS) Get

    func (c *COS) Get(key string, off, limit int64) (io.ReadCloser, error)

    func (*COS) Head

    func (c *COS) Head(key string) (*Object, error)

    func (*COS) List

    func (c *COS) List(prefix, marker string, limit int64) ([]*Object, error)

    func (*COS) ListAll

    func (c *COS) ListAll(prefix, marker string) (<-chan *Object, error)

    func (*COS) ListUploads

    func (c *COS) ListUploads(marker string) ([]*PendingPart, string, error)

    func (*COS) Put

    func (c *COS) Put(key string, in io.Reader) error

    func (*COS) String

    func (c *COS) String() string

    func (*COS) UploadPart

    func (c *COS) UploadPart(key string, uploadID string, num int, body []byte) (*Part, error)

    type Contents

    type Contents struct {
    	Key          string
    	Size         int64
    	LastModified time.Time
    }

    type Creator

    type Creator func(bucket, accessKey, secretKey string) (ObjectStorage, error)

    type DataItem

    type DataItem struct {
    	FileName   string
    	Size       int64
    	ModifyTime int
    }

    type DefaultObjectStorage

    type DefaultObjectStorage struct{}

    func (DefaultObjectStorage) AbortUpload

    func (s DefaultObjectStorage) AbortUpload(key string, uploadID string)

    func (DefaultObjectStorage) CompleteUpload

    func (s DefaultObjectStorage) CompleteUpload(key string, uploadID string, parts []*Part) error

    func (DefaultObjectStorage) Create

    func (s DefaultObjectStorage) Create() error

    func (DefaultObjectStorage) CreateMultipartUpload

    func (s DefaultObjectStorage) CreateMultipartUpload(key string) (*MultipartUpload, error)

    func (DefaultObjectStorage) List

    func (s DefaultObjectStorage) List(prefix, marker string, limit int64) ([]*Object, error)

    func (DefaultObjectStorage) ListAll

    func (s DefaultObjectStorage) ListAll(prefix, marker string) (<-chan *Object, error)

    func (DefaultObjectStorage) ListUploads

    func (s DefaultObjectStorage) ListUploads(marker string) ([]*PendingPart, string, error)

    func (DefaultObjectStorage) UploadPart

    func (s DefaultObjectStorage) UploadPart(key string, uploadID string, num int, body []byte) (*Part, error)

    type File

    type File struct {
    	Object
    	Owner string
    	Group string
    	Mode  os.FileMode
    }

    type FileSystem

    type FileSystem interface {
    	MtimeChanger
    	Chmod(path string, mode os.FileMode) error
    	Chown(path string, owner, group string) error
    }

    type ListBucketResult

    type ListBucketResult struct {
    	Contents       []*Contents
    	IsTruncated    bool
    	Prefix         string
    	Marker         string
    	MaxKeys        string
    	NextMarker     string
    	CommonPrefixes string
    }

      ListObjectsOutput presents output for ListObjects.

      type MtimeChanger

      type MtimeChanger interface {
      	Chtimes(path string, mtime time.Time) error
      }

      type MultipartUpload

      type MultipartUpload struct {
      	MinPartSize int
      	MaxCount    int
      	UploadID    string
      }

      type Object

      type Object struct {
      	Key   string
      	Size  int64
      	Mtime time.Time // Unix seconds
      	IsDir bool
      }

      type ObjectStorage

      type ObjectStorage interface {
      	String() string
      	Create() error
      	Head(key string) (*Object, error)
      	Get(key string, off, limit int64) (io.ReadCloser, error)
      	Put(key string, in io.Reader) error
      	Delete(key string) error
      	List(prefix, marker string, limit int64) ([]*Object, error)
      	ListAll(prefix, marker string) (<-chan *Object, error)
      	CreateMultipartUpload(key string) (*MultipartUpload, error)
      	UploadPart(key string, uploadID string, num int, body []byte) (*Part, error)
      	AbortUpload(key string, uploadID string)
      	CompleteUpload(key string, uploadID string, parts []*Part) error
      	ListUploads(marker string) ([]*PendingPart, string, error)
      }

      func CreateStorage

      func CreateStorage(name, endpoint, accessKey, secretKey string) (ObjectStorage, error)

      func WithPrefix

      func WithPrefix(os ObjectStorage, prefix string) (ObjectStorage, error)

        WithPrefix retuns a object storage that add a prefix to keys.

        type Part

        type Part struct {
        	Num  int
        	Size int
        	ETag string
        }

        type PendingPart

        type PendingPart struct {
        	Key      string
        	UploadID string
        	Created  time.Time
        }

        type RestfulStorage

        type RestfulStorage struct {
        	DefaultObjectStorage
        	// contains filtered or unexported fields
        }

        func (*RestfulStorage) Copy

        func (s *RestfulStorage) Copy(dst, src string) error

        func (*RestfulStorage) Delete

        func (s *RestfulStorage) Delete(key string) error

        func (*RestfulStorage) Get

        func (s *RestfulStorage) Get(key string, off, limit int64) (io.ReadCloser, error)

        func (*RestfulStorage) Head

        func (s *RestfulStorage) Head(key string) (*Object, error)

        func (*RestfulStorage) List

        func (s *RestfulStorage) List(prefix, marker string, limit int64) ([]*Object, error)

        func (*RestfulStorage) Put

        func (u *RestfulStorage) Put(key string, body io.Reader) error

        func (*RestfulStorage) String

        func (s *RestfulStorage) String() string