Documentation ¶
Index ¶
- func CloseCheck(c io.Closer)
- type GDrive
- func (s *GDrive) Delete(ctx context.Context, token string, filename string) (err error)
- func (s *GDrive) Get(ctx context.Context, token string, filename string, rng *Range) (reader io.ReadCloser, contentLength uint64, err error)
- func (s *GDrive) Head(ctx context.Context, token string, filename string) (contentLength uint64, err error)
- func (s *GDrive) IsNotExist(err error) bool
- func (s *GDrive) IsRangeSupported() bool
- func (s *GDrive) Purge(ctx context.Context, days time.Duration) (err error)
- func (s *GDrive) Put(ctx context.Context, token string, filename string, reader io.Reader, ...) error
- func (s *GDrive) Type() string
- type LocalStorage
- func (s *LocalStorage) Delete(_ context.Context, token string, filename string) (err error)
- func (s *LocalStorage) Get(_ context.Context, token string, filename string, rng *Range) (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) IsRangeSupported() 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 Range
- 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, rng *Range) (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) IsRangeSupported() 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
- type StorjStorage
- func (s *StorjStorage) Delete(ctx context.Context, token string, filename string) (err error)
- func (s *StorjStorage) Get(ctx context.Context, token string, filename string, rng *Range) (reader io.ReadCloser, contentLength uint64, err error)
- func (s *StorjStorage) Head(ctx context.Context, token string, filename string) (contentLength uint64, err error)
- func (s *StorjStorage) IsNotExist(err error) bool
- func (s *StorjStorage) IsRangeSupported() bool
- func (s *StorjStorage) Purge(context.Context, time.Duration) (err error)
- func (s *StorjStorage) Put(ctx context.Context, token string, filename string, reader io.Reader, ...) (err error)
- func (s *StorjStorage) Type() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloseCheck ¶
Types ¶
type GDrive ¶
type GDrive struct {
// contains filtered or unexported fields
}
GDrive is a storage backed by GDrive
func NewGDriveStorage ¶
func NewGDriveStorage(ctx context.Context, clientJSONFilepath string, localConfigPath string, basedir string, chunkSize int, logger *log.Logger) (*GDrive, error)
NewGDriveStorage is the factory for GDrive
func (*GDrive) Get ¶
func (s *GDrive) Get(ctx context.Context, token string, filename string, rng *Range) (reader io.ReadCloser, contentLength uint64, err error)
Get retrieves a file from storage
func (*GDrive) Head ¶
func (s *GDrive) Head(ctx context.Context, token string, filename string) (contentLength uint64, err error)
Head retrieves content length of a file from storage
func (*GDrive) IsNotExist ¶
IsNotExist indicates if a file doesn't exist on storage
func (*GDrive) IsRangeSupported ¶
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, rng *Range) (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
func (*LocalStorage) IsRangeSupported ¶
func (s *LocalStorage) IsRangeSupported() bool
type Range ¶
func ParseRange ¶
Parses HTTP Range header and returns struct on success only bytes=start-finish supported
func (*Range) AcceptLength ¶
AcceptLength Tries to accept given range returns newContentLength if range was satisfied, otherwise returns given contentLength
func (*Range) ContentRange ¶
Returns accepted Content-Range header. If range wasn't accepted empty string is returned
func (*Range) SetContentRange ¶
type S3Storage ¶
type S3Storage struct { Storage // contains filtered or unexported fields }
S3Storage is a storage backed by AWS S3
func NewS3Storage ¶
func NewS3Storage(ctx context.Context, 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, rng *Range) (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
func (*S3Storage) IsRangeSupported ¶
type Storage ¶
type Storage interface { // Get retrieves a file from storage Get(ctx context.Context, token string, filename string, rng *Range) (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 // Whether storage supports Get with Range header IsRangeSupported() bool // Type returns the storage type Type() string }
Storage is the interface for storage operation
type StorjStorage ¶
type StorjStorage struct { Storage // contains filtered or unexported fields }
StorjStorage is a storage backed by Storj
func NewStorjStorage ¶
func NewStorjStorage(ctx context.Context, access, bucket string, purgeDays int, logger *log.Logger) (*StorjStorage, error)
NewStorjStorage is the factory for StorjStorage
func (*StorjStorage) Get ¶
func (s *StorjStorage) Get(ctx context.Context, token string, filename string, rng *Range) (reader io.ReadCloser, contentLength uint64, err error)
Get retrieves a file from storage
func (*StorjStorage) Head ¶
func (s *StorjStorage) Head(ctx context.Context, token string, filename string) (contentLength uint64, err error)
Head retrieves content length of a file from storage
func (*StorjStorage) IsNotExist ¶
func (s *StorjStorage) IsNotExist(err error) bool
IsNotExist indicates if a file doesn't exist on storage
func (*StorjStorage) IsRangeSupported ¶
func (s *StorjStorage) IsRangeSupported() bool