Documentation ¶
Overview ¶
Package storage defines Storage API
Index ¶
- type AuthTracker
- type Authenticator
- type BatchUploader
- type Checker
- type Copier
- type Creator
- type Deleter
- type ErrorCoder
- type Getter
- type Lister
- type Manager
- type Mover
- type Object
- type OnVisit
- type Opener
- type Option
- type Options
- type Sizer
- type Storager
- type StoragerAuthTracker
- type Upload
- type Uploader
- type Walker
- type WriterProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthTracker ¶ added in v0.5.0
type AuthTracker interface { //IsAuthChanged return true if auth has changed IsAuthChanged(ctx context.Context, baseURL string, options []Option) bool }
AuthTracker represents auth change tracker
type Authenticator ¶
type Authenticator interface { //Auth authenticate URL scheme with authentication option Auth(baseURL string, option ...Option) }
Authenticator represents an authennticator
type BatchUploader ¶
type BatchUploader interface { //Uploader returns upload handler, and upload closer for batch upload or error Uploader(ctx context.Context, URL string, options ...Option) (Upload, io.Closer, error) }
BatchUploader represents a batch uploader
type Checker ¶
type Checker interface { //Exists returns true if resource exists Exists(ctx context.Context, URL string, options ...Option) (bool, error) }
Checker represents abstraction that check if resource exists
type Copier ¶
type Copier interface { //Copy copies source to dest Copy(ctx context.Context, sourceURL, destURL string, options ...Option) error }
Copier represents an asset copier
type Creator ¶
type Creator interface { //CreateBucket creates a bucket Create(ctx context.Context, URL string, mode os.FileMode, isDir bool, options ...Option) error }
Creator represents a creator
type Deleter ¶
type Deleter interface { //Delete removes passed in storage object Delete(ctx context.Context, URL string, options ...Option) error }
Deleter represents a deleter
type ErrorCoder ¶ added in v1.3.0
ErrorCoder represents error coder
type Getter ¶ added in v0.9.0
type Getter interface { //List returns a list of object for supplied url Object(ctx context.Context, URL string, options ...Option) (Object, error) }
Getter represents asset getter
type Lister ¶
type Lister interface { //List returns a list of object for supplied url List(ctx context.Context, URL string, options ...Option) ([]Object, error) }
Lister represents asset lister
type Mover ¶
type Mover interface { //Move moves source to dest Move(ctx context.Context, sourceURL, destURL string, options ...Option) error }
Mover represents an asset mover
type Object ¶
type Object interface { os.FileInfo //URL return storage url URL() string //Wrap wraps source storage object Wrap(source interface{}) //Unwrap unwraps source storage object into provided target. Unwrap(target interface{}) error }
Object represents a storage object
type OnVisit ¶
type OnVisit func(ctx context.Context, baseURL string, parent string, info os.FileInfo, reader io.Reader) (toContinue bool, err error)
OnVisit represents on location visit handler
type Opener ¶ added in v1.0.0
type Opener interface { //Open returns reader for downloaded storage object Open(ctx context.Context, object Object, options ...Option) (io.ReadCloser, error) //Open returns reader for downloaded storage object OpenURL(ctx context.Context, URL string, options ...Option) (io.ReadCloser, error) }
Opener represents a downloader
type Option ¶
type Option interface{}
Option represents generic service operation option
func NewOptions ¶
NewOptions returns new options
type Sizer ¶ added in v0.6.0
type Sizer interface {
Size() int64
}
Sizer represents abstraction returing a size
type Storager ¶
type Storager interface { io.Closer //Exists returns true if location exists Exists(ctx context.Context, location string, options ...Option) (bool, error) //List lists location assets List(ctx context.Context, location string, options ...Option) ([]os.FileInfo, error) //Get returns a file info for supplied location Get(ctx context.Context, location string, options ...Option) (os.FileInfo, error) //Open returns a reader closer for supplied resources Open(ctx context.Context, location string, options ...Option) (io.ReadCloser, error) //Upload uploads Upload(ctx context.Context, destination string, mode os.FileMode, reader io.Reader, options ...Option) error //Create create file or directory Create(ctx context.Context, destination string, mode os.FileMode, reader io.Reader, isDir bool, options ...Option) error //Delete deletes locations Delete(ctx context.Context, location string, options ...Option) error }
Storager represents path oriented storage service
type StoragerAuthTracker ¶ added in v0.5.0
type StoragerAuthTracker interface { //FilterAuthOptions filters auth options FilterAuthOptions(option []Option) []Option //IsAuthChanged return true if auth has changes IsAuthChanged(authOptions []Option) bool }
StoragerAuthTracker represents auth manager
type Uploader ¶
type Uploader interface { //Upload uploads provided reader content for supplied storage object. Upload(ctx context.Context, URL string, mode os.FileMode, reader io.Reader, options ...Option) error }
Uploader represents an uploader