Documentation ¶
Index ¶
- type FileStorage
- type LocalStorage
- func (s *LocalStorage) DeleteFile(ctx context.Context, objectKey string) error
- func (s *LocalStorage) DownloadFile(ctx context.Context, objectKey string) (io.ReadCloser, error)
- func (s *LocalStorage) ListFiles(ctx context.Context) ([]string, error)
- func (s *LocalStorage) Reset(ctx context.Context) error
- func (s *LocalStorage) UploadFile(ctx context.Context, objectKey string, reader io.Reader) (string, error)
- type LocalStorageConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileStorage ¶
type FileStorage interface { UploadFile(ctx context.Context, objectKey string, reader io.Reader) (string, error) DownloadFile(ctx context.Context, objectKey string) (io.ReadCloser, error) DeleteFile(ctx context.Context, objectKey string) error ListFiles(ctx context.Context) ([]string, error) Reset(ctx context.Context) error }
FileStorage defines interface for file store
func NewFileStorage ¶
func NewFileStorage(cfg interface{}) FileStorage
NewFileStorage creates a new file storages TODO: Support other types (GCS, S3) to deploy mock server as a cluster
type LocalStorage ¶
type LocalStorage struct {
// contains filtered or unexported fields
}
LocalStorage define methods to access local storage
func NewLocalStorage ¶
func NewLocalStorage(config LocalStorageConfig) *LocalStorage
NewLocalStorage creates a new instance of LocalStorage
func (*LocalStorage) DeleteFile ¶
func (s *LocalStorage) DeleteFile(ctx context.Context, objectKey string) error
DeleteFile deletes file from local storage
func (*LocalStorage) DownloadFile ¶
func (s *LocalStorage) DownloadFile(ctx context.Context, objectKey string) (io.ReadCloser, error)
DownloadFile writes file saved in local storage to writer
func (*LocalStorage) ListFiles ¶
func (s *LocalStorage) ListFiles(ctx context.Context) ([]string, error)
ListFiles list all files
func (*LocalStorage) Reset ¶
func (s *LocalStorage) Reset(ctx context.Context) error
Reset removes all files
func (*LocalStorage) UploadFile ¶
func (s *LocalStorage) UploadFile(ctx context.Context, objectKey string, reader io.Reader) (string, error)
UploadFile reads from reader and saves to local storage
type LocalStorageConfig ¶
LocalStorageConfig defines config for local storage
Click to show internal directories.
Click to hide internal directories.