mirror of
https://github.com/ipfs/kubo.git
synced 2025-08-26 12:32:31 +08:00
48 lines
1.0 KiB
Go
48 lines
1.0 KiB
Go
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"
|
|
|
|
ma "gx/ipfs/QmW8s4zTsUoX1Q6CeYxVKPyqSKbF7H1YDUyTostBtZ8DaG/go-multiaddr"
|
|
ds "gx/ipfs/QmdHG8MAuARdGHxx4rPQASLcvhz24fzjSQq7AJRAQEorq5/go-datastore"
|
|
)
|
|
|
|
var (
|
|
ErrApiNotRunning = errors.New("api not running")
|
|
)
|
|
|
|
type Repo interface {
|
|
Config() (*config.Config, error)
|
|
BackupConfig(prefix string) (string, 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
|
|
}
|