forked from berty/go-orbit-db
/
events.go
50 lines (42 loc) · 1.06 KB
/
events.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
package replicator
import (
ipfslog "github.com/stateless-minds/go-ipfs-log"
cid "github.com/ipfs/go-cid"
)
var Events = []interface{}{
new(EventLoadEnd),
new(EventLoadAdded),
new(EventLoadProgress),
}
// EventLoadAdded An event triggered when entries have been added
type EventLoadAdded struct {
Entry ipfslog.Entry
Hash cid.Cid
}
// NewEventLoadAdded Creates a new EventLoadAdded event
func NewEventLoadAdded(h cid.Cid, entry ipfslog.Entry) EventLoadAdded {
return EventLoadAdded{
Entry: entry,
Hash: h,
}
}
// EventLoadProgress An event triggered when entries have been loaded
type EventLoadProgress struct {
Entry ipfslog.Entry
}
// NewEventLoadProgress Creates a new EventLoadProgress event
func NewEventLoadProgress(entry ipfslog.Entry) EventLoadProgress {
return EventLoadProgress{
Entry: entry,
}
}
// EventLoadEnd An event triggered when load ended
type EventLoadEnd struct {
Logs []ipfslog.Log
}
// NewEventLoadEnd Creates a new EventLoadEnd event
func NewEventLoadEnd(logs []ipfslog.Log) EventLoadEnd {
return EventLoadEnd{
Logs: logs,
}
}