-
Notifications
You must be signed in to change notification settings - Fork 151
/
child.go
41 lines (32 loc) · 919 Bytes
/
child.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
package storage
import (
"github.com/iotaledger/hive.go/objectstorage"
"github.com/iotaledger/hornet/pkg/model/hornet"
)
type Child struct {
objectstorage.StorableObjectFlags
parentMessageID hornet.MessageID
childMessageID hornet.MessageID
}
func NewChild(parentMessageID hornet.MessageID, childMessageID hornet.MessageID) *Child {
return &Child{
parentMessageID: parentMessageID,
childMessageID: childMessageID,
}
}
func (a *Child) ParentMessageID() hornet.MessageID {
return a.parentMessageID
}
func (a *Child) ChildMessageID() hornet.MessageID {
return a.childMessageID
}
// ObjectStorage interface
func (a *Child) Update(_ objectstorage.StorableObject) {
// do nothing, since the object is identical (consists of key only)
}
func (a *Child) ObjectStorageKey() []byte {
return append(a.parentMessageID, a.childMessageID...)
}
func (a *Child) ObjectStorageValue() (_ []byte) {
return nil
}