Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrExistsDriver = errors.New("driver already exists")
ErrExistsDriver can not register same driver twice.
var ErrorConfigEmpty = errors.New("configuration not correct")
ErrorConfigEmpty is configuration empty error.
Functions ¶
This section is empty.
Types ¶
type Chunks ¶
type Chunks interface {
Chunk() (*ListObjectResult, error)
}
Chunks is used to get the next "page" of objects.
type Driver ¶
type Driver interface { // Storage is the abstraction for cloud storage. Storage() (Storage, error) // Name is the name of provider. Name() string }
Driver is the abstraction for different cloud storage service provider.
type File ¶
type File interface { // Key is the object key. Key() string // Type is the object type. Type() string // Size is the size of current file. Size() int64 // ETag is etag return by cloud storage providers. ETag() string // LastModified is the time when the object was last updated. LastModified() time.Time }
File A slice of File is returned when all files are fetched through Storage.Files. File hides differences in object returns from different cloud storage providers, but at the same time, it can only return less information.
type FileIterator ¶
FileIterator is an iterator used to iterate over all objects in the cloud.
func NewFileIterator ¶
func NewFileIterator(chunks Chunks) FileIterator
NewFileIterator creates an instance of FileIterator.
type Kernel ¶
type Kernel struct { Storage Storage // contains filtered or unexported fields }
Kernel is the core struct of goss, it plays the role of a driver manager.
func (*Kernel) RegisterDriver ¶
RegisterDriver is used to register new driver.
type ListObjectResult ¶
type Storage ¶
type Storage interface { // Put saves the content read from r to the key of oss. Put(key string, r io.Reader) error // PutFromFile saves the file pointed to by the `localPath` to the oss key. PutFromFile(key string, localPath string) error // Get gets the file pointed to by key. Get(key string) (io.ReadCloser, error) // GetString gets the file pointed to by key and returns a string. GetString(key string) (string, error) // GetBytes gets the file pointed to by key and returns a byte array. GetBytes(key string) ([]byte, error) // GetToFile saves the file pointed to by key to the localPath. GetToFile(key string, localPath string) error // Delete the file pointed to by key. Delete(key string) error // Exists determines whether the file exists. Exists(key string) (bool, error) // Files list all files in the specified directory. Files(dir string) ([]File, error) // Size fet the file size. Size(key string) (int64, error) // Store is an instance for calling APIs of different cloud storage service providers. Store() interface{} }
Storage defines a unified interface for reading and writing cloud storage objects.
type Storages ¶
type Storages struct {
// contains filtered or unexported fields
}
Storages store all supported drivers.
type Store ¶
type Store interface { // Put reads the content of r, uploads it to cloud, and names it as key. Put(key string, r io.Reader) error // PutFromFile reads the content of localPath, uploads it to cloud, and names it as key. PutFromFile(key string, localPath string) error // Get gets the content of the object named key in cloud storage. Get(key string) (io.ReadCloser, error) // Delete deletes the contents of the file pointed to by key. Delete(key string) error // Size gets the size of the object pointed to by key. Size(key string) (int64, error) // Exists determines whether the object pointed to by key exists. Exists(key string) (bool, error) // Iterator gets a FileIterator based on prefix. Iterator(prefix string) FileIterator }
Store is an abstraction layer for different cloud storage provider's APIs