-
Notifications
You must be signed in to change notification settings - Fork 0
/
repo.go
46 lines (33 loc) · 1018 Bytes
/
repo.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
package repo
import (
"errors"
"io"
filestore "github.com/ipfs/go-ipfs/filestore"
keystore "github.com/ipfs/go-ipfs/keystore"
config "github.com/ipfs/go-ipfs/repo/config"
ds "gx/ipfs/QmRWDav6mzWseLWeYfVd5fvUKiVe9xNH29YfMF438fG364/go-datastore"
ma "gx/ipfs/QmcyqRMCAXVtYPS4DiBrA7sezL9rRGfW8Ctx7cywL4TXJj/go-multiaddr"
)
var (
ErrApiNotRunning = errors.New("api not running")
)
type Repo interface {
Config() (*config.Config, error)
SetConfig(*config.Config) error
SetConfigKey(key string, value interface{}) error
GetConfigKey(key string) (interface{}, error)
Datastore() Datastore
GetStorageUsage() (uint64, error)
Keystore() keystore.Keystore
FileManager() *filestore.FileManager
// SetAPIAddr sets the API address in the repo.
SetAPIAddr(addr ma.Multiaddr) error
SwarmKey() ([]byte, error)
io.Closer
}
// Datastore is the interface required from a datastore to be
// acceptable to FSRepo.
type Datastore interface {
ds.Batching // should be threadsafe, just be careful
io.Closer
}