Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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 Store.Files. File hides differences in object returns from different cloud storage providers, but at the same time, it can only return less information.
type Store ¶
type Store interface { // Put saves the content read from r to the key of oss. Put(ctx context.Context, key string, r io.Reader) error // PutFromFile saves the file pointed to by the `localPath` to the oss key. PutFromFile(ctx context.Context, key string, localPath string) error // Get gets the file pointed to by key. Get(ctx context.Context, key string) (io.ReadCloser, error) // GetString gets the file pointed to by key and returns a string. GetString(ctx context.Context, key string) (string, error) // GetBytes gets the file pointed to by key and returns a byte array. GetBytes(ctx context.Context, key string) ([]byte, error) // GetToFile saves the file pointed to by key to the localPath. GetToFile(ctx context.Context, key string, localPath string) error // Delete the file pointed to by key. Delete(ctx context.Context, key string) error // Exists determines whether the file exists. Exists(ctx context.Context, key string) (bool, error) // Files list all files in the specified directory. Files(ctx context.Context, dir string) ([]File, error) // Size fet the file size. Size(ctx context.Context, key string) (int64, error) }
Store defines interface for cloud storage.
Click to show internal directories.
Click to hide internal directories.