mirror of
https://github.com/ipfs/kubo.git
synced 2026-03-09 18:28:08 +08:00
I'd like to sneak this into the release so we can turn on strict verification ASAP. License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>
58 lines
1.3 KiB
Go
58 lines
1.3 KiB
Go
package repo
|
|
|
|
import (
|
|
"errors"
|
|
|
|
filestore "github.com/ipfs/go-ipfs/filestore"
|
|
keystore "github.com/ipfs/go-ipfs/keystore"
|
|
|
|
config "gx/ipfs/QmPEpj17FDRpc7K1aArKZp3RsHtzRMKykeK9GVgn4WQGPR/go-ipfs-config"
|
|
ma "gx/ipfs/QmT4U94DnD8FRfqr21obWY32HLM5VExccPKMjQHofeYqr9/go-multiaddr"
|
|
)
|
|
|
|
var errTODO = errors.New("TODO: mock repo")
|
|
|
|
// Mock is not thread-safe
|
|
type Mock struct {
|
|
C config.Config
|
|
D Datastore
|
|
K keystore.Keystore
|
|
}
|
|
|
|
func (m *Mock) Config() (*config.Config, error) {
|
|
return &m.C, nil // FIXME threadsafety
|
|
}
|
|
|
|
func (m *Mock) SetConfig(updated *config.Config) error {
|
|
m.C = *updated // FIXME threadsafety
|
|
return nil
|
|
}
|
|
|
|
func (m *Mock) BackupConfig(prefix string) (string, error) {
|
|
return "", errTODO
|
|
}
|
|
|
|
func (m *Mock) SetConfigKey(key string, value interface{}) error {
|
|
return errTODO
|
|
}
|
|
|
|
func (m *Mock) GetConfigKey(key string) (interface{}, error) {
|
|
return nil, errTODO
|
|
}
|
|
|
|
func (m *Mock) Datastore() Datastore { return m.D }
|
|
|
|
func (m *Mock) GetStorageUsage() (uint64, error) { return 0, nil }
|
|
|
|
func (m *Mock) Close() error { return errTODO }
|
|
|
|
func (m *Mock) SetAPIAddr(addr ma.Multiaddr) error { return errTODO }
|
|
|
|
func (m *Mock) Keystore() keystore.Keystore { return m.K }
|
|
|
|
func (m *Mock) SwarmKey() ([]byte, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
func (m *Mock) FileManager() *filestore.FileManager { return nil }
|