forked from berty/go-orbit-db
/
interface.go
54 lines (42 loc) · 1.24 KB
/
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
43
44
45
46
47
48
49
50
51
52
53
54
package replicator
import (
"context"
ipfslog "github.com/stateless-minds/go-ipfs-log"
"github.com/stateless-minds/go-ipfs-log/identityprovider"
"github.com/stateless-minds/go-orbit-db/accesscontroller"
coreapi "github.com/ipfs/boxo/coreiface"
cid "github.com/ipfs/go-cid"
"github.com/libp2p/go-libp2p/core/event"
)
// storeInterface An interface used to avoid import cycles
type storeInterface interface {
OpLog() ipfslog.Log
IPFS() coreapi.CoreAPI
Identity() *identityprovider.Identity
AccessController() accesscontroller.Interface
SortFn() ipfslog.SortFn
IO() ipfslog.IO
}
// Replicator Replicates stores information among peers
type Replicator interface {
// Stop Stops the replication
Stop()
// Load Loads new data to replicate
Load(ctx context.Context, heads []ipfslog.Entry)
// GetQueue Returns the list of CID in the queue
GetQueue() []cid.Cid
EventBus() event.Bus
}
// ReplicationInfo Holds information about the current replication state
type ReplicationInfo interface {
// GetProgress Get the value of progress
GetProgress() int
// GetProgress Get the value of progress
SetProgress(i int)
// GetMax Get the value of max
GetMax() int
// SetMax Sets the value of max
SetMax(i int)
// Reset Resets all values to 0
Reset()
}