/
interface.go
42 lines (36 loc) · 1006 Bytes
/
interface.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
package data_store
import (
"context"
"fmt"
"io"
)
type IDataStoreClient interface {
GetFile(name string, location string) ([]byte, error)
UploadFromFile(filePath string, dest string) error
UploadFromBytes(data []byte, destFolder string, destName string) error
UploadFromReader(data io.Reader, size int64, destFolder string, destName string) error
List(dir string, prefix string) ([]string, error)
ListChan(ctx context.Context, dir string, prefix string) (<-chan string, error)
StorageType() string
DeleteFiles(name string, location string) error
RenameFile(oldName string, newName string, bucket string) error
}
type DataStoreClient struct {
Client IDataStoreClient
}
type DataStoreConfig struct {
Url string
UseHttps bool
NoVerifySSL bool
User string
Password string
Service string
DataPath string
ContentType string
S3MaxRetries int
S3DelayRetries int
}
// Errors
var (
ErrFileNotFound = fmt.Errorf("file not found")
)