Documentation ¶
Index ¶
- Constants
- Variables
- func New(ctx context.Context, log *slog.Logger, cfg *Config) (*Storage, *Storage, error)
- type Config
- type DummyStorage
- func (s *DummyStorage) Delete(ctx context.Context, filepath string) error
- func (s *DummyStorage) Open(ctx context.Context, filepath string) (io.ReadCloser, error)
- func (s DummyStorage) OpenWithStat(ctx context.Context, path string) (io.ReadCloser, *gostorages.Stat, error)
- func (s *DummyStorage) Save(ctx context.Context, content io.Reader, filepath string) error
- func (s DummyStorage) Stat(ctx context.Context, path string) (*gostorages.Stat, error)
- type HTTPStorage
- func (s *HTTPStorage) Headers(filepath string) (map[string]string, error)
- func (s *HTTPStorage) HeadersFromURL(u *url.URL) (map[string]string, error)
- func (s *HTTPStorage) IsNotExist(err error) bool
- func (s *HTTPStorage) ModifiedTime(filepath string) (time.Time, error)
- func (s *HTTPStorage) Open(ctx context.Context, filepath string) (io.ReadCloser, error)
- func (s *HTTPStorage) OpenFromURL(ctx context.Context, u *url.URL) (io.ReadCloser, error)
- type Storage
- func (s *Storage) Delete(ctx context.Context, path string) error
- func (s *Storage) Open(ctx context.Context, path string) (io.ReadCloser, error)
- func (s *Storage) OpenWithStat(ctx context.Context, path string) (io.ReadCloser, *gostorages.Stat, error)
- func (s *Storage) Path(filepath string) string
- func (s *Storage) Save(ctx context.Context, content io.Reader, path string) error
- func (s *Storage) Stat(ctx context.Context, path string) (*gostorages.Stat, error)
- func (s *Storage) URL(filepath string) string
- type StorageConfig
Constants ¶
View Source
const (
DOs3StorageType = "dos3"
)
Variables ¶
View Source
var HeaderKeys = []string{
"Age",
"Content-Type",
"Last-Modified",
"Date",
"Etag",
}
HeaderKeys represents the list of headers
Functions ¶
Types ¶
type Config ¶
type Config struct { Destination *StorageConfig `mapstructure:"dst"` Source *StorageConfig `mapstructure:"src"` }
Config is a struct to represent a section of storage (src, fst)
type DummyStorage ¶
type DummyStorage struct { }
func (*DummyStorage) Delete ¶
func (s *DummyStorage) Delete(ctx context.Context, filepath string) error
func (*DummyStorage) Open ¶
func (s *DummyStorage) Open(ctx context.Context, filepath string) (io.ReadCloser, error)
func (DummyStorage) OpenWithStat ¶
func (s DummyStorage) OpenWithStat(ctx context.Context, path string) (io.ReadCloser, *gostorages.Stat, error)
func (DummyStorage) Stat ¶
func (s DummyStorage) Stat(ctx context.Context, path string) (*gostorages.Stat, error)
type HTTPStorage ¶
type HTTPStorage struct { gostorages.Storage // contains filtered or unexported fields }
HTTPStorage wraps a storage
func NewHTTPStorage ¶
func NewHTTPStorage(storage gostorages.Storage, httpclient *httppkg.Client) *HTTPStorage
func (*HTTPStorage) Headers ¶
func (s *HTTPStorage) Headers(filepath string) (map[string]string, error)
Headers returns headers from a filepath
func (*HTTPStorage) HeadersFromURL ¶
HeadersFromURL retrieves the headers from an url
func (*HTTPStorage) IsNotExist ¶
func (s *HTTPStorage) IsNotExist(err error) bool
func (*HTTPStorage) ModifiedTime ¶
func (s *HTTPStorage) ModifiedTime(filepath string) (time.Time, error)
ModifiedTime returns the modified time from a filepath
func (*HTTPStorage) Open ¶
func (s *HTTPStorage) Open(ctx context.Context, filepath string) (io.ReadCloser, error)
Open retrieves a gostorages File from a filepath
func (*HTTPStorage) OpenFromURL ¶
func (s *HTTPStorage) OpenFromURL(ctx context.Context, u *url.URL) (io.ReadCloser, error)
OpenFromURL retrieves bytes from an url
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage wraps gostorages.Storage.
func (*Storage) OpenWithStat ¶
func (s *Storage) OpenWithStat(ctx context.Context, path string) (io.ReadCloser, *gostorages.Stat, error)
type StorageConfig ¶
type StorageConfig struct { ACL string AccessKeyID string `mapstructure:"access_key_id"` BaseURL string `mapstructure:"base_url"` BucketName string `mapstructure:"bucket_name"` CacheControl string `mapstructure:"cache_control"` Location string Region string SecretAccessKey string `mapstructure:"secret_access_key"` Type string Endpoint string `mapstructure:"endpoint"` }
StorageConfig is a struct to represent a Storage (fs, s3)
Click to show internal directories.
Click to hide internal directories.