Documentation ¶
Index ¶
- func CloseCheck(f func() error)
- type LocalStorage
- func (s *LocalStorage) Delete(_ context.Context, token string, filename string) (err error)
- func (s *LocalStorage) Get(_ context.Context, token string, filename string) (reader io.ReadCloser, contentLength uint64, err error)
- func (s *LocalStorage) Head(_ context.Context, token string, filename string) (contentLength uint64, err error)
- func (s *LocalStorage) IsNotExist(err error) bool
- func (s *LocalStorage) Purge(_ context.Context, days time.Duration) (err error)
- func (s *LocalStorage) Put(_ context.Context, token string, filename string, reader io.Reader, ...) error
- func (s *LocalStorage) Type() string
- type S3Storage
- func (s *S3Storage) Delete(ctx context.Context, token string, filename string) (err error)
- func (s *S3Storage) Get(ctx context.Context, token string, filename string) (reader io.ReadCloser, contentLength uint64, err error)
- func (s *S3Storage) Head(ctx context.Context, token string, filename string) (contentLength uint64, err error)
- func (s *S3Storage) IsNotExist(err error) bool
- func (s *S3Storage) Purge(context.Context, time.Duration) (err error)
- func (s *S3Storage) Put(ctx context.Context, token string, filename string, reader io.Reader, ...) (err error)
- func (s *S3Storage) Type() string
- type Storage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloseCheck ¶
func CloseCheck(f func() error)
Types ¶
type LocalStorage ¶
type LocalStorage struct { Storage // contains filtered or unexported fields }
LocalStorage is a local storage
func NewLocalStorage ¶
func NewLocalStorage(basedir string, logger *log.Logger) (*LocalStorage, error)
NewLocalStorage is the factory for LocalStorage
func (*LocalStorage) Get ¶
func (s *LocalStorage) Get(_ context.Context, token string, filename string) (reader io.ReadCloser, contentLength uint64, err error)
Get retrieves a file from storage
func (*LocalStorage) Head ¶
func (s *LocalStorage) Head(_ context.Context, token string, filename string) (contentLength uint64, err error)
Head retrieves content length of a file from storage
func (*LocalStorage) IsNotExist ¶
func (s *LocalStorage) IsNotExist(err error) bool
IsNotExist indicates if a file doesn't exist on storage
type S3Storage ¶
type S3Storage struct { Storage // contains filtered or unexported fields }
S3Storage is a storage backed by AWS S3
func NewS3Storage ¶
func NewS3Storage(accessKey, secretKey, bucketName string, purgeDays int, region, endpoint string, disableMultipart bool, forcePathStyle bool, logger *log.Logger) (*S3Storage, error)
NewS3Storage is the factory for S3Storage
func (*S3Storage) Get ¶
func (s *S3Storage) Get(ctx context.Context, token string, filename string) (reader io.ReadCloser, contentLength uint64, err error)
Get retrieves a file from storage
func (*S3Storage) Head ¶
func (s *S3Storage) Head(ctx context.Context, token string, filename string) (contentLength uint64, err error)
Head retrieves content length of a file from storage
func (*S3Storage) IsNotExist ¶
IsNotExist indicates if a file doesn't exist on storage
type Storage ¶
type Storage interface { // Get retrieves a file from storage Get(ctx context.Context, token string, filename string) (reader io.ReadCloser, contentLength uint64, err error) // Head retrieves content length of a file from storage Head(ctx context.Context, token string, filename string) (contentLength uint64, err error) // Put saves a file on storage Put(ctx context.Context, token string, filename string, reader io.Reader, contentType string, contentLength uint64) error // Delete removes a file from storage Delete(ctx context.Context, token string, filename string) error // IsNotExist indicates if a file doesn't exist on storage IsNotExist(err error) bool // Purge cleans up the storage Purge(ctx context.Context, days time.Duration) error // Type returns the storage type Type() string }
Storage is the interface for storage operation
Click to show internal directories.
Click to hide internal directories.