ProfouzorsLinx/backends/storage.go

28 lines
676 B
Go
Raw Permalink Normal View History

package backends
import (
2019-01-25 08:33:11 +01:00
"errors"
"io"
"net/http"
2019-01-25 08:33:11 +01:00
"time"
)
type StorageBackend interface {
Delete(key string) error
Exists(key string) (bool, error)
2019-01-25 08:33:11 +01:00
Head(key string) (Metadata, error)
Get(key string) (Metadata, io.ReadCloser, error)
2021-02-10 04:36:14 +01:00
Put(key string, r io.Reader, expiry time.Time, deleteKey, accessKey string, srcIp string) (Metadata, error)
PutMetadata(key string, m Metadata) error
ServeFile(key string, w http.ResponseWriter, r *http.Request) error
Size(key string) (int64, error)
}
type MetaStorageBackend interface {
StorageBackend
List() ([]string, error)
}
2019-01-25 08:33:11 +01:00
var NotFoundErr = errors.New("File not found.")
var FileEmptyError = errors.New("Empty file")