2023-06-14 12:43:34 +00:00
|
|
|
package ipld
|
|
|
|
|
|
|
|
import "github.com/ipfs/go-cid"
|
|
|
|
|
2024-06-28 09:44:58 +00:00
|
|
|
// Check that node satisfies the IPLD Node interface.
|
|
|
|
var _ IPLD = (*node)(nil)
|
|
|
|
|
|
|
|
type node struct {
|
|
|
|
cid cid.Cid
|
|
|
|
rawdata []byte
|
|
|
|
}
|
|
|
|
|
2023-06-14 12:43:34 +00:00
|
|
|
type IPLD interface {
|
|
|
|
Cid() cid.Cid
|
|
|
|
RawData() []byte
|
|
|
|
}
|
2024-06-28 09:44:58 +00:00
|
|
|
|
|
|
|
// RawData returns the RLP encoded bytes of the node.
|
|
|
|
func (b node) RawData() []byte {
|
|
|
|
return b.rawdata
|
|
|
|
}
|
|
|
|
|
|
|
|
// Cid returns the CID of the node.
|
|
|
|
func (b node) Cid() cid.Cid {
|
|
|
|
return b.cid
|
|
|
|
}
|