-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmsg.go
More file actions
48 lines (38 loc) · 733 Bytes
/
Copy pathmsg.go
File metadata and controls
48 lines (38 loc) · 733 Bytes
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
package icefiredb_ipfs_log
import (
"encoding/json"
"berty.tech/go-ipfs-log/entry"
core "github.com/libp2p/go-libp2p/core"
)
type LocalWrite struct {
Heads []*entry.Entry
}
func NewLocalWrite(heads []*entry.Entry) LocalWrite {
return LocalWrite{
heads,
}
}
func (m *LocalWrite) Marshal() []byte {
b, _ := json.Marshal(m)
return b
}
type RemoteWrite struct {
From core.PeerID
Heads []*entry.Entry
}
func NewRemoteWrite(from core.PeerID, heads []*entry.Entry) RemoteWrite {
return RemoteWrite{
from,
heads,
}
}
func (m *RemoteWrite) Marshal() []byte {
b, _ := json.Marshal(m)
return b
}
type DataLogEvent struct {
Payload []byte
}
func NewDataLogEvent(b []byte) DataLogEvent {
return DataLogEvent{b}
}