-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstorage.go
More file actions
44 lines (33 loc) · 814 Bytes
/
storage.go
File metadata and controls
44 lines (33 loc) · 814 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package storage
import (
"context"
"io"
"time"
)
// Key: /[a-z0-9\-_]+/
type Metadata map[string]string
type Stats struct {
ETag string
ContentType string
Size int64
LastModified time.Time
Metadata Metadata
}
// zero-indexed & inclusive; https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Range
type Range struct {
Start int64
End int64
}
type GetOptions struct {
Range *Range
}
type PutOptions struct {
ContentType string
Metadata Metadata
}
type Storage interface {
Put(ctx context.Context, key string, reader io.Reader, size int64, opts *PutOptions) error
Get(ctx context.Context, key string, opts *GetOptions) (io.ReadCloser, *Stats, error)
Delete(ctx context.Context, key string) error
Stat(ctx context.Context, key string) (*Stats, error)
}