2016-06-07 08:37:42 +02:00
|
|
|
package backends
|
|
|
|
|
|
|
|
import (
|
2019-01-25 08:33:11 +01:00
|
|
|
"errors"
|
2016-06-07 08:37:42 +02:00
|
|
|
"io"
|
2020-03-19 01:26:43 +01:00
|
|
|
"net/http"
|
2019-01-25 08:33:11 +01:00
|
|
|
"time"
|
2016-06-07 08:37:42 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
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)
|
2019-04-09 22:28:18 +02:00
|
|
|
PutMetadata(key string, m Metadata) error
|
2020-03-19 01:26:43 +01:00
|
|
|
ServeFile(key string, w http.ResponseWriter, r *http.Request) error
|
2016-06-07 08:37:42 +02:00
|
|
|
Size(key string) (int64, error)
|
|
|
|
}
|
2017-05-02 06:25:56 +02:00
|
|
|
|
|
|
|
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")
|