Commit 80386cb8 authored by Eric Myhre's avatar Eric Myhre

Five minutes in: not all nodes are serializable.

Hopefully if we come up with a good way to flip one node impl into another,
we'll be able to come up with an easy interface for "this is referencing
an in-memory structure type of mine, but hashed as CBOR native standard".
parent 18d1705b
[submodule ".gopath/src/github.com/polydawn/refmt"]
path = .gopath/src/github.com/polydawn/refmt
url = https://github.com/polydawn/refmt
Subproject commit e22c00b5cd9b3c32666b21d623a0d2b6fdcbc39e
package ipldbind
import (
"reflect"
"github.com/ipld/go-ipld-prime"
"github.com/polydawn/refmt/obj/atlas"
)
var (
_ ipld.Node = &Node{}
)
/*
Node binds to some Go object in memory, using the definitions provided
by refmt's object atlasing tools.
This binding does not provide a serialization valid for hashing; to
compute a CID, you'll have to convert to another kind of node.
If you're not sure which kind serializable node to use, try `ipldcbor.Node`.
*/
type Node struct {
bound reflect.Value
atlas atlas.Atlas
}
...@@ -4,7 +4,13 @@ import ( ...@@ -4,7 +4,13 @@ import (
"github.com/ipld/go-ipld-prime" "github.com/ipld/go-ipld-prime"
) )
var _ ipld.Node = &Node{} var (
_ ipld.Node = &Node{}
_ ipld.SerializableNode = &Node{}
)
/*
Node in ipldcbor is implemented // ... if you want to hash it or write it: both are better streamed (especially the former)
*/
type Node struct { type Node struct {
} }
...@@ -2,3 +2,9 @@ package ipld ...@@ -2,3 +2,9 @@ package ipld
type Node interface { type Node interface {
} }
type SerializableNode interface {
}
type MutableNode interface {
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment