-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanager.go
57 lines (48 loc) · 1.35 KB
/
manager.go
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
45
46
47
48
49
50
51
52
53
54
55
56
57
package storage
import (
"context"
"io"
"os"
)
//Manager represents storage manager
type Manager interface {
Lister
Opener
Uploader
Deleter
Creator
io.Closer
Scheme() string
}
//Lister represents asset lister
type Lister interface {
//List returns a list of object for supplied url
List(ctx context.Context, URL string, options ...Option) ([]Object, error)
}
//Getter represents asset getter
type Getter interface {
//List returns a list of object for supplied url
Object(ctx context.Context, URL string, options ...Option) (Object, error)
}
//Opener represents a downloader
type Opener interface {
//Open returns reader for downloaded storage object
Open(ctx context.Context, object Object, options ...Option) (io.ReadCloser, error)
//Open returns reader for downloaded storage object
OpenURL(ctx context.Context, URL string, options ...Option) (io.ReadCloser, error)
}
//Deleter represents a deleter
type Deleter interface {
//Delete removes passed in storage object
Delete(ctx context.Context, URL string, options ...Option) error
}
//Creator represents a creator
type Creator interface {
//CreateBucket creates a bucket
Create(ctx context.Context, URL string, mode os.FileMode, isDir bool, options ...Option) error
}
//ErrorCoder represents error coder
type ErrorCoder interface {
//ErrorCode returns an error code
ErrorCode(err error) int
}