From 278cbcc1f0afcdb72af4a8bfcc8ecb545fa884e3 Mon Sep 17 00:00:00 2001 From: Eric Myhre Date: Sun, 26 Apr 2020 21:50:14 +0200 Subject: [PATCH 1/3] Updating go-ipld-prime to NodeAssembler era. The 'testutil/chaintypes' codegen is currently dropped, and I ported the testchain fixtures to using basicnode instead. We can restore this to using codegen soon, but it's easier to complete this set of changes by temporarily switching to using basicnode. Tests using 'NewUnencodableSelectorSpec' were discarded -- this more or less exercised what would happen if an uninitialized zero value got into a program, and this is now happily statically impossible. Some tests are not passing; have not sussed yet. --- docs/go-graphsync.puml | 2 +- go.mod | 4 +- go.sum | 5 + graphsync.go | 4 +- impl/graphsync_test.go | 8 +- ipldutil/ipldutil.go | 29 +- ipldutil/traverser.go | 16 +- ipldutil/traverser_test.go | 4 +- message/message_test.go | 8 +- messagequeue/messagequeue_test.go | 8 +- metadata/metadata.go | 63 +- network/libp2p_impl_test.go | 4 +- peermanager/peermessagemanager_test.go | 4 +- requestmanager/hooks/hooks_test.go | 10 +- requestmanager/hooks/requesthooks.go | 6 +- requestmanager/requestmanager.go | 2 +- requestmanager/requestmanager_test.go | 25 +- responsemanager/hooks/hooks_test.go | 14 +- responsemanager/hooks/requesthook.go | 6 +- responsemanager/responsemanager_test.go | 8 +- selectorvalidator/selectorvalidator.go | 4 +- selectorvalidator/selectorvalidator_test.go | 4 +- testutil/chaintypes/testchain_gen.go | 1345 ------------------- testutil/chaintypes/testchain_minima.go | 14 - testutil/test_ipld_tree.go | 43 +- testutil/testchain.go | 80 +- testutil/testnodes.go | 12 +- testutil/testnodes_test.go | 6 - 28 files changed, 172 insertions(+), 1566 deletions(-) delete mode 100644 testutil/chaintypes/testchain_gen.go delete mode 100644 testutil/chaintypes/testchain_minima.go diff --git a/docs/go-graphsync.puml b/docs/go-graphsync.puml index a665fc66..5e8838cc 100644 --- a/docs/go-graphsync.puml +++ b/docs/go-graphsync.puml @@ -413,7 +413,7 @@ package "go-filecoin" { "go-filecoin" .. goGraphSyncNetworkPF "go-filecoin" *-- RawLoader "go-filecoin" *-- MulticodecDecodeTable - "go-filecoin" *-- NodeBuilderChooser + "go-filecoin" *-- LinkTargetNodeStyleChooser } diff --git a/go.mod b/go.mod index 2cc14aae..e5d04e9e 100644 --- a/go.mod +++ b/go.mod @@ -21,8 +21,8 @@ require ( github.com/ipfs/go-merkledag v0.3.1 github.com/ipfs/go-peertaskqueue v0.2.0 github.com/ipfs/go-unixfs v0.2.4 - github.com/ipld/go-ipld-prime v0.0.2-0.20200229094926-eb71617f4aeb - github.com/ipld/go-ipld-prime-proto v0.0.0-20200409003434-8cf97d9cb362 + github.com/ipld/go-ipld-prime v0.0.2-0.20200331163611-44af114587ec + github.com/ipld/go-ipld-prime-proto v0.0.0-20200331015814-a6d6f408ac98 github.com/jbenet/go-random v0.0.0-20190219211222-123a90aedc0c github.com/libp2p/go-libp2p v0.6.0 github.com/libp2p/go-libp2p-core v0.5.0 diff --git a/go.sum b/go.sum index 0b3c0bea..a676ed4b 100644 --- a/go.sum +++ b/go.sum @@ -253,8 +253,13 @@ github.com/ipld/go-ipld-prime v0.0.2-0.20191108012745-28a82f04c785 h1:fASnkvtR+S github.com/ipld/go-ipld-prime v0.0.2-0.20191108012745-28a82f04c785/go.mod h1:bDDSvVz7vaK12FNvMeRYnpRFkSUPNQOiCYQezMD/P3w= github.com/ipld/go-ipld-prime v0.0.2-0.20200229094926-eb71617f4aeb h1:uvoZ2aTjsTt/6W5hkzj3JkPMY3oHvcla4WA29k4Jk0I= github.com/ipld/go-ipld-prime v0.0.2-0.20200229094926-eb71617f4aeb/go.mod h1:uVIwe/u0H4VdKv3kaN1ck7uCb6yD9cFLS9/ELyXbsw8= +github.com/ipld/go-ipld-prime v0.0.2-0.20200327122045-fc80c2b0149d/go.mod h1:uVIwe/u0H4VdKv3kaN1ck7uCb6yD9cFLS9/ELyXbsw8= +github.com/ipld/go-ipld-prime v0.0.2-0.20200331163611-44af114587ec h1:BhJ/pwukgBhmlzLfM6CeINszfzavl4ythOHALsovBOc= +github.com/ipld/go-ipld-prime v0.0.2-0.20200331163611-44af114587ec/go.mod h1:uVIwe/u0H4VdKv3kaN1ck7uCb6yD9cFLS9/ELyXbsw8= github.com/ipld/go-ipld-prime-proto v0.0.0-20191113031812-e32bd156a1e5 h1:lSip43rAdyGA+yRQuy6ju0ucZkWpYc1F2CTQtZTVW/4= github.com/ipld/go-ipld-prime-proto v0.0.0-20191113031812-e32bd156a1e5/go.mod h1:gcvzoEDBjwycpXt3LBE061wT9f46szXGHAmj9uoP6fU= +github.com/ipld/go-ipld-prime-proto v0.0.0-20200331015814-a6d6f408ac98 h1:SZ0fO/ir0lAAeKAU87s8wMpTp9wRuOScdwNpw0DT6HI= +github.com/ipld/go-ipld-prime-proto v0.0.0-20200331015814-a6d6f408ac98/go.mod h1:gYRFQ2pKw0riArR4YCWmqmSW6rdytGW4ynwqOAx0VqY= github.com/ipld/go-ipld-prime-proto v0.0.0-20200409003434-8cf97d9cb362 h1:ZPMg5SLiHu/FzBIv7p8obE3VGwiKaRNnM+QxiYsk+tg= github.com/ipld/go-ipld-prime-proto v0.0.0-20200409003434-8cf97d9cb362/go.mod h1:ScHZhxNfNoOTfM87iqdAC37cDh56S+0/LK0NtyriaBk= github.com/ipsn/go-secp256k1 v0.0.0-20180726113642-9d62b9f0bc52/go.mod h1:fdg+/X9Gg4AsAIzWpEHwnqd+QY3b7lajxyjE1m4hkq4= diff --git a/graphsync.go b/graphsync.go index 3c7c0b46..df2e157f 100644 --- a/graphsync.go +++ b/graphsync.go @@ -155,7 +155,7 @@ type BlockData interface { type IncomingRequestHookActions interface { SendExtensionData(ExtensionData) UsePersistenceOption(name string) - UseNodeBuilderChooser(traversal.NodeBuilderChooser) + UseLinkTargetNodeStyleChooser(traversal.LinkTargetNodeStyleChooser) TerminateWithError(error) ValidateRequest() } @@ -172,7 +172,7 @@ type OutgoingBlockHookActions interface { // to change the execution of a request type OutgoingRequestHookActions interface { UsePersistenceOption(name string) - UseNodeBuilderChooser(traversal.NodeBuilderChooser) + UseLinkTargetNodeStyleChooser(traversal.LinkTargetNodeStyleChooser) } // IncomingResponseHookActions are actions that incoming response hook can take diff --git a/impl/graphsync_test.go b/impl/graphsync_test.go index b57ab9e2..10d19b13 100644 --- a/impl/graphsync_test.go +++ b/impl/graphsync_test.go @@ -13,7 +13,7 @@ import ( "testing" "time" - ipldfree "github.com/ipld/go-ipld-prime/impl/free" + basicnode "github.com/ipld/go-ipld-prime/node/basic" "github.com/stretchr/testify/require" cidlink "github.com/ipld/go-ipld-prime/linking/cid" @@ -381,14 +381,14 @@ func TestGraphsyncRoundTripAlternatePersistenceAndNodes(t *testing.T) { requestor.RegisterOutgoingRequestHook(func(p peer.ID, requestData graphsync.RequestData, hookActions graphsync.OutgoingRequestHookActions) { _, has := requestData.Extension(extensionName) if has { - hookActions.UseNodeBuilderChooser(blockChain.Chooser) + hookActions.UseLinkTargetNodeStyleChooser(blockChain.Chooser) hookActions.UsePersistenceOption("chainstore") } }) responder.RegisterIncomingRequestHook(func(p peer.ID, requestData graphsync.RequestData, hookActions graphsync.IncomingRequestHookActions) { _, has := requestData.Extension(extensionName) if has { - hookActions.UseNodeBuilderChooser(blockChain.Chooser) + hookActions.UseLinkTargetNodeStyleChooser(blockChain.Chooser) hookActions.UsePersistenceOption("chainstore") } }) @@ -557,7 +557,7 @@ func TestUnixFSFetch(t *testing.T) { clink := cidlink.Link{Cid: nd.Cid()} // create a selector for the whole UnixFS dag - ssb := builder.NewSelectorSpecBuilder(ipldfree.NodeBuilder()) + ssb := builder.NewSelectorSpecBuilder(basicnode.Style.Any) allSelector := ssb.ExploreRecursive(ipldselector.RecursionLimitNone(), ssb.ExploreAll(ssb.ExploreRecursiveEdge())).Node() diff --git a/ipldutil/ipldutil.go b/ipldutil/ipldutil.go index 92704eb1..8c6b0538 100644 --- a/ipldutil/ipldutil.go +++ b/ipldutil/ipldutil.go @@ -7,8 +7,8 @@ import ( ipld "github.com/ipld/go-ipld-prime" dagpb "github.com/ipld/go-ipld-prime-proto" - "github.com/ipld/go-ipld-prime/encoding/dagcbor" - free "github.com/ipld/go-ipld-prime/impl/free" + "github.com/ipld/go-ipld-prime/codec/dagcbor" + basicnode "github.com/ipld/go-ipld-prime/node/basic" "github.com/ipld/go-ipld-prime/traversal" ipldtraversal "github.com/ipld/go-ipld-prime/traversal" "github.com/ipld/go-ipld-prime/traversal/selector" @@ -23,28 +23,30 @@ func ErrDoNotFollow() error { } var ( - defaultChooser traversal.NodeBuilderChooser = dagpb.AddDagPBSupportToChooser(func(ipld.Link, ipld.LinkContext) (ipld.NodeBuilder, error) { - return free.NodeBuilder(), nil + defaultChooser traversal.LinkTargetNodeStyleChooser = dagpb.AddDagPBSupportToChooser(func(ipld.Link, ipld.LinkContext) (ipld.NodeStyle, error) { + return basicnode.Style.Any, nil }) ) -func Traverse(ctx context.Context, loader ipld.Loader, chooser traversal.NodeBuilderChooser, root ipld.Link, s selector.Selector, fn traversal.AdvVisitFn) error { +func Traverse(ctx context.Context, loader ipld.Loader, chooser traversal.LinkTargetNodeStyleChooser, root ipld.Link, s selector.Selector, fn traversal.AdvVisitFn) error { if chooser == nil { chooser = defaultChooser } - builder, err := chooser(root, ipld.LinkContext{}) + ns, err := chooser(root, ipld.LinkContext{}) if err != nil { return err } - node, err := root.Load(ctx, ipld.LinkContext{}, builder, loader) + nb := ns.NewBuilder() + err = root.Load(ctx, ipld.LinkContext{}, nb, loader) if err != nil { return err } + node := nb.Build() return traversal.Progress{ Cfg: &traversal.Config{ - Ctx: ctx, - LinkLoader: loader, - LinkNodeBuilderChooser: chooser, + Ctx: ctx, + LinkLoader: loader, + LinkTargetNodeStyleChooser: chooser, }, }.WalkAdv(node, s, fn) } @@ -63,8 +65,11 @@ func EncodeNode(node ipld.Node) ([]byte, error) { } func DecodeNode(encoded []byte) (ipld.Node, error) { - reader := bytes.NewReader(encoded) - return dagcbor.Decoder(free.NodeBuilder(), reader) + nb := basicnode.Style.Any.NewBuilder() + if err := dagcbor.Decoder(nb, bytes.NewReader(encoded)); err != nil { + return nil, err + } + return nb.Build(), nil } func ParseSelector(selector ipld.Node) (selector.Selector, error) { diff --git a/ipldutil/traverser.go b/ipldutil/traverser.go index d995e28d..e5e2fe9d 100644 --- a/ipldutil/traverser.go +++ b/ipldutil/traverser.go @@ -17,7 +17,7 @@ type TraversalBuilder struct { Root ipld.Link Selector ipld.Node Visitor traversal.AdvVisitFn - Chooser traversal.NodeBuilderChooser + Chooser traversal.LinkTargetNodeStyleChooser } // Traverser is an interface for performing a selector traversal that operates iteratively -- @@ -75,7 +75,7 @@ type traverser struct { root ipld.Link selector ipld.Node visitor traversal.AdvVisitFn - chooser traversal.NodeBuilderChooser + chooser traversal.LinkTargetNodeStyleChooser currentLink ipld.Link currentContext ipld.LinkContext isDone bool @@ -129,16 +129,18 @@ func (t *traverser) start() { return response.input, response.err } } - nb, err := t.chooser(t.root, ipld.LinkContext{}) + ns, err := t.chooser(t.root, ipld.LinkContext{}) if err != nil { t.writeDone(err) return } - nd, err := t.root.Load(t.ctx, ipld.LinkContext{}, nb, loader) + nb := ns.NewBuilder() + err = t.root.Load(t.ctx, ipld.LinkContext{}, nb, loader) if err != nil { t.writeDone(err) return } + nd := nb.Build() sel, err := selector.ParseSelector(t.selector) if err != nil { @@ -147,9 +149,9 @@ func (t *traverser) start() { } err = traversal.Progress{ Cfg: &traversal.Config{ - Ctx: t.ctx, - LinkLoader: loader, - LinkNodeBuilderChooser: t.chooser, + Ctx: t.ctx, + LinkLoader: loader, + LinkTargetNodeStyleChooser: t.chooser, }, }.WalkAdv(nd, sel, t.visitor) t.writeDone(err) diff --git a/ipldutil/traverser_test.go b/ipldutil/traverser_test.go index e08b82fe..16c649ca 100644 --- a/ipldutil/traverser_test.go +++ b/ipldutil/traverser_test.go @@ -9,8 +9,8 @@ import ( "github.com/ipfs/go-graphsync" "github.com/ipfs/go-graphsync/testutil" ipld "github.com/ipld/go-ipld-prime" - ipldfree "github.com/ipld/go-ipld-prime/impl/free" cidlink "github.com/ipld/go-ipld-prime/linking/cid" + basicnode "github.com/ipld/go-ipld-prime/node/basic" "github.com/ipld/go-ipld-prime/traversal" "github.com/ipld/go-ipld-prime/traversal/selector" "github.com/ipld/go-ipld-prime/traversal/selector/builder" @@ -22,7 +22,7 @@ func TestTraverser(t *testing.T) { t.Run("traverses correctly, simple struct", func(t *testing.T) { testdata := testutil.NewTestIPLDTree() - ssb := builder.NewSelectorSpecBuilder(ipldfree.NodeBuilder()) + ssb := builder.NewSelectorSpecBuilder(basicnode.Style.Any) sel := ssb.ExploreRecursive(selector.RecursionLimitNone(), ssb.ExploreAll(ssb.ExploreRecursiveEdge())).Node() traverser := TraversalBuilder{ Root: testdata.RootNodeLnk, diff --git a/message/message_test.go b/message/message_test.go index 3cb6d0aa..ece03ea2 100644 --- a/message/message_test.go +++ b/message/message_test.go @@ -7,7 +7,7 @@ import ( blocks "github.com/ipfs/go-block-format" "github.com/ipfs/go-graphsync" - ipldfree "github.com/ipld/go-ipld-prime/impl/free" + basicnode "github.com/ipld/go-ipld-prime/node/basic" "github.com/ipld/go-ipld-prime/traversal/selector/builder" "github.com/stretchr/testify/require" @@ -23,7 +23,7 @@ func TestAppendingRequests(t *testing.T) { Data: testutil.RandomBytes(100), } root := testutil.GenerateCids(1)[0] - ssb := builder.NewSelectorSpecBuilder(ipldfree.NodeBuilder()) + ssb := builder.NewSelectorSpecBuilder(basicnode.Style.Any) selector := ssb.Matcher().Node() id := graphsync.RequestID(rand.Int31()) priority := graphsync.Priority(rand.Int31()) @@ -144,7 +144,7 @@ func contains(strs []string, x string) bool { } func TestRequestCancel(t *testing.T) { - ssb := builder.NewSelectorSpecBuilder(ipldfree.NodeBuilder()) + ssb := builder.NewSelectorSpecBuilder(basicnode.Style.Any) selector := ssb.Matcher().Node() id := graphsync.RequestID(rand.Int31()) priority := graphsync.Priority(rand.Int31()) @@ -217,7 +217,7 @@ func TestRequestUpdate(t *testing.T) { func TestToNetFromNetEquivalency(t *testing.T) { root := testutil.GenerateCids(1)[0] - ssb := builder.NewSelectorSpecBuilder(ipldfree.NodeBuilder()) + ssb := builder.NewSelectorSpecBuilder(basicnode.Style.Any) selector := ssb.Matcher().Node() extensionName := graphsync.ExtensionName("graphsync/awesome") extension := graphsync.ExtensionData{ diff --git a/messagequeue/messagequeue_test.go b/messagequeue/messagequeue_test.go index 7f6408b9..541f8478 100644 --- a/messagequeue/messagequeue_test.go +++ b/messagequeue/messagequeue_test.go @@ -15,7 +15,7 @@ import ( gsmsg "github.com/ipfs/go-graphsync/message" gsnet "github.com/ipfs/go-graphsync/network" - ipldfree "github.com/ipld/go-ipld-prime/impl/free" + basicnode "github.com/ipld/go-ipld-prime/node/basic" "github.com/libp2p/go-libp2p-core/peer" ) @@ -69,7 +69,7 @@ func TestStartupAndShutdown(t *testing.T) { messageQueue.Startup() id := graphsync.RequestID(rand.Int31()) priority := graphsync.Priority(rand.Int31()) - ssb := builder.NewSelectorSpecBuilder(ipldfree.NodeBuilder()) + ssb := builder.NewSelectorSpecBuilder(basicnode.Style.Any) selector := ssb.Matcher().Node() root := testutil.GenerateCids(1)[0] @@ -104,7 +104,7 @@ func TestShutdownDuringMessageSend(t *testing.T) { messageQueue.Startup() id := graphsync.RequestID(rand.Int31()) priority := graphsync.Priority(rand.Int31()) - ssb := builder.NewSelectorSpecBuilder(ipldfree.NodeBuilder()) + ssb := builder.NewSelectorSpecBuilder(basicnode.Style.Any) selector := ssb.Matcher().Node() root := testutil.GenerateCids(1)[0] @@ -198,7 +198,7 @@ func TestDedupingMessages(t *testing.T) { waitGroup.Add(1) id := graphsync.RequestID(rand.Int31()) priority := graphsync.Priority(rand.Int31()) - ssb := builder.NewSelectorSpecBuilder(ipldfree.NodeBuilder()) + ssb := builder.NewSelectorSpecBuilder(basicnode.Style.Any) selector := ssb.Matcher().Node() root := testutil.GenerateCids(1)[0] diff --git a/metadata/metadata.go b/metadata/metadata.go index 27cd5814..6acb80d3 100644 --- a/metadata/metadata.go +++ b/metadata/metadata.go @@ -4,7 +4,7 @@ import ( "github.com/ipfs/go-graphsync/ipldutil" "github.com/ipld/go-ipld-prime" "github.com/ipld/go-ipld-prime/fluent" - ipldfree "github.com/ipld/go-ipld-prime/impl/free" + basicnode "github.com/ipld/go-ipld-prime/node/basic" ) // Item is a single link traversed in a repsonse @@ -24,42 +24,47 @@ func DecodeMetadata(data []byte) (Metadata, error) { if err != nil { return nil, err } - var decodedData interface{} - err = fluent.Recover(func() { - simpleNode := fluent.WrapNode(node) - iterator := simpleNode.ListIterator() - var metadata Metadata - if simpleNode.Length() != -1 { - metadata = make(Metadata, 0, simpleNode.Length()) - } + iterator := node.ListIterator() + var metadata Metadata + if node.Length() != -1 { + metadata = make(Metadata, 0, node.Length()) + } - for !iterator.Done() { - _, item := iterator.Next() - link := item.LookupString("link").AsLink() - blockPresent := item.LookupString("blockPresent").AsBool() - metadata = append(metadata, Item{link, blockPresent}) + for !iterator.Done() { + _, item, err := iterator.Next() + if err != nil { + return nil, err } - decodedData = metadata - }) - if err != nil { - return nil, err + linkNode, err := item.LookupString("link") + if err != nil { + return nil, err + } + link, err := linkNode.AsLink() + if err != nil { + return nil, err + } + blockPresentNode, err := item.LookupString("blockPresent") + if err != nil { + return nil, err + } + blockPresent, err := blockPresentNode.AsBool() + if err != nil { + return nil, err + } + metadata = append(metadata, Item{link, blockPresent}) } - return decodedData.(Metadata), err + return metadata, err } // EncodeMetadata encodes metadata to an IPLD node then serializes to raw bytes func EncodeMetadata(entries Metadata) ([]byte, error) { - var node ipld.Node - err := fluent.Recover(func() { - nb := fluent.WrapNodeBuilder(ipldfree.NodeBuilder()) - node = nb.CreateList(func(lb fluent.ListBuilder, nb fluent.NodeBuilder) { + node, err := fluent.Build(basicnode.Style.List, func(na fluent.NodeAssembler) { + na.CreateList(len(entries), func(na fluent.ListAssembler) { for _, item := range entries { - lb.Append( - nb.CreateMap(func(mb fluent.MapBuilder, knb fluent.NodeBuilder, vnb fluent.NodeBuilder) { - mb.Insert(knb.CreateString("link"), vnb.CreateLink(item.Link)) - mb.Insert(knb.CreateString("blockPresent"), vnb.CreateBool(item.BlockPresent)) - }), - ) + na.AssembleValue().CreateMap(2, func(na fluent.MapAssembler) { + na.AssembleEntry("link").AssignLink(item.Link) + na.AssembleEntry("blockPresent").AssignBool(item.BlockPresent) + }) } }) }) diff --git a/network/libp2p_impl_test.go b/network/libp2p_impl_test.go index 8da58ef6..a775027f 100644 --- a/network/libp2p_impl_test.go +++ b/network/libp2p_impl_test.go @@ -9,7 +9,7 @@ import ( "github.com/ipfs/go-graphsync" gsmsg "github.com/ipfs/go-graphsync/message" "github.com/ipfs/go-graphsync/testutil" - ipldfree "github.com/ipld/go-ipld-prime/impl/free" + basicnode "github.com/ipld/go-ipld-prime/node/basic" "github.com/ipld/go-ipld-prime/traversal/selector/builder" "github.com/libp2p/go-libp2p-core/peer" mocknet "github.com/libp2p/go-libp2p/p2p/net/mock" @@ -69,7 +69,7 @@ func TestMessageSendAndReceive(t *testing.T) { gsnet2.SetDelegate(r) root := testutil.GenerateCids(1)[0] - ssb := builder.NewSelectorSpecBuilder(ipldfree.NodeBuilder()) + ssb := builder.NewSelectorSpecBuilder(basicnode.Style.Any) selector := ssb.Matcher().Node() extensionName := graphsync.ExtensionName("graphsync/awesome") extension := graphsync.ExtensionData{ diff --git a/peermanager/peermessagemanager_test.go b/peermanager/peermessagemanager_test.go index ddf8531e..f1ee79fb 100644 --- a/peermanager/peermessagemanager_test.go +++ b/peermanager/peermessagemanager_test.go @@ -10,7 +10,7 @@ import ( "github.com/ipfs/go-graphsync" gsmsg "github.com/ipfs/go-graphsync/message" "github.com/ipfs/go-graphsync/testutil" - ipldfree "github.com/ipld/go-ipld-prime/impl/free" + basicnode "github.com/ipld/go-ipld-prime/node/basic" "github.com/ipld/go-ipld-prime/traversal/selector/builder" "github.com/libp2p/go-libp2p-core/peer" "github.com/stretchr/testify/require" @@ -60,7 +60,7 @@ func TestSendingMessagesToPeers(t *testing.T) { id := graphsync.RequestID(rand.Int31()) priority := graphsync.Priority(rand.Int31()) root := testutil.GenerateCids(1)[0] - ssb := builder.NewSelectorSpecBuilder(ipldfree.NodeBuilder()) + ssb := builder.NewSelectorSpecBuilder(basicnode.Style.Any) selector := ssb.Matcher().Node() peerManager := NewMessageManager(ctx, peerQueueFactory) diff --git a/requestmanager/hooks/hooks_test.go b/requestmanager/hooks/hooks_test.go index d36d65f7..ce3b957b 100644 --- a/requestmanager/hooks/hooks_test.go +++ b/requestmanager/hooks/hooks_test.go @@ -10,15 +10,15 @@ import ( "github.com/ipfs/go-graphsync/requestmanager/hooks" "github.com/ipfs/go-graphsync/testutil" "github.com/ipld/go-ipld-prime" - ipldfree "github.com/ipld/go-ipld-prime/impl/free" + basicnode "github.com/ipld/go-ipld-prime/node/basic" "github.com/ipld/go-ipld-prime/traversal/selector/builder" peer "github.com/libp2p/go-libp2p-core/peer" "github.com/stretchr/testify/require" ) func TestRequestHookProcessing(t *testing.T) { - fakeChooser := func(ipld.Link, ipld.LinkContext) (ipld.NodeBuilder, error) { - return ipldfree.NodeBuilder(), nil + fakeChooser := func(ipld.Link, ipld.LinkContext) (ipld.NodeStyle, error) { + return basicnode.Style.Any, nil } extensionData := testutil.RandomBytes(100) extensionName := graphsync.ExtensionName("AppleSauce/McGee") @@ -29,7 +29,7 @@ func TestRequestHookProcessing(t *testing.T) { root := testutil.GenerateCids(1)[0] requestID := graphsync.RequestID(rand.Int31()) - ssb := builder.NewSelectorSpecBuilder(ipldfree.NodeBuilder()) + ssb := builder.NewSelectorSpecBuilder(basicnode.Style.Any) request := gsmsg.NewRequest(requestID, root, ssb.Matcher().Node(), graphsync.Priority(0), extension) p := testutil.GeneratePeers(1)[0] testCases := map[string]struct { @@ -46,7 +46,7 @@ func TestRequestHookProcessing(t *testing.T) { configure: func(t *testing.T, hooks *hooks.OutgoingRequestHooks) { hooks.Register(func(p peer.ID, requestData graphsync.RequestData, hookActions graphsync.OutgoingRequestHookActions) { if _, found := requestData.Extension(extensionName); found { - hookActions.UseNodeBuilderChooser(fakeChooser) + hookActions.UseLinkTargetNodeStyleChooser(fakeChooser) } }) }, diff --git a/requestmanager/hooks/requesthooks.go b/requestmanager/hooks/requesthooks.go index e9533f6b..a8329c64 100644 --- a/requestmanager/hooks/requesthooks.go +++ b/requestmanager/hooks/requesthooks.go @@ -47,7 +47,7 @@ func (orh *OutgoingRequestHooks) Register(hook graphsync.OnOutgoingRequestHook) // RequestResult is the outcome of running requesthooks type RequestResult struct { PersistenceOption string - CustomChooser traversal.NodeBuilderChooser + CustomChooser traversal.LinkTargetNodeStyleChooser } // ProcessRequestHooks runs request hooks against an outgoing request @@ -63,7 +63,7 @@ func (orh *OutgoingRequestHooks) ProcessRequestHooks(p peer.ID, request graphsyn type requestHookActions struct { persistenceOption string - nodeBuilderChooser traversal.NodeBuilderChooser + nodeBuilderChooser traversal.LinkTargetNodeStyleChooser } func (rha *requestHookActions) result() RequestResult { @@ -77,6 +77,6 @@ func (rha *requestHookActions) UsePersistenceOption(name string) { rha.persistenceOption = name } -func (rha *requestHookActions) UseNodeBuilderChooser(nodeBuilderChooser traversal.NodeBuilderChooser) { +func (rha *requestHookActions) UseLinkTargetNodeStyleChooser(nodeBuilderChooser traversal.LinkTargetNodeStyleChooser) { rha.nodeBuilderChooser = nodeBuilderChooser } diff --git a/requestmanager/requestmanager.go b/requestmanager/requestmanager.go index 110ca2aa..d7120362 100644 --- a/requestmanager/requestmanager.go +++ b/requestmanager/requestmanager.go @@ -388,7 +388,7 @@ func (rm *RequestManager) executeTraversal( requestID graphsync.RequestID, root ipld.Link, selector selector.Selector, - nodeBuilderChooser traversal.NodeBuilderChooser, + nodeBuilderChooser traversal.LinkTargetNodeStyleChooser, networkErrorChan chan error, ) (chan graphsync.ResponseProgress, chan error) { inProgressChan := make(chan graphsync.ResponseProgress) diff --git a/requestmanager/requestmanager_test.go b/requestmanager/requestmanager_test.go index 053c9e5e..df389a86 100644 --- a/requestmanager/requestmanager_test.go +++ b/requestmanager/requestmanager_test.go @@ -374,29 +374,6 @@ func TestCancelManagerExitsGracefully(t *testing.T) { testutil.VerifyEmptyErrors(requestCtx, t, returnedErrorChan) } -func TestUnencodableSelector(t *testing.T) { - requestRecordChan := make(chan requestRecord, 2) - fph := &fakePeerHandler{requestRecordChan} - ctx := context.Background() - fal := newFakeAsyncLoader() - requestHooks := hooks.NewRequestHooks() - responseHooks := hooks.NewResponseHooks() - requestManager := New(ctx, fal, requestHooks, responseHooks) - requestManager.SetDelegate(fph) - requestManager.Startup() - - requestCtx, cancel := context.WithTimeout(ctx, time.Second) - defer cancel() - peers := testutil.GeneratePeers(1) - - s := testutil.NewUnencodableSelectorSpec() - r := cidlink.Link{Cid: testutil.GenerateCids(1)[0]} - returnedResponseChan, returnedErrorChan := requestManager.SendRequest(requestCtx, peers[0], r, s) - - testutil.VerifySingleTerminalError(requestCtx, t, returnedErrorChan) - testutil.VerifyEmptyResponse(requestCtx, t, returnedResponseChan) -} - func TestFailedRequest(t *testing.T) { requestRecordChan := make(chan requestRecord, 2) fph := &fakePeerHandler{requestRecordChan} @@ -704,7 +681,7 @@ func TestOutgoingRequestHooks(t *testing.T) { hook := func(p peer.ID, r graphsync.RequestData, ha graphsync.OutgoingRequestHookActions) { _, has := r.Extension(extensionName1) if has { - ha.UseNodeBuilderChooser(blockChain.Chooser) + ha.UseLinkTargetNodeStyleChooser(blockChain.Chooser) ha.UsePersistenceOption("chainstore") } } diff --git a/responsemanager/hooks/hooks_test.go b/responsemanager/hooks/hooks_test.go index ecb397d7..1036fb1b 100644 --- a/responsemanager/hooks/hooks_test.go +++ b/responsemanager/hooks/hooks_test.go @@ -11,8 +11,8 @@ import ( "github.com/ipfs/go-graphsync/responsemanager/hooks" "github.com/ipfs/go-graphsync/testutil" "github.com/ipld/go-ipld-prime" - ipldfree "github.com/ipld/go-ipld-prime/impl/free" cidlink "github.com/ipld/go-ipld-prime/linking/cid" + basicnode "github.com/ipld/go-ipld-prime/node/basic" "github.com/ipld/go-ipld-prime/traversal/selector/builder" peer "github.com/libp2p/go-libp2p-core/peer" "github.com/stretchr/testify/require" @@ -28,8 +28,8 @@ func (fpo *fakePersistenceOptions) GetLoader(name string) (ipld.Loader, bool) { } func TestRequestHookProcessing(t *testing.T) { - fakeChooser := func(ipld.Link, ipld.LinkContext) (ipld.NodeBuilder, error) { - return ipldfree.NodeBuilder(), nil + fakeChooser := func(ipld.Link, ipld.LinkContext) (ipld.NodeStyle, error) { + return basicnode.Style.Any, nil } fakeLoader := func(link ipld.Link, lnkCtx ipld.LinkContext) (io.Reader, error) { return nil, nil @@ -53,7 +53,7 @@ func TestRequestHookProcessing(t *testing.T) { root := testutil.GenerateCids(1)[0] requestID := graphsync.RequestID(rand.Int31()) - ssb := builder.NewSelectorSpecBuilder(ipldfree.NodeBuilder()) + ssb := builder.NewSelectorSpecBuilder(basicnode.Style.Any) request := gsmsg.NewRequest(requestID, root, ssb.Matcher().Node(), graphsync.Priority(0), extension) p := testutil.GeneratePeers(1)[0] testCases := map[string]struct { @@ -174,7 +174,7 @@ func TestRequestHookProcessing(t *testing.T) { configure: func(t *testing.T, requestHooks *hooks.IncomingRequestHooks) { requestHooks.Register(func(p peer.ID, requestData graphsync.RequestData, hookActions graphsync.IncomingRequestHookActions) { if _, found := requestData.Extension(extensionName); found { - hookActions.UseNodeBuilderChooser(fakeChooser) + hookActions.UseLinkTargetNodeStyleChooser(fakeChooser) hookActions.SendExtensionData(extensionResponse) } }) @@ -235,7 +235,7 @@ func TestBlockHookProcessing(t *testing.T) { root := testutil.GenerateCids(1)[0] requestID := graphsync.RequestID(rand.Int31()) - ssb := builder.NewSelectorSpecBuilder(ipldfree.NodeBuilder()) + ssb := builder.NewSelectorSpecBuilder(basicnode.Style.Any) request := gsmsg.NewRequest(requestID, root, ssb.Matcher().Node(), graphsync.Priority(0), extension) p := testutil.GeneratePeers(1)[0] blockData := &fakeBlkData{ @@ -321,7 +321,7 @@ func TestUpdateHookProcessing(t *testing.T) { root := testutil.GenerateCids(1)[0] requestID := graphsync.RequestID(rand.Int31()) - ssb := builder.NewSelectorSpecBuilder(ipldfree.NodeBuilder()) + ssb := builder.NewSelectorSpecBuilder(basicnode.Style.Any) request := gsmsg.NewRequest(requestID, root, ssb.Matcher().Node(), graphsync.Priority(0), extension) update := gsmsg.UpdateRequest(requestID, extensionUpdate) p := testutil.GeneratePeers(1)[0] diff --git a/responsemanager/hooks/requesthook.go b/responsemanager/hooks/requesthook.go index 27669b30..2de99cd5 100644 --- a/responsemanager/hooks/requesthook.go +++ b/responsemanager/hooks/requesthook.go @@ -58,7 +58,7 @@ func (irh *IncomingRequestHooks) Register(hook graphsync.OnIncomingRequestHook) type RequestResult struct { IsValidated bool CustomLoader ipld.Loader - CustomChooser traversal.NodeBuilderChooser + CustomChooser traversal.LinkTargetNodeStyleChooser Err error Extensions []graphsync.ExtensionData } @@ -84,7 +84,7 @@ type requestHookActions struct { isValidated bool err error loader ipld.Loader - chooser traversal.NodeBuilderChooser + chooser traversal.LinkTargetNodeStyleChooser extensions []graphsync.ExtensionData } @@ -123,6 +123,6 @@ func (ha *requestHookActions) UsePersistenceOption(name string) { ha.loader = loader } -func (ha *requestHookActions) UseNodeBuilderChooser(chooser traversal.NodeBuilderChooser) { +func (ha *requestHookActions) UseLinkTargetNodeStyleChooser(chooser traversal.LinkTargetNodeStyleChooser) { ha.chooser = chooser } diff --git a/responsemanager/responsemanager_test.go b/responsemanager/responsemanager_test.go index 01482a8a..eba2146f 100644 --- a/responsemanager/responsemanager_test.go +++ b/responsemanager/responsemanager_test.go @@ -17,8 +17,8 @@ import ( "github.com/ipfs/go-graphsync/testutil" "github.com/ipfs/go-peertaskqueue/peertask" ipld "github.com/ipld/go-ipld-prime" - ipldfree "github.com/ipld/go-ipld-prime/impl/free" cidlink "github.com/ipld/go-ipld-prime/linking/cid" + basicnode "github.com/ipld/go-ipld-prime/node/basic" "github.com/libp2p/go-libp2p-core/peer" "github.com/stretchr/testify/require" ) @@ -388,9 +388,9 @@ func TestValidationAndExtensions(t *testing.T) { responseManager.Startup() customChooserCallCount := 0 - customChooser := func(ipld.Link, ipld.LinkContext) (ipld.NodeBuilder, error) { + customChooser := func(ipld.Link, ipld.LinkContext) (ipld.NodeStyle, error) { customChooserCallCount++ - return ipldfree.NodeBuilder(), nil + return basicnode.Style.Any, nil } // add validating hook -- so the request SHOULD succeed @@ -408,7 +408,7 @@ func TestValidationAndExtensions(t *testing.T) { // register hook to use custom chooser _ = td.requestHooks.Register(func(p peer.ID, requestData graphsync.RequestData, hookActions graphsync.IncomingRequestHookActions) { if _, found := requestData.Extension(td.extensionName); found { - hookActions.UseNodeBuilderChooser(customChooser) + hookActions.UseLinkTargetNodeStyleChooser(customChooser) hookActions.SendExtensionData(td.extensionResponse) } }) diff --git a/selectorvalidator/selectorvalidator.go b/selectorvalidator/selectorvalidator.go index cd176096..d25d0614 100644 --- a/selectorvalidator/selectorvalidator.go +++ b/selectorvalidator/selectorvalidator.go @@ -5,7 +5,7 @@ import ( "github.com/ipfs/go-graphsync" ipld "github.com/ipld/go-ipld-prime" - ipldfree "github.com/ipld/go-ipld-prime/impl/free" + basicnode "github.com/ipld/go-ipld-prime/node/basic" "github.com/ipld/go-ipld-prime/traversal" "github.com/ipld/go-ipld-prime/traversal/selector" "github.com/ipld/go-ipld-prime/traversal/selector/builder" @@ -33,7 +33,7 @@ func SelectorValidator(maxAcceptedDepth int) graphsync.OnIncomingRequestHook { // ValidateMaxRecursionDepth examines the given selector node and verifies // recursive selectors are limited to the given fixed depth func ValidateMaxRecursionDepth(node ipld.Node, maxAcceptedDepth int) error { - ssb := builder.NewSelectorSpecBuilder(ipldfree.NodeBuilder()) + ssb := builder.NewSelectorSpecBuilder(basicnode.Style.Map) // this selector is a selector for traversing selectors... // it traverses the various selector types looking for recursion limit fields diff --git a/selectorvalidator/selectorvalidator_test.go b/selectorvalidator/selectorvalidator_test.go index df9301d9..ae41f6e2 100644 --- a/selectorvalidator/selectorvalidator_test.go +++ b/selectorvalidator/selectorvalidator_test.go @@ -4,7 +4,7 @@ import ( "testing" ipld "github.com/ipld/go-ipld-prime" - ipldfree "github.com/ipld/go-ipld-prime/impl/free" + basicnode "github.com/ipld/go-ipld-prime/node/basic" "github.com/stretchr/testify/require" "github.com/ipld/go-ipld-prime/traversal/selector" @@ -12,7 +12,7 @@ import ( ) func TestValidateMaxRecusionDepth(t *testing.T) { - ssb := builder.NewSelectorSpecBuilder(ipldfree.NodeBuilder()) + ssb := builder.NewSelectorSpecBuilder(basicnode.Style.Map) successBase := ssb.ExploreRecursive(selector.RecursionLimitDepth(80), ssb.ExploreRecursiveEdge()) failBase := ssb.ExploreRecursive(selector.RecursionLimitDepth(120), ssb.ExploreRecursiveEdge()) diff --git a/testutil/chaintypes/testchain_gen.go b/testutil/chaintypes/testchain_gen.go deleted file mode 100644 index e074cfe4..00000000 --- a/testutil/chaintypes/testchain_gen.go +++ /dev/null @@ -1,1345 +0,0 @@ -package chaintypes - -import ( - ipld "github.com/ipld/go-ipld-prime" - "github.com/ipld/go-ipld-prime/schema" -) - -// Code generated go-ipld-prime DO NOT EDIT. - -type Bytes struct{ x []byte } - -// TODO generateKindBytes.EmitNativeAccessors -// TODO generateKindBytes.EmitNativeBuilder -type MaybeBytes struct { - Maybe schema.Maybe - Value Bytes -} - -func (m MaybeBytes) Must() Bytes { - if m.Maybe != schema.Maybe_Value { - panic("unbox of a maybe rejected") - } - return m.Value -} - -var _ ipld.Node = Bytes{} -var _ schema.TypedNode = Bytes{} - -func (Bytes) Type() schema.Type { - return nil /*TODO:typelit*/ -} -func (Bytes) ReprKind() ipld.ReprKind { - return ipld.ReprKind_Bytes -} -func (Bytes) LookupString(string) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Bytes", MethodName: "LookupString", AppropriateKind: ipld.ReprKindSet_JustMap, ActualKind: ipld.ReprKind_Bytes} -} -func (Bytes) Lookup(ipld.Node) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Bytes", MethodName: "Lookup", AppropriateKind: ipld.ReprKindSet_JustMap, ActualKind: ipld.ReprKind_Bytes} -} -func (Bytes) LookupIndex(idx int) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Bytes", MethodName: "LookupIndex", AppropriateKind: ipld.ReprKindSet_JustList, ActualKind: ipld.ReprKind_Bytes} -} -func (Bytes) LookupSegment(seg ipld.PathSegment) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Bytes", MethodName: "LookupSegment", AppropriateKind: ipld.ReprKindSet_Recursive, ActualKind: ipld.ReprKind_Bytes} -} -func (Bytes) MapIterator() ipld.MapIterator { - return mapIteratorReject{ipld.ErrWrongKind{TypeName: "Bytes", MethodName: "MapIterator", AppropriateKind: ipld.ReprKindSet_JustMap, ActualKind: ipld.ReprKind_Bytes}} -} -func (Bytes) ListIterator() ipld.ListIterator { - return listIteratorReject{ipld.ErrWrongKind{TypeName: "Bytes", MethodName: "ListIterator", AppropriateKind: ipld.ReprKindSet_JustList, ActualKind: ipld.ReprKind_Bytes}} -} -func (Bytes) Length() int { - return -1 -} -func (Bytes) IsUndefined() bool { - return false -} -func (Bytes) IsNull() bool { - return false -} -func (Bytes) AsBool() (bool, error) { - return false, ipld.ErrWrongKind{TypeName: "Bytes", MethodName: "AsBool", AppropriateKind: ipld.ReprKindSet_JustBool, ActualKind: ipld.ReprKind_Bytes} -} -func (Bytes) AsInt() (int, error) { - return 0, ipld.ErrWrongKind{TypeName: "Bytes", MethodName: "AsInt", AppropriateKind: ipld.ReprKindSet_JustInt, ActualKind: ipld.ReprKind_Bytes} -} -func (Bytes) AsFloat() (float64, error) { - return 0, ipld.ErrWrongKind{TypeName: "Bytes", MethodName: "AsFloat", AppropriateKind: ipld.ReprKindSet_JustFloat, ActualKind: ipld.ReprKind_Bytes} -} -func (Bytes) AsString() (string, error) { - return "", ipld.ErrWrongKind{TypeName: "Bytes", MethodName: "AsString", AppropriateKind: ipld.ReprKindSet_JustString, ActualKind: ipld.ReprKind_Bytes} -} -func (x Bytes) AsBytes() ([]byte, error) { - return x.x, nil -} -func (Bytes) AsLink() (ipld.Link, error) { - return nil, ipld.ErrWrongKind{TypeName: "Bytes", MethodName: "AsLink", AppropriateKind: ipld.ReprKindSet_JustLink, ActualKind: ipld.ReprKind_Bytes} -} -func (Bytes) NodeBuilder() ipld.NodeBuilder { - return _Bytes__NodeBuilder{} -} -type _Bytes__NodeBuilder struct{} -func Bytes__NodeBuilder() ipld.NodeBuilder { - return _Bytes__NodeBuilder{} -} -func (_Bytes__NodeBuilder) CreateMap() (ipld.MapBuilder, error) { - return nil, ipld.ErrWrongKind{TypeName: "Bytes.Builder", MethodName: "CreateMap", AppropriateKind: ipld.ReprKindSet_JustMap, ActualKind: ipld.ReprKind_Bytes} -} -func (_Bytes__NodeBuilder) AmendMap() (ipld.MapBuilder, error) { - return nil, ipld.ErrWrongKind{TypeName: "Bytes.Builder", MethodName: "AmendMap", AppropriateKind: ipld.ReprKindSet_JustMap, ActualKind: ipld.ReprKind_Bytes} -} -func (_Bytes__NodeBuilder) CreateList() (ipld.ListBuilder, error) { - return nil, ipld.ErrWrongKind{TypeName: "Bytes.Builder", MethodName: "CreateList", AppropriateKind: ipld.ReprKindSet_JustList, ActualKind: ipld.ReprKind_Bytes} -} -func (_Bytes__NodeBuilder) AmendList() (ipld.ListBuilder, error) { - return nil, ipld.ErrWrongKind{TypeName: "Bytes.Builder", MethodName: "AmendList", AppropriateKind: ipld.ReprKindSet_JustList, ActualKind: ipld.ReprKind_Bytes} -} -func (_Bytes__NodeBuilder) CreateNull() (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Bytes.Builder", MethodName: "CreateNull", AppropriateKind: ipld.ReprKindSet_JustNull, ActualKind: ipld.ReprKind_Bytes} -} -func (_Bytes__NodeBuilder) CreateBool(bool) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Bytes.Builder", MethodName: "CreateBool", AppropriateKind: ipld.ReprKindSet_JustBool, ActualKind: ipld.ReprKind_Bytes} -} -func (_Bytes__NodeBuilder) CreateInt(int) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Bytes.Builder", MethodName: "CreateInt", AppropriateKind: ipld.ReprKindSet_JustInt, ActualKind: ipld.ReprKind_Bytes} -} -func (_Bytes__NodeBuilder) CreateFloat(float64) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Bytes.Builder", MethodName: "CreateFloat", AppropriateKind: ipld.ReprKindSet_JustFloat, ActualKind: ipld.ReprKind_Bytes} -} -func (_Bytes__NodeBuilder) CreateString(string) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Bytes.Builder", MethodName: "CreateString", AppropriateKind: ipld.ReprKindSet_JustString, ActualKind: ipld.ReprKind_Bytes} -} -func (nb _Bytes__NodeBuilder) CreateBytes(v []byte) (ipld.Node, error) { - return Bytes{v}, nil -} -func (_Bytes__NodeBuilder) CreateLink(ipld.Link) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Bytes.Builder", MethodName: "CreateLink", AppropriateKind: ipld.ReprKindSet_JustLink, ActualKind: ipld.ReprKind_Bytes} -} -func (Bytes) Representation() ipld.Node { - panic("TODO representation") -} -type Link struct{ x ipld.Link } - -// TODO generateKindLink.EmitNativeAccessors -// TODO generateKindLink.EmitNativeBuilder -type MaybeLink struct { - Maybe schema.Maybe - Value Link -} - -func (m MaybeLink) Must() Link { - if m.Maybe != schema.Maybe_Value { - panic("unbox of a maybe rejected") - } - return m.Value -} - -var _ ipld.Node = Link{} -var _ schema.TypedNode = Link{} - -func (Link) Type() schema.Type { - return nil /*TODO:typelit*/ -} -func (Link) ReprKind() ipld.ReprKind { - return ipld.ReprKind_Link -} -func (Link) LookupString(string) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Link", MethodName: "LookupString", AppropriateKind: ipld.ReprKindSet_JustMap, ActualKind: ipld.ReprKind_Link} -} -func (Link) Lookup(ipld.Node) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Link", MethodName: "Lookup", AppropriateKind: ipld.ReprKindSet_JustMap, ActualKind: ipld.ReprKind_Link} -} -func (Link) LookupIndex(idx int) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Link", MethodName: "LookupIndex", AppropriateKind: ipld.ReprKindSet_JustList, ActualKind: ipld.ReprKind_Link} -} -func (Link) LookupSegment(seg ipld.PathSegment) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Link", MethodName: "LookupSegment", AppropriateKind: ipld.ReprKindSet_Recursive, ActualKind: ipld.ReprKind_Link} -} -func (Link) MapIterator() ipld.MapIterator { - return mapIteratorReject{ipld.ErrWrongKind{TypeName: "Link", MethodName: "MapIterator", AppropriateKind: ipld.ReprKindSet_JustMap, ActualKind: ipld.ReprKind_Link}} -} -func (Link) ListIterator() ipld.ListIterator { - return listIteratorReject{ipld.ErrWrongKind{TypeName: "Link", MethodName: "ListIterator", AppropriateKind: ipld.ReprKindSet_JustList, ActualKind: ipld.ReprKind_Link}} -} -func (Link) Length() int { - return -1 -} -func (Link) IsUndefined() bool { - return false -} -func (Link) IsNull() bool { - return false -} -func (Link) AsBool() (bool, error) { - return false, ipld.ErrWrongKind{TypeName: "Link", MethodName: "AsBool", AppropriateKind: ipld.ReprKindSet_JustBool, ActualKind: ipld.ReprKind_Link} -} -func (Link) AsInt() (int, error) { - return 0, ipld.ErrWrongKind{TypeName: "Link", MethodName: "AsInt", AppropriateKind: ipld.ReprKindSet_JustInt, ActualKind: ipld.ReprKind_Link} -} -func (Link) AsFloat() (float64, error) { - return 0, ipld.ErrWrongKind{TypeName: "Link", MethodName: "AsFloat", AppropriateKind: ipld.ReprKindSet_JustFloat, ActualKind: ipld.ReprKind_Link} -} -func (Link) AsString() (string, error) { - return "", ipld.ErrWrongKind{TypeName: "Link", MethodName: "AsString", AppropriateKind: ipld.ReprKindSet_JustString, ActualKind: ipld.ReprKind_Link} -} -func (Link) AsBytes() ([]byte, error) { - return nil, ipld.ErrWrongKind{TypeName: "Link", MethodName: "AsBytes", AppropriateKind: ipld.ReprKindSet_JustBytes, ActualKind: ipld.ReprKind_Link} -} -func (x Link) AsLink() (ipld.Link, error) { - return x.x, nil -} -func (Link) NodeBuilder() ipld.NodeBuilder { - return _Link__NodeBuilder{} -} -type _Link__NodeBuilder struct{} - -func Link__NodeBuilder() ipld.NodeBuilder { - return _Link__NodeBuilder{} -} -func (_Link__NodeBuilder) CreateMap() (ipld.MapBuilder, error) { - return nil, ipld.ErrWrongKind{TypeName: "Link.Builder", MethodName: "CreateMap", AppropriateKind: ipld.ReprKindSet_JustMap, ActualKind: ipld.ReprKind_Link} -} -func (_Link__NodeBuilder) AmendMap() (ipld.MapBuilder, error) { - return nil, ipld.ErrWrongKind{TypeName: "Link.Builder", MethodName: "AmendMap", AppropriateKind: ipld.ReprKindSet_JustMap, ActualKind: ipld.ReprKind_Link} -} -func (_Link__NodeBuilder) CreateList() (ipld.ListBuilder, error) { - return nil, ipld.ErrWrongKind{TypeName: "Link.Builder", MethodName: "CreateList", AppropriateKind: ipld.ReprKindSet_JustList, ActualKind: ipld.ReprKind_Link} -} -func (_Link__NodeBuilder) AmendList() (ipld.ListBuilder, error) { - return nil, ipld.ErrWrongKind{TypeName: "Link.Builder", MethodName: "AmendList", AppropriateKind: ipld.ReprKindSet_JustList, ActualKind: ipld.ReprKind_Link} -} -func (_Link__NodeBuilder) CreateNull() (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Link.Builder", MethodName: "CreateNull", AppropriateKind: ipld.ReprKindSet_JustNull, ActualKind: ipld.ReprKind_Link} -} -func (_Link__NodeBuilder) CreateBool(bool) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Link.Builder", MethodName: "CreateBool", AppropriateKind: ipld.ReprKindSet_JustBool, ActualKind: ipld.ReprKind_Link} -} -func (_Link__NodeBuilder) CreateInt(int) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Link.Builder", MethodName: "CreateInt", AppropriateKind: ipld.ReprKindSet_JustInt, ActualKind: ipld.ReprKind_Link} -} -func (_Link__NodeBuilder) CreateFloat(float64) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Link.Builder", MethodName: "CreateFloat", AppropriateKind: ipld.ReprKindSet_JustFloat, ActualKind: ipld.ReprKind_Link} -} -func (_Link__NodeBuilder) CreateString(string) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Link.Builder", MethodName: "CreateString", AppropriateKind: ipld.ReprKindSet_JustString, ActualKind: ipld.ReprKind_Link} -} -func (_Link__NodeBuilder) CreateBytes([]byte) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Link.Builder", MethodName: "CreateBytes", AppropriateKind: ipld.ReprKindSet_JustBytes, ActualKind: ipld.ReprKind_Link} -} -func (nb _Link__NodeBuilder) CreateLink(v ipld.Link) (ipld.Node, error) { - return Link{v}, nil -} -func (Link) Representation() ipld.Node { - panic("TODO representation") -} -type String struct{ x string } - -func (x String) String() string { - return x.x -} -type String__Content struct { - Value string -} - -func (b String__Content) Build() (String, error) { - x := String{ - b.Value, - } - // FUTURE : want to support customizable validation. - // but 'if v, ok := x.(schema.Validatable); ok {' doesn't fly: need a way to work on concrete types. - return x, nil -} -func (b String__Content) MustBuild() String { - if x, err := b.Build(); err != nil { - panic(err) - } else { - return x - } -} - -type MaybeString struct { - Maybe schema.Maybe - Value String -} - -func (m MaybeString) Must() String { - if m.Maybe != schema.Maybe_Value { - panic("unbox of a maybe rejected") - } - return m.Value -} - -var _ ipld.Node = String{} -var _ schema.TypedNode = String{} - -func (String) Type() schema.Type { - return nil /*TODO:typelit*/ -} -func (String) ReprKind() ipld.ReprKind { - return ipld.ReprKind_String -} -func (String) LookupString(string) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "String", MethodName: "LookupString", AppropriateKind: ipld.ReprKindSet_JustMap, ActualKind: ipld.ReprKind_String} -} -func (String) Lookup(ipld.Node) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "String", MethodName: "Lookup", AppropriateKind: ipld.ReprKindSet_JustMap, ActualKind: ipld.ReprKind_String} -} -func (String) LookupIndex(idx int) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "String", MethodName: "LookupIndex", AppropriateKind: ipld.ReprKindSet_JustList, ActualKind: ipld.ReprKind_String} -} -func (String) LookupSegment(seg ipld.PathSegment) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "String", MethodName: "LookupSegment", AppropriateKind: ipld.ReprKindSet_Recursive, ActualKind: ipld.ReprKind_String} -} -func (String) MapIterator() ipld.MapIterator { - return mapIteratorReject{ipld.ErrWrongKind{TypeName: "String", MethodName: "MapIterator", AppropriateKind: ipld.ReprKindSet_JustMap, ActualKind: ipld.ReprKind_String}} -} -func (String) ListIterator() ipld.ListIterator { - return listIteratorReject{ipld.ErrWrongKind{TypeName: "String", MethodName: "ListIterator", AppropriateKind: ipld.ReprKindSet_JustList, ActualKind: ipld.ReprKind_String}} -} -func (String) Length() int { - return -1 -} -func (String) IsUndefined() bool { - return false -} -func (String) IsNull() bool { - return false -} -func (String) AsBool() (bool, error) { - return false, ipld.ErrWrongKind{TypeName: "String", MethodName: "AsBool", AppropriateKind: ipld.ReprKindSet_JustBool, ActualKind: ipld.ReprKind_String} -} -func (String) AsInt() (int, error) { - return 0, ipld.ErrWrongKind{TypeName: "String", MethodName: "AsInt", AppropriateKind: ipld.ReprKindSet_JustInt, ActualKind: ipld.ReprKind_String} -} -func (String) AsFloat() (float64, error) { - return 0, ipld.ErrWrongKind{TypeName: "String", MethodName: "AsFloat", AppropriateKind: ipld.ReprKindSet_JustFloat, ActualKind: ipld.ReprKind_String} -} -func (x String) AsString() (string, error) { - return x.x, nil -} -func (String) AsBytes() ([]byte, error) { - return nil, ipld.ErrWrongKind{TypeName: "String", MethodName: "AsBytes", AppropriateKind: ipld.ReprKindSet_JustBytes, ActualKind: ipld.ReprKind_String} -} -func (String) AsLink() (ipld.Link, error) { - return nil, ipld.ErrWrongKind{TypeName: "String", MethodName: "AsLink", AppropriateKind: ipld.ReprKindSet_JustLink, ActualKind: ipld.ReprKind_String} -} -func (String) NodeBuilder() ipld.NodeBuilder { - return _String__NodeBuilder{} -} -type _String__NodeBuilder struct{} -func String__NodeBuilder() ipld.NodeBuilder { - return _String__NodeBuilder{} -} -func (_String__NodeBuilder) CreateMap() (ipld.MapBuilder, error) { - return nil, ipld.ErrWrongKind{TypeName: "String.Builder", MethodName: "CreateMap", AppropriateKind: ipld.ReprKindSet_JustMap, ActualKind: ipld.ReprKind_String} -} -func (_String__NodeBuilder) AmendMap() (ipld.MapBuilder, error) { - return nil, ipld.ErrWrongKind{TypeName: "String.Builder", MethodName: "AmendMap", AppropriateKind: ipld.ReprKindSet_JustMap, ActualKind: ipld.ReprKind_String} -} -func (_String__NodeBuilder) CreateList() (ipld.ListBuilder, error) { - return nil, ipld.ErrWrongKind{TypeName: "String.Builder", MethodName: "CreateList", AppropriateKind: ipld.ReprKindSet_JustList, ActualKind: ipld.ReprKind_String} -} -func (_String__NodeBuilder) AmendList() (ipld.ListBuilder, error) { - return nil, ipld.ErrWrongKind{TypeName: "String.Builder", MethodName: "AmendList", AppropriateKind: ipld.ReprKindSet_JustList, ActualKind: ipld.ReprKind_String} -} -func (_String__NodeBuilder) CreateNull() (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "String.Builder", MethodName: "CreateNull", AppropriateKind: ipld.ReprKindSet_JustNull, ActualKind: ipld.ReprKind_String} -} -func (_String__NodeBuilder) CreateBool(bool) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "String.Builder", MethodName: "CreateBool", AppropriateKind: ipld.ReprKindSet_JustBool, ActualKind: ipld.ReprKind_String} -} -func (_String__NodeBuilder) CreateInt(int) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "String.Builder", MethodName: "CreateInt", AppropriateKind: ipld.ReprKindSet_JustInt, ActualKind: ipld.ReprKind_String} -} -func (_String__NodeBuilder) CreateFloat(float64) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "String.Builder", MethodName: "CreateFloat", AppropriateKind: ipld.ReprKindSet_JustFloat, ActualKind: ipld.ReprKind_String} -} -func (nb _String__NodeBuilder) CreateString(v string) (ipld.Node, error) { - return String{v}, nil -} -func (_String__NodeBuilder) CreateBytes([]byte) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "String.Builder", MethodName: "CreateBytes", AppropriateKind: ipld.ReprKindSet_JustBytes, ActualKind: ipld.ReprKind_String} -} -func (_String__NodeBuilder) CreateLink(ipld.Link) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "String.Builder", MethodName: "CreateLink", AppropriateKind: ipld.ReprKindSet_JustLink, ActualKind: ipld.ReprKind_String} -} -func (String) Representation() ipld.Node { - panic("TODO representation") -} -type Parents struct{ - x []Link -} -// TODO generateKindList.EmitNativeAccessors -// TODO generateKindList.EmitNativeBuilder -type MaybeParents struct { - Maybe schema.Maybe - Value Parents -} - -func (m MaybeParents) Must() Parents { - if m.Maybe != schema.Maybe_Value { - panic("unbox of a maybe rejected") - } - return m.Value -} - -var _ ipld.Node = Parents{} -var _ schema.TypedNode = Parents{} - -func (Parents) Type() schema.Type { - return nil /*TODO:typelit*/ -} -func (Parents) ReprKind() ipld.ReprKind { - return ipld.ReprKind_List -} -func (Parents) LookupString(string) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Parents", MethodName: "LookupString", AppropriateKind: ipld.ReprKindSet_JustMap, ActualKind: ipld.ReprKind_List} -} -func (x Parents) Lookup(key ipld.Node) (ipld.Node, error) { - ki, err := key.AsInt() - if err != nil { - return nil, ipld.ErrInvalidKey{"got " + key.ReprKind().String() + ", need Int"} - } - return x.LookupIndex(ki) -} -func (x Parents) LookupIndex(index int) (ipld.Node, error) { - if index >= len(x.x) { - return nil, ipld.ErrNotExists{ipld.PathSegmentOfInt(index)} - } - return x.x[index], nil -} -func (n Parents) LookupSegment(seg ipld.PathSegment) (ipld.Node, error) { - idx, err := seg.Index() - if err != nil { - return nil, err - } - return n.LookupIndex(idx) -} -func (Parents) MapIterator() ipld.MapIterator { - return mapIteratorReject{ipld.ErrWrongKind{TypeName: "Parents", MethodName: "MapIterator", AppropriateKind: ipld.ReprKindSet_JustMap, ActualKind: ipld.ReprKind_List}} -} -func (x Parents) ListIterator() ipld.ListIterator { - return &_Parents__Itr{&x, 0} -} - -type _Parents__Itr struct { - node *Parents - idx int -} - -func (itr *_Parents__Itr) Next() (idx int, value ipld.Node, _ error) { - if itr.idx >= len(itr.node.x) { - return 0, nil, ipld.ErrIteratorOverread{} - } - idx = itr.idx - value = itr.node.x[idx] - itr.idx++ - return -} - -func (itr *_Parents__Itr) Done() bool { - return itr.idx >= len(itr.node.x) -} - -func (x Parents) Length() int { - return len(x.x) -} -func (Parents) IsUndefined() bool { - return false -} -func (Parents) IsNull() bool { - return false -} -func (Parents) AsBool() (bool, error) { - return false, ipld.ErrWrongKind{TypeName: "Parents", MethodName: "AsBool", AppropriateKind: ipld.ReprKindSet_JustBool, ActualKind: ipld.ReprKind_List} -} -func (Parents) AsInt() (int, error) { - return 0, ipld.ErrWrongKind{TypeName: "Parents", MethodName: "AsInt", AppropriateKind: ipld.ReprKindSet_JustInt, ActualKind: ipld.ReprKind_List} -} -func (Parents) AsFloat() (float64, error) { - return 0, ipld.ErrWrongKind{TypeName: "Parents", MethodName: "AsFloat", AppropriateKind: ipld.ReprKindSet_JustFloat, ActualKind: ipld.ReprKind_List} -} -func (Parents) AsString() (string, error) { - return "", ipld.ErrWrongKind{TypeName: "Parents", MethodName: "AsString", AppropriateKind: ipld.ReprKindSet_JustString, ActualKind: ipld.ReprKind_List} -} -func (Parents) AsBytes() ([]byte, error) { - return nil, ipld.ErrWrongKind{TypeName: "Parents", MethodName: "AsBytes", AppropriateKind: ipld.ReprKindSet_JustBytes, ActualKind: ipld.ReprKind_List} -} -func (Parents) AsLink() (ipld.Link, error) { - return nil, ipld.ErrWrongKind{TypeName: "Parents", MethodName: "AsLink", AppropriateKind: ipld.ReprKindSet_JustLink, ActualKind: ipld.ReprKind_List} -} -func (Parents) NodeBuilder() ipld.NodeBuilder { - return _Parents__NodeBuilder{} -} -type _Parents__NodeBuilder struct{} - -func Parents__NodeBuilder() ipld.NodeBuilder { - return _Parents__NodeBuilder{} -} -func (_Parents__NodeBuilder) CreateMap() (ipld.MapBuilder, error) { - return nil, ipld.ErrWrongKind{TypeName: "Parents.Builder", MethodName: "CreateMap", AppropriateKind: ipld.ReprKindSet_JustMap, ActualKind: ipld.ReprKind_List} -} -func (_Parents__NodeBuilder) AmendMap() (ipld.MapBuilder, error) { - return nil, ipld.ErrWrongKind{TypeName: "Parents.Builder", MethodName: "AmendMap", AppropriateKind: ipld.ReprKindSet_JustMap, ActualKind: ipld.ReprKind_List} -} -func (nb _Parents__NodeBuilder) CreateList() (ipld.ListBuilder, error) { - return &_Parents__ListBuilder{v:&Parents{}}, nil -} - -type _Parents__ListBuilder struct{ - v *Parents -} - -func (lb *_Parents__ListBuilder) growList(k int) { - oldLen := len(lb.v.x) - minLen := k + 1 - if minLen > oldLen { - // Grow. - oldCap := cap(lb.v.x) - if minLen > oldCap { - // Out of cap; do whole new backing array allocation. - // Growth maths are per stdlib's reflect.grow. - // First figure out how much growth to do. - newCap := oldCap - if newCap == 0 { - newCap = minLen - } else { - for minLen > newCap { - if minLen < 1024 { - newCap += newCap - } else { - newCap += newCap / 4 - } - } - } - // Now alloc and copy over old. - newArr := make([]Link, minLen, newCap) - copy(newArr, lb.v.x) - lb.v.x = newArr - } else { - // Still have cap, just extend the slice. - lb.v.x = lb.v.x[0:minLen] - } - } -} - -func (lb *_Parents__ListBuilder) validate(v ipld.Node) error { - if v.IsNull() { - panic("type mismatch on struct field assignment: cannot assign null to non-nullable field") // FIXME need an error type for this - } - tv, ok := v.(schema.TypedNode) - if !ok { - panic("need schema.TypedNode for insertion into struct") // FIXME need an error type for this - } - _, ok = v.(Link) - if !ok { - panic("value for type Parents is type Link; cannot assign "+tv.Type().Name()) // FIXME need an error type for this - } - return nil -} - -func (lb *_Parents__ListBuilder) unsafeSet(idx int, v ipld.Node) { - x := v.(Link) - lb.v.x[idx] = x -} - -func (lb *_Parents__ListBuilder) AppendAll(vs []ipld.Node) error { - for _, v := range vs { - err := lb.validate(v) - if err != nil { - return err - } - } - off := len(lb.v.x) - new := off + len(vs) - lb.growList(new-1) - for _, v := range vs { - lb.unsafeSet(off, v) - off++ - } - return nil -} - -func (lb *_Parents__ListBuilder) Append(v ipld.Node) error { - err := lb.validate(v) - if err != nil { - return err - } - off := len(lb.v.x) - lb.growList(off) - lb.unsafeSet(off, v) - return nil -} -func (lb *_Parents__ListBuilder) Set(idx int, v ipld.Node) error { - err := lb.validate(v) - if err != nil { - return err - } - lb.growList(idx) - lb.unsafeSet(idx, v) - return nil -} - -func (lb *_Parents__ListBuilder) Build() (ipld.Node, error) { - v := *lb.v - lb = nil - return v, nil -} - -func (lb *_Parents__ListBuilder) BuilderForValue(_ int) ipld.NodeBuilder { - return Link__NodeBuilder() -} - -func (nb _Parents__NodeBuilder) AmendList() (ipld.ListBuilder, error) { - panic("TODO later") -} -func (_Parents__NodeBuilder) CreateNull() (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Parents.Builder", MethodName: "CreateNull", AppropriateKind: ipld.ReprKindSet_JustNull, ActualKind: ipld.ReprKind_List} -} -func (_Parents__NodeBuilder) CreateBool(bool) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Parents.Builder", MethodName: "CreateBool", AppropriateKind: ipld.ReprKindSet_JustBool, ActualKind: ipld.ReprKind_List} -} -func (_Parents__NodeBuilder) CreateInt(int) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Parents.Builder", MethodName: "CreateInt", AppropriateKind: ipld.ReprKindSet_JustInt, ActualKind: ipld.ReprKind_List} -} -func (_Parents__NodeBuilder) CreateFloat(float64) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Parents.Builder", MethodName: "CreateFloat", AppropriateKind: ipld.ReprKindSet_JustFloat, ActualKind: ipld.ReprKind_List} -} -func (_Parents__NodeBuilder) CreateString(string) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Parents.Builder", MethodName: "CreateString", AppropriateKind: ipld.ReprKindSet_JustString, ActualKind: ipld.ReprKind_List} -} -func (_Parents__NodeBuilder) CreateBytes([]byte) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Parents.Builder", MethodName: "CreateBytes", AppropriateKind: ipld.ReprKindSet_JustBytes, ActualKind: ipld.ReprKind_List} -} -func (_Parents__NodeBuilder) CreateLink(ipld.Link) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Parents.Builder", MethodName: "CreateLink", AppropriateKind: ipld.ReprKindSet_JustLink, ActualKind: ipld.ReprKind_List} -} -func (n Parents) Representation() ipld.Node { - panic("TODO representation") -} -type Messages struct{ - x []Bytes -} -// TODO generateKindList.EmitNativeAccessors -// TODO generateKindList.EmitNativeBuilder -type MaybeMessages struct { - Maybe schema.Maybe - Value Messages -} - -func (m MaybeMessages) Must() Messages { - if m.Maybe != schema.Maybe_Value { - panic("unbox of a maybe rejected") - } - return m.Value -} - -var _ ipld.Node = Messages{} -var _ schema.TypedNode = Messages{} - -func (Messages) Type() schema.Type { - return nil /*TODO:typelit*/ -} -func (Messages) ReprKind() ipld.ReprKind { - return ipld.ReprKind_List -} -func (Messages) LookupString(string) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Messages", MethodName: "LookupString", AppropriateKind: ipld.ReprKindSet_JustMap, ActualKind: ipld.ReprKind_List} -} -func (x Messages) Lookup(key ipld.Node) (ipld.Node, error) { - ki, err := key.AsInt() - if err != nil { - return nil, ipld.ErrInvalidKey{"got " + key.ReprKind().String() + ", need Int"} - } - return x.LookupIndex(ki) -} -func (x Messages) LookupIndex(index int) (ipld.Node, error) { - if index >= len(x.x) { - return nil, ipld.ErrNotExists{ipld.PathSegmentOfInt(index)} - } - return x.x[index], nil -} -func (n Messages) LookupSegment(seg ipld.PathSegment) (ipld.Node, error) { - idx, err := seg.Index() - if err != nil { - return nil, err - } - return n.LookupIndex(idx) -} -func (Messages) MapIterator() ipld.MapIterator { - return mapIteratorReject{ipld.ErrWrongKind{TypeName: "Messages", MethodName: "MapIterator", AppropriateKind: ipld.ReprKindSet_JustMap, ActualKind: ipld.ReprKind_List}} -} -func (x Messages) ListIterator() ipld.ListIterator { - return &_Messages__Itr{&x, 0} -} - -type _Messages__Itr struct { - node *Messages - idx int -} - -func (itr *_Messages__Itr) Next() (idx int, value ipld.Node, _ error) { - if itr.idx >= len(itr.node.x) { - return 0, nil, ipld.ErrIteratorOverread{} - } - idx = itr.idx - value = itr.node.x[idx] - itr.idx++ - return -} - -func (itr *_Messages__Itr) Done() bool { - return itr.idx >= len(itr.node.x) -} - -func (x Messages) Length() int { - return len(x.x) -} -func (Messages) IsUndefined() bool { - return false -} -func (Messages) IsNull() bool { - return false -} -func (Messages) AsBool() (bool, error) { - return false, ipld.ErrWrongKind{TypeName: "Messages", MethodName: "AsBool", AppropriateKind: ipld.ReprKindSet_JustBool, ActualKind: ipld.ReprKind_List} -} -func (Messages) AsInt() (int, error) { - return 0, ipld.ErrWrongKind{TypeName: "Messages", MethodName: "AsInt", AppropriateKind: ipld.ReprKindSet_JustInt, ActualKind: ipld.ReprKind_List} -} -func (Messages) AsFloat() (float64, error) { - return 0, ipld.ErrWrongKind{TypeName: "Messages", MethodName: "AsFloat", AppropriateKind: ipld.ReprKindSet_JustFloat, ActualKind: ipld.ReprKind_List} -} -func (Messages) AsString() (string, error) { - return "", ipld.ErrWrongKind{TypeName: "Messages", MethodName: "AsString", AppropriateKind: ipld.ReprKindSet_JustString, ActualKind: ipld.ReprKind_List} -} -func (Messages) AsBytes() ([]byte, error) { - return nil, ipld.ErrWrongKind{TypeName: "Messages", MethodName: "AsBytes", AppropriateKind: ipld.ReprKindSet_JustBytes, ActualKind: ipld.ReprKind_List} -} -func (Messages) AsLink() (ipld.Link, error) { - return nil, ipld.ErrWrongKind{TypeName: "Messages", MethodName: "AsLink", AppropriateKind: ipld.ReprKindSet_JustLink, ActualKind: ipld.ReprKind_List} -} -func (Messages) NodeBuilder() ipld.NodeBuilder { - return _Messages__NodeBuilder{} -} -type _Messages__NodeBuilder struct{} - -func Messages__NodeBuilder() ipld.NodeBuilder { - return _Messages__NodeBuilder{} -} -func (_Messages__NodeBuilder) CreateMap() (ipld.MapBuilder, error) { - return nil, ipld.ErrWrongKind{TypeName: "Messages.Builder", MethodName: "CreateMap", AppropriateKind: ipld.ReprKindSet_JustMap, ActualKind: ipld.ReprKind_List} -} -func (_Messages__NodeBuilder) AmendMap() (ipld.MapBuilder, error) { - return nil, ipld.ErrWrongKind{TypeName: "Messages.Builder", MethodName: "AmendMap", AppropriateKind: ipld.ReprKindSet_JustMap, ActualKind: ipld.ReprKind_List} -} -func (nb _Messages__NodeBuilder) CreateList() (ipld.ListBuilder, error) { - return &_Messages__ListBuilder{v:&Messages{}}, nil -} - -type _Messages__ListBuilder struct{ - v *Messages -} - -func (lb *_Messages__ListBuilder) growList(k int) { - oldLen := len(lb.v.x) - minLen := k + 1 - if minLen > oldLen { - // Grow. - oldCap := cap(lb.v.x) - if minLen > oldCap { - // Out of cap; do whole new backing array allocation. - // Growth maths are per stdlib's reflect.grow. - // First figure out how much growth to do. - newCap := oldCap - if newCap == 0 { - newCap = minLen - } else { - for minLen > newCap { - if minLen < 1024 { - newCap += newCap - } else { - newCap += newCap / 4 - } - } - } - // Now alloc and copy over old. - newArr := make([]Bytes, minLen, newCap) - copy(newArr, lb.v.x) - lb.v.x = newArr - } else { - // Still have cap, just extend the slice. - lb.v.x = lb.v.x[0:minLen] - } - } -} - -func (lb *_Messages__ListBuilder) validate(v ipld.Node) error { - if v.IsNull() { - panic("type mismatch on struct field assignment: cannot assign null to non-nullable field") // FIXME need an error type for this - } - tv, ok := v.(schema.TypedNode) - if !ok { - panic("need schema.TypedNode for insertion into struct") // FIXME need an error type for this - } - _, ok = v.(Bytes) - if !ok { - panic("value for type Messages is type Bytes; cannot assign "+tv.Type().Name()) // FIXME need an error type for this - } - return nil -} - -func (lb *_Messages__ListBuilder) unsafeSet(idx int, v ipld.Node) { - x := v.(Bytes) - lb.v.x[idx] = x -} - -func (lb *_Messages__ListBuilder) AppendAll(vs []ipld.Node) error { - for _, v := range vs { - err := lb.validate(v) - if err != nil { - return err - } - } - off := len(lb.v.x) - new := off + len(vs) - lb.growList(new-1) - for _, v := range vs { - lb.unsafeSet(off, v) - off++ - } - return nil -} - -func (lb *_Messages__ListBuilder) Append(v ipld.Node) error { - err := lb.validate(v) - if err != nil { - return err - } - off := len(lb.v.x) - lb.growList(off) - lb.unsafeSet(off, v) - return nil -} -func (lb *_Messages__ListBuilder) Set(idx int, v ipld.Node) error { - err := lb.validate(v) - if err != nil { - return err - } - lb.growList(idx) - lb.unsafeSet(idx, v) - return nil -} - -func (lb *_Messages__ListBuilder) Build() (ipld.Node, error) { - v := *lb.v - lb = nil - return v, nil -} - -func (lb *_Messages__ListBuilder) BuilderForValue(_ int) ipld.NodeBuilder { - return Bytes__NodeBuilder() -} - -func (nb _Messages__NodeBuilder) AmendList() (ipld.ListBuilder, error) { - panic("TODO later") -} -func (_Messages__NodeBuilder) CreateNull() (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Messages.Builder", MethodName: "CreateNull", AppropriateKind: ipld.ReprKindSet_JustNull, ActualKind: ipld.ReprKind_List} -} -func (_Messages__NodeBuilder) CreateBool(bool) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Messages.Builder", MethodName: "CreateBool", AppropriateKind: ipld.ReprKindSet_JustBool, ActualKind: ipld.ReprKind_List} -} -func (_Messages__NodeBuilder) CreateInt(int) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Messages.Builder", MethodName: "CreateInt", AppropriateKind: ipld.ReprKindSet_JustInt, ActualKind: ipld.ReprKind_List} -} -func (_Messages__NodeBuilder) CreateFloat(float64) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Messages.Builder", MethodName: "CreateFloat", AppropriateKind: ipld.ReprKindSet_JustFloat, ActualKind: ipld.ReprKind_List} -} -func (_Messages__NodeBuilder) CreateString(string) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Messages.Builder", MethodName: "CreateString", AppropriateKind: ipld.ReprKindSet_JustString, ActualKind: ipld.ReprKind_List} -} -func (_Messages__NodeBuilder) CreateBytes([]byte) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Messages.Builder", MethodName: "CreateBytes", AppropriateKind: ipld.ReprKindSet_JustBytes, ActualKind: ipld.ReprKind_List} -} -func (_Messages__NodeBuilder) CreateLink(ipld.Link) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Messages.Builder", MethodName: "CreateLink", AppropriateKind: ipld.ReprKindSet_JustLink, ActualKind: ipld.ReprKind_List} -} -func (n Messages) Representation() ipld.Node { - panic("TODO representation") -} -type Block struct{ - d Block__Content -} - -func (x Block) FieldParents()Parents { - return x.d.Parents -} -func (x Block) FieldMessages()Messages { - return x.d.Messages -} - - -type Block__Content struct { - Parents Parents - Messages Messages -} - -func (b Block__Content) Build() (Block, error) { - x := Block{b} - // FUTURE : want to support customizable validation. - // but 'if v, ok := x.(schema.Validatable); ok {' doesn't fly: need a way to work on concrete types. - return x, nil -} -func (b Block__Content) MustBuild() Block { - if x, err := b.Build(); err != nil { - panic(err) - } else { - return x - } -} - -type MaybeBlock struct { - Maybe schema.Maybe - Value Block -} - -func (m MaybeBlock) Must() Block { - if m.Maybe != schema.Maybe_Value { - panic("unbox of a maybe rejected") - } - return m.Value -} - -var _ ipld.Node = Block{} -var _ schema.TypedNode = Block{} - -func (Block) Type() schema.Type { - return nil /*TODO:typelit*/ -} -func (Block) ReprKind() ipld.ReprKind { - return ipld.ReprKind_Map -} -func (x Block) LookupString(key string) (ipld.Node, error) { - switch key { - case "Parents": - return x.d.Parents, nil - case "Messages": - return x.d.Messages, nil - default: - return nil, schema.ErrNoSuchField{Type: nil /*TODO*/, FieldName: key} - } -} -func (x Block) Lookup(key ipld.Node) (ipld.Node, error) { - ks, err := key.AsString() - if err != nil { - return nil, ipld.ErrInvalidKey{"got " + key.ReprKind().String() + ", need string"} - } - return x.LookupString(ks) -} -func (Block) LookupIndex(idx int) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Block", MethodName: "LookupIndex", AppropriateKind: ipld.ReprKindSet_JustList, ActualKind: ipld.ReprKind_Map} -} -func (n Block) LookupSegment(seg ipld.PathSegment) (ipld.Node, error) { - return n.LookupString(seg.String()) -} -func (x Block) MapIterator() ipld.MapIterator { - return &_Block__Itr{&x, 0} -} - -type _Block__Itr struct { - node *Block - idx int -} - -func (itr *_Block__Itr) Next() (k ipld.Node, v ipld.Node, _ error) { - if itr.idx >= 2 { - return nil, nil, ipld.ErrIteratorOverread{} - } - switch itr.idx { - case 0: - k = String{"Parents"} - v = itr.node.d.Parents - case 1: - k = String{"Messages"} - v = itr.node.d.Messages - default: - panic("unreachable") - } - itr.idx++ - return -} -func (itr *_Block__Itr) Done() bool { - return itr.idx >= 2 -} - -func (Block) ListIterator() ipld.ListIterator { - return listIteratorReject{ipld.ErrWrongKind{TypeName: "Block", MethodName: "ListIterator", AppropriateKind: ipld.ReprKindSet_JustList, ActualKind: ipld.ReprKind_Map}} -} -func (Block) Length() int { - return 2 -} -func (Block) IsUndefined() bool { - return false -} -func (Block) IsNull() bool { - return false -} -func (Block) AsBool() (bool, error) { - return false, ipld.ErrWrongKind{TypeName: "Block", MethodName: "AsBool", AppropriateKind: ipld.ReprKindSet_JustBool, ActualKind: ipld.ReprKind_Map} -} -func (Block) AsInt() (int, error) { - return 0, ipld.ErrWrongKind{TypeName: "Block", MethodName: "AsInt", AppropriateKind: ipld.ReprKindSet_JustInt, ActualKind: ipld.ReprKind_Map} -} -func (Block) AsFloat() (float64, error) { - return 0, ipld.ErrWrongKind{TypeName: "Block", MethodName: "AsFloat", AppropriateKind: ipld.ReprKindSet_JustFloat, ActualKind: ipld.ReprKind_Map} -} -func (Block) AsString() (string, error) { - return "", ipld.ErrWrongKind{TypeName: "Block", MethodName: "AsString", AppropriateKind: ipld.ReprKindSet_JustString, ActualKind: ipld.ReprKind_Map} -} -func (Block) AsBytes() ([]byte, error) { - return nil, ipld.ErrWrongKind{TypeName: "Block", MethodName: "AsBytes", AppropriateKind: ipld.ReprKindSet_JustBytes, ActualKind: ipld.ReprKind_Map} -} -func (Block) AsLink() (ipld.Link, error) { - return nil, ipld.ErrWrongKind{TypeName: "Block", MethodName: "AsLink", AppropriateKind: ipld.ReprKindSet_JustLink, ActualKind: ipld.ReprKind_Map} -} -func (Block) NodeBuilder() ipld.NodeBuilder { - return _Block__NodeBuilder{} -} -type _Block__NodeBuilder struct{} - -func Block__NodeBuilder() ipld.NodeBuilder { - return _Block__NodeBuilder{} -} -func (nb _Block__NodeBuilder) CreateMap() (ipld.MapBuilder, error) { - mb := &_Block__MapBuilder{v:&Block{}} - return mb, nil -} - -type _Block__MapBuilder struct{ - v *Block - Parents__isset bool - Messages__isset bool -} - -func (mb *_Block__MapBuilder) Insert(k, v ipld.Node) error { - ks, err := k.AsString() - if err != nil { - return ipld.ErrInvalidKey{"not a string: " + err.Error()} - } - switch ks { - case "Parents": - if v.IsNull() { - panic("type mismatch on struct field assignment: cannot assign null to non-nullable field") // FIXME need an error type for this - } - tv, ok := v.(schema.TypedNode) - if !ok { - panic("need schema.TypedNode for insertion into struct") // FIXME need an error type for this - } - x, ok := v.(Parents) - if !ok { - panic("field 'Parents' in type Block is type Parents; cannot assign "+tv.Type().Name()) // FIXME need an error type for this - } - mb.v.d.Parents = x - mb.Parents__isset = true - case "Messages": - if v.IsNull() { - panic("type mismatch on struct field assignment: cannot assign null to non-nullable field") // FIXME need an error type for this - } - tv, ok := v.(schema.TypedNode) - if !ok { - panic("need schema.TypedNode for insertion into struct") // FIXME need an error type for this - } - x, ok := v.(Messages) - if !ok { - panic("field 'Messages' in type Block is type Messages; cannot assign "+tv.Type().Name()) // FIXME need an error type for this - } - mb.v.d.Messages = x - mb.Messages__isset = true - default: - return schema.ErrNoSuchField{Type: nil /*TODO:typelit*/, FieldName: ks} - } - return nil -} -func (mb *_Block__MapBuilder) Delete(k ipld.Node) error { - panic("TODO later") -} -func (mb *_Block__MapBuilder) Build() (ipld.Node, error) { - if !mb.Parents__isset { - panic("missing required field 'Parents' in building struct Block") // FIXME need an error type for this - } - if !mb.Messages__isset { - panic("missing required field 'Messages' in building struct Block") // FIXME need an error type for this - } - v := *mb.v - mb = nil - return v, nil -} -func (mb *_Block__MapBuilder) BuilderForKeys() ipld.NodeBuilder { - return _String__NodeBuilder{} -} -func (mb *_Block__MapBuilder) BuilderForValue(ks string) ipld.NodeBuilder { - switch ks { - case "Parents": - return Parents__NodeBuilder() - case "Messages": - return Messages__NodeBuilder() - default: - panic(schema.ErrNoSuchField{Type: nil /*TODO:typelit*/, FieldName: ks}) - } - return nil -} - -func (nb _Block__NodeBuilder) AmendMap() (ipld.MapBuilder, error) { - panic("TODO later") -} -func (_Block__NodeBuilder) CreateList() (ipld.ListBuilder, error) { - return nil, ipld.ErrWrongKind{TypeName: "Block.Builder", MethodName: "CreateList", AppropriateKind: ipld.ReprKindSet_JustList, ActualKind: ipld.ReprKind_Map} -} -func (_Block__NodeBuilder) AmendList() (ipld.ListBuilder, error) { - return nil, ipld.ErrWrongKind{TypeName: "Block.Builder", MethodName: "AmendList", AppropriateKind: ipld.ReprKindSet_JustList, ActualKind: ipld.ReprKind_Map} -} -func (_Block__NodeBuilder) CreateNull() (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Block.Builder", MethodName: "CreateNull", AppropriateKind: ipld.ReprKindSet_JustNull, ActualKind: ipld.ReprKind_Map} -} -func (_Block__NodeBuilder) CreateBool(bool) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Block.Builder", MethodName: "CreateBool", AppropriateKind: ipld.ReprKindSet_JustBool, ActualKind: ipld.ReprKind_Map} -} -func (_Block__NodeBuilder) CreateInt(int) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Block.Builder", MethodName: "CreateInt", AppropriateKind: ipld.ReprKindSet_JustInt, ActualKind: ipld.ReprKind_Map} -} -func (_Block__NodeBuilder) CreateFloat(float64) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Block.Builder", MethodName: "CreateFloat", AppropriateKind: ipld.ReprKindSet_JustFloat, ActualKind: ipld.ReprKind_Map} -} -func (_Block__NodeBuilder) CreateString(string) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Block.Builder", MethodName: "CreateString", AppropriateKind: ipld.ReprKindSet_JustString, ActualKind: ipld.ReprKind_Map} -} -func (_Block__NodeBuilder) CreateBytes([]byte) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Block.Builder", MethodName: "CreateBytes", AppropriateKind: ipld.ReprKindSet_JustBytes, ActualKind: ipld.ReprKind_Map} -} -func (_Block__NodeBuilder) CreateLink(ipld.Link) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Block.Builder", MethodName: "CreateLink", AppropriateKind: ipld.ReprKindSet_JustLink, ActualKind: ipld.ReprKind_Map} -} -func (n Block) Representation() ipld.Node { - return _Block__Repr{&n} -} -var _ ipld.Node = _Block__Repr{} - -type _Block__Repr struct{ - n *Block -} - -func (_Block__Repr) ReprKind() ipld.ReprKind { - return ipld.ReprKind_Map -} -func (rn _Block__Repr) LookupString(key string) (ipld.Node, error) { - switch key { - case "Parents": - return rn.n.d.Parents, nil - case "Messages": - return rn.n.d.Messages, nil - default: - return nil, schema.ErrNoSuchField{Type: nil /*TODO*/, FieldName: key} - } -} -func (rn _Block__Repr) Lookup(key ipld.Node) (ipld.Node, error) { - ks, err := key.AsString() - if err != nil { - return nil, ipld.ErrInvalidKey{"got " + key.ReprKind().String() + ", need string"} - } - return rn.LookupString(ks) -} -func (_Block__Repr) LookupIndex(idx int) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Block.Representation", MethodName: "LookupIndex", AppropriateKind: ipld.ReprKindSet_JustList, ActualKind: ipld.ReprKind_Map} -} -func (n _Block__Repr) LookupSegment(seg ipld.PathSegment) (ipld.Node, error) { - return n.LookupString(seg.String()) -} -func (rn _Block__Repr) MapIterator() ipld.MapIterator { - return &_Block__ReprItr{rn.n, 0} -} - -type _Block__ReprItr struct { - node *Block - idx int -} - -func (itr *_Block__ReprItr) Next() (k ipld.Node, v ipld.Node, _ error) { - if itr.idx >= 2 { - return nil, nil, ipld.ErrIteratorOverread{} - } - for { - switch itr.idx { - case 0: - k = String{"Parents"} - v = itr.node.d.Parents - case 1: - k = String{"Messages"} - v = itr.node.d.Messages - default: - panic("unreachable") - } - } - itr.idx++ - return -} -func (itr *_Block__ReprItr) Done() bool { - return itr.idx >= 2 -} - -func (_Block__Repr) ListIterator() ipld.ListIterator { - return listIteratorReject{ipld.ErrWrongKind{TypeName: "Block.Representation", MethodName: "ListIterator", AppropriateKind: ipld.ReprKindSet_JustList, ActualKind: ipld.ReprKind_Map}} -} -func (rn _Block__Repr) Length() int { - l := 2 - return l -} -func (_Block__Repr) IsUndefined() bool { - return false -} -func (_Block__Repr) IsNull() bool { - return false -} -func (_Block__Repr) AsBool() (bool, error) { - return false, ipld.ErrWrongKind{TypeName: "Block.Representation", MethodName: "AsBool", AppropriateKind: ipld.ReprKindSet_JustBool, ActualKind: ipld.ReprKind_Map} -} -func (_Block__Repr) AsInt() (int, error) { - return 0, ipld.ErrWrongKind{TypeName: "Block.Representation", MethodName: "AsInt", AppropriateKind: ipld.ReprKindSet_JustInt, ActualKind: ipld.ReprKind_Map} -} -func (_Block__Repr) AsFloat() (float64, error) { - return 0, ipld.ErrWrongKind{TypeName: "Block.Representation", MethodName: "AsFloat", AppropriateKind: ipld.ReprKindSet_JustFloat, ActualKind: ipld.ReprKind_Map} -} -func (_Block__Repr) AsString() (string, error) { - return "", ipld.ErrWrongKind{TypeName: "Block.Representation", MethodName: "AsString", AppropriateKind: ipld.ReprKindSet_JustString, ActualKind: ipld.ReprKind_Map} -} -func (_Block__Repr) AsBytes() ([]byte, error) { - return nil, ipld.ErrWrongKind{TypeName: "Block.Representation", MethodName: "AsBytes", AppropriateKind: ipld.ReprKindSet_JustBytes, ActualKind: ipld.ReprKind_Map} -} -func (_Block__Repr) AsLink() (ipld.Link, error) { - return nil, ipld.ErrWrongKind{TypeName: "Block.Representation", MethodName: "AsLink", AppropriateKind: ipld.ReprKindSet_JustLink, ActualKind: ipld.ReprKind_Map} -} -func (_Block__Repr) NodeBuilder() ipld.NodeBuilder { - return _Block__ReprBuilder{} -} -type _Block__ReprBuilder struct{} - -func Block__ReprBuilder() ipld.NodeBuilder { - return _Block__ReprBuilder{} -} -func (nb _Block__ReprBuilder) CreateMap() (ipld.MapBuilder, error) { - mb := &_Block__ReprMapBuilder{v:&Block{}} - return mb, nil -} - -type _Block__ReprMapBuilder struct{ - v *Block - Parents__isset bool - Messages__isset bool -} - -func (mb *_Block__ReprMapBuilder) Insert(k, v ipld.Node) error { - ks, err := k.AsString() - if err != nil { - return ipld.ErrInvalidKey{"not a string: " + err.Error()} - } - switch ks { - case "Parents": - if mb.Parents__isset { - panic("repeated assignment to field") // FIXME need an error type for this - } - if v.IsNull() { - panic("type mismatch on struct field assignment: cannot assign null to non-nullable field") // FIXME need an error type for this - } - tv, ok := v.(schema.TypedNode) - if !ok { - panic("need schema.TypedNode for insertion into struct") // FIXME need an error type for this - } - x, ok := v.(Parents) - if !ok { - panic("field 'Parents' (key: 'Parents') in type Block is type Parents; cannot assign "+tv.Type().Name()) // FIXME need an error type for this - } - mb.v.d.Parents = x - mb.Parents__isset = true - case "Messages": - if mb.Messages__isset { - panic("repeated assignment to field") // FIXME need an error type for this - } - if v.IsNull() { - panic("type mismatch on struct field assignment: cannot assign null to non-nullable field") // FIXME need an error type for this - } - tv, ok := v.(schema.TypedNode) - if !ok { - panic("need schema.TypedNode for insertion into struct") // FIXME need an error type for this - } - x, ok := v.(Messages) - if !ok { - panic("field 'Messages' (key: 'Messages') in type Block is type Messages; cannot assign "+tv.Type().Name()) // FIXME need an error type for this - } - mb.v.d.Messages = x - mb.Messages__isset = true - default: - return schema.ErrNoSuchField{Type: nil /*TODO:typelit*/, FieldName: ks} - } - return nil -} -func (mb *_Block__ReprMapBuilder) Delete(k ipld.Node) error { - panic("TODO later") -} -func (mb *_Block__ReprMapBuilder) Build() (ipld.Node, error) { - if !mb.Parents__isset { - panic("missing required field 'Parents' (key: 'Parents') in building struct Block") // FIXME need an error type for this - } - if !mb.Messages__isset { - panic("missing required field 'Messages' (key: 'Messages') in building struct Block") // FIXME need an error type for this - } - v := mb.v - mb = nil - return v, nil -} -func (mb *_Block__ReprMapBuilder) BuilderForKeys() ipld.NodeBuilder { - return _String__NodeBuilder{} -} -func (mb *_Block__ReprMapBuilder) BuilderForValue(ks string) ipld.NodeBuilder { - switch ks { - case "Parents": - return Parents__NodeBuilder() - case "Messages": - return Messages__NodeBuilder() - default: - panic(schema.ErrNoSuchField{Type: nil /*TODO:typelit*/, FieldName: ks}) - } - return nil -} - -func (nb _Block__ReprBuilder) AmendMap() (ipld.MapBuilder, error) { - panic("TODO later") -} -func (_Block__ReprBuilder) CreateList() (ipld.ListBuilder, error) { - return nil, ipld.ErrWrongKind{TypeName: "Block.Representation.Builder", MethodName: "CreateList", AppropriateKind: ipld.ReprKindSet_JustList, ActualKind: ipld.ReprKind_Map} -} -func (_Block__ReprBuilder) AmendList() (ipld.ListBuilder, error) { - return nil, ipld.ErrWrongKind{TypeName: "Block.Representation.Builder", MethodName: "AmendList", AppropriateKind: ipld.ReprKindSet_JustList, ActualKind: ipld.ReprKind_Map} -} -func (_Block__ReprBuilder) CreateNull() (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Block.Representation.Builder", MethodName: "CreateNull", AppropriateKind: ipld.ReprKindSet_JustNull, ActualKind: ipld.ReprKind_Map} -} -func (_Block__ReprBuilder) CreateBool(bool) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Block.Representation.Builder", MethodName: "CreateBool", AppropriateKind: ipld.ReprKindSet_JustBool, ActualKind: ipld.ReprKind_Map} -} -func (_Block__ReprBuilder) CreateInt(int) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Block.Representation.Builder", MethodName: "CreateInt", AppropriateKind: ipld.ReprKindSet_JustInt, ActualKind: ipld.ReprKind_Map} -} -func (_Block__ReprBuilder) CreateFloat(float64) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Block.Representation.Builder", MethodName: "CreateFloat", AppropriateKind: ipld.ReprKindSet_JustFloat, ActualKind: ipld.ReprKind_Map} -} -func (_Block__ReprBuilder) CreateString(string) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Block.Representation.Builder", MethodName: "CreateString", AppropriateKind: ipld.ReprKindSet_JustString, ActualKind: ipld.ReprKind_Map} -} -func (_Block__ReprBuilder) CreateBytes([]byte) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Block.Representation.Builder", MethodName: "CreateBytes", AppropriateKind: ipld.ReprKindSet_JustBytes, ActualKind: ipld.ReprKind_Map} -} -func (_Block__ReprBuilder) CreateLink(ipld.Link) (ipld.Node, error) { - return nil, ipld.ErrWrongKind{TypeName: "Block.Representation.Builder", MethodName: "CreateLink", AppropriateKind: ipld.ReprKindSet_JustLink, ActualKind: ipld.ReprKind_Map} -} diff --git a/testutil/chaintypes/testchain_minima.go b/testutil/chaintypes/testchain_minima.go deleted file mode 100644 index 57cbfcd5..00000000 --- a/testutil/chaintypes/testchain_minima.go +++ /dev/null @@ -1,14 +0,0 @@ -package chaintypes - -import ( - ipld "github.com/ipld/go-ipld-prime" -) - -type mapIteratorReject struct{ err error } -type listIteratorReject struct{ err error } - -func (itr mapIteratorReject) Next() (ipld.Node, ipld.Node, error) { return nil, nil, itr.err } -func (itr mapIteratorReject) Done() bool { return false } - -func (itr listIteratorReject) Next() (int, ipld.Node, error) { return -1, nil, itr.err } -func (itr listIteratorReject) Done() bool { return false } diff --git a/testutil/test_ipld_tree.go b/testutil/test_ipld_tree.go index b0668a36..5d00a13b 100644 --- a/testutil/test_ipld_tree.go +++ b/testutil/test_ipld_tree.go @@ -10,10 +10,10 @@ import ( "github.com/ipld/go-ipld-prime" // to register multicodec - _ "github.com/ipld/go-ipld-prime/encoding/dagjson" + _ "github.com/ipld/go-ipld-prime/codec/dagjson" "github.com/ipld/go-ipld-prime/fluent" - ipldfree "github.com/ipld/go-ipld-prime/impl/free" cidlink "github.com/ipld/go-ipld-prime/linking/cid" + basicnode "github.com/ipld/go-ipld-prime/node/basic" ) // TestIPLDTree is a set of IPLD Data that forms a tree spread across some blocks @@ -40,7 +40,6 @@ type TestIPLDTree struct { // NewTestIPLDTree returns a fake tree of nodes, spread across 5 blocks func NewTestIPLDTree() TestIPLDTree { var storage = make(map[ipld.Link][]byte) - var fnb = fluent.WrapNodeBuilder(ipldfree.NodeBuilder()) // just for the other fixture building encode := func(n ipld.Node) (ipld.Node, ipld.Link) { lb := cidlink.LinkBuilder{Prefix: cid.Prefix{ Version: 1, @@ -64,31 +63,31 @@ func NewTestIPLDTree() TestIPLDTree { } var ( - leafAlpha, leafAlphaLnk = encode(fnb.CreateString("alpha")) + leafAlpha, leafAlphaLnk = encode(basicnode.NewString("alpha")) leafAlphaBlock, _ = blocks.NewBlockWithCid(storage[leafAlphaLnk], leafAlphaLnk.(cidlink.Link).Cid) - leafBeta, leafBetaLnk = encode(fnb.CreateString("beta")) + leafBeta, leafBetaLnk = encode(basicnode.NewString("beta")) leafBetaBlock, _ = blocks.NewBlockWithCid(storage[leafBetaLnk], leafBetaLnk.(cidlink.Link).Cid) - middleMapNode, middleMapNodeLnk = encode(fnb.CreateMap(func(mb fluent.MapBuilder, knb fluent.NodeBuilder, vnb fluent.NodeBuilder) { - mb.Insert(knb.CreateString("foo"), vnb.CreateBool(true)) - mb.Insert(knb.CreateString("bar"), vnb.CreateBool(false)) - mb.Insert(knb.CreateString("nested"), vnb.CreateMap(func(mb fluent.MapBuilder, knb fluent.NodeBuilder, vnb fluent.NodeBuilder) { - mb.Insert(knb.CreateString("alink"), vnb.CreateLink(leafAlphaLnk)) - mb.Insert(knb.CreateString("nonlink"), vnb.CreateString("zoo")) - })) + middleMapNode, middleMapNodeLnk = encode(fluent.MustBuildMap(basicnode.Style.Map, 3, func(na fluent.MapAssembler) { + na.AssembleEntry("foo").AssignBool(true) + na.AssembleEntry("bar").AssignBool(false) + na.AssembleEntry("nested").CreateMap(2, func(na fluent.MapAssembler) { + na.AssembleEntry("alink").AssignLink(leafAlphaLnk) + na.AssembleEntry("nonlink").AssignString("zoo") + }) })) middleMapBlock, _ = blocks.NewBlockWithCid(storage[middleMapNodeLnk], middleMapNodeLnk.(cidlink.Link).Cid) - middleListNode, middleListNodeLnk = encode(fnb.CreateList(func(lb fluent.ListBuilder, vnb fluent.NodeBuilder) { - lb.Append(vnb.CreateLink(leafAlphaLnk)) - lb.Append(vnb.CreateLink(leafAlphaLnk)) - lb.Append(vnb.CreateLink(leafBetaLnk)) - lb.Append(vnb.CreateLink(leafAlphaLnk)) + middleListNode, middleListNodeLnk = encode(fluent.MustBuildList(basicnode.Style.List, 4, func(na fluent.ListAssembler) { + na.AssembleValue().AssignLink(leafAlphaLnk) + na.AssembleValue().AssignLink(leafAlphaLnk) + na.AssembleValue().AssignLink(leafBetaLnk) + na.AssembleValue().AssignLink(leafAlphaLnk) })) middleListBlock, _ = blocks.NewBlockWithCid(storage[middleListNodeLnk], middleListNodeLnk.(cidlink.Link).Cid) - rootNode, rootNodeLnk = encode(fnb.CreateMap(func(mb fluent.MapBuilder, knb fluent.NodeBuilder, vnb fluent.NodeBuilder) { - mb.Insert(knb.CreateString("plain"), vnb.CreateString("olde string")) - mb.Insert(knb.CreateString("linkedString"), vnb.CreateLink(leafAlphaLnk)) - mb.Insert(knb.CreateString("linkedMap"), vnb.CreateLink(middleMapNodeLnk)) - mb.Insert(knb.CreateString("linkedList"), vnb.CreateLink(middleListNodeLnk)) + rootNode, rootNodeLnk = encode(fluent.MustBuildMap(basicnode.Style.Map, 4, func(na fluent.MapAssembler) { + na.AssembleEntry("plain").AssignString("olde string") + na.AssembleEntry("linkedString").AssignLink(leafAlphaLnk) + na.AssembleEntry("linkedMap").AssignLink(middleMapNodeLnk) + na.AssembleEntry("linkedList").AssignLink(middleListNodeLnk) })) rootBlock, _ = blocks.NewBlockWithCid(storage[rootNodeLnk], rootNodeLnk.(cidlink.Link).Cid) ) diff --git a/testutil/testchain.go b/testutil/testchain.go index cfffd2a0..7633c258 100644 --- a/testutil/testchain.go +++ b/testutil/testchain.go @@ -8,10 +8,9 @@ import ( blocks "github.com/ipfs/go-block-format" cid "github.com/ipfs/go-cid" "github.com/ipfs/go-graphsync" - "github.com/ipfs/go-graphsync/testutil/chaintypes" "github.com/ipld/go-ipld-prime" - ipldfree "github.com/ipld/go-ipld-prime/impl/free" cidlink "github.com/ipld/go-ipld-prime/linking/cid" + basicnode "github.com/ipld/go-ipld-prime/node/basic" "github.com/ipld/go-ipld-prime/traversal/selector" "github.com/ipld/go-ipld-prime/traversal/selector/builder" mh "github.com/multiformats/go-multihash" @@ -35,69 +34,53 @@ type TestBlockChain struct { } func createBlock(parents []ipld.Link, size uint64) (ipld.Node, error) { - links := make([]ipld.Node, 0, len(parents)) - for _, parent := range parents { - lnb := chaintypes.Link__NodeBuilder() - link, err := lnb.CreateLink(parent) - if err != nil { - return nil, err - } - links = append(links, link) - } - pnb := chaintypes.Parents__NodeBuilder() - pnblnb, err := pnb.CreateList() - if err != nil { - return nil, err - } - err = pnblnb.AppendAll(links) - if err != nil { - return nil, err - } - parentsNd, err := pnblnb.Build() + blknb := basicnode.Style.Map.NewBuilder() + blknbmnb, err := blknb.BeginMap(2) if err != nil { return nil, err } - mnb := chaintypes.Messages__NodeBuilder() - mnblnb, err := mnb.CreateList() + + entnb, err := blknbmnb.AssembleEntry("Parents") if err != nil { return nil, err } - bnb := chaintypes.Bytes__NodeBuilder() - bytes, err := bnb.CreateBytes(RandomBytes(int64(size))) + pnblnb, err := entnb.BeginList(len(parents)) if err != nil { return nil, err } - err = mnblnb.Append(bytes) - if err != nil { - return nil, err + for _, parent := range parents { + err := pnblnb.AssembleValue().AssignLink(parent) + if err != nil { + return nil, err + } } - mesagesNd, err := mnblnb.Build() + err = pnblnb.Finish() if err != nil { return nil, err } - blknb := chaintypes.Block__NodeBuilder() - blknbmnb, err := blknb.CreateMap() + + entnb, err = blknbmnb.AssembleEntry("Messages") if err != nil { return nil, err } - snb := chaintypes.String__NodeBuilder() - key, err := snb.CreateString("Parents") + mnblnb, err := entnb.BeginList(1) if err != nil { return nil, err } - err = blknbmnb.Insert(key, parentsNd) + err = mnblnb.AssembleValue().AssignBytes(RandomBytes(int64(size))) if err != nil { return nil, err } - key, err = snb.CreateString("Messages") + mnblnb.Finish() if err != nil { return nil, err } - err = blknbmnb.Insert(key, mesagesNd) + + err = blknbmnb.Finish() if err != nil { return nil, err } - return blknbmnb.Build() + return blknb.Build(), nil } // SetupBlockChain creates a new test block chain with the given height @@ -134,7 +117,7 @@ func SetupBlockChain( // Selector returns the selector to recursive traverse the block chain parent links func (tbc *TestBlockChain) Selector() ipld.Node { - ssb := builder.NewSelectorSpecBuilder(ipldfree.NodeBuilder()) + ssb := builder.NewSelectorSpecBuilder(basicnode.Style.Any) return ssb.ExploreRecursive(selector.RecursionLimitDepth(tbc.blockChainLength), ssb.ExploreFields(func(efsb builder.ExploreFieldsSpecBuilder) { efsb.Insert("Parents", ssb.ExploreAll( @@ -178,20 +161,20 @@ func (tbc *TestBlockChain) checkResponses(responses []graphsync.ResponseProgress for i, response := range responses { require.Equal(tbc.t, expectedPath, response.Path.String(), "response has correct path") if i%2 == 0 { - if verifyTypes { - _, ok := response.Node.(chaintypes.Block) - require.True(tbc.t, ok, "nodes in response should have correct type") - } + // if verifyTypes { + // _, ok := response.Node.(chaintypes.Block) + // require.True(tbc.t, ok, "nodes in response should have correct type") + // } if expectedPath == "" { expectedPath = "Parents" } else { expectedPath = expectedPath + "/Parents" } } else { - if verifyTypes { - _, ok := response.Node.(chaintypes.Parents) - require.True(tbc.t, ok, "nodes in response should have correct type") - } + // if verifyTypes { + // _, ok := response.Node.(chaintypes.Parents) + // require.True(tbc.t, ok, "nodes in response should have correct type") + // } expectedPath = expectedPath + "/0" } if response.LastBlock.Path.String() != response.Path.String() { @@ -263,6 +246,7 @@ func (tbc *TestBlockChain) RemainderBlocks(from int) []blocks.Block { } // Chooser is a NodeBuilderChooser function that always returns the block chain -func (tbc *TestBlockChain) Chooser(ipld.Link, ipld.LinkContext) (ipld.NodeBuilder, error) { - return chaintypes.Block__NodeBuilder(), nil +func (tbc *TestBlockChain) Chooser(ipld.Link, ipld.LinkContext) (ipld.NodeStyle, error) { + return basicnode.Style.Any, nil + //return chaintypes.Block__NodeBuilder(), nil } diff --git a/testutil/testnodes.go b/testutil/testnodes.go index ed22cb25..7c105d88 100644 --- a/testutil/testnodes.go +++ b/testutil/testnodes.go @@ -2,7 +2,7 @@ package testutil import ( ipld "github.com/ipld/go-ipld-prime" - ipldfree "github.com/ipld/go-ipld-prime/impl/free" + basicnode "github.com/ipld/go-ipld-prime/node/basic" "github.com/ipld/go-ipld-prime/traversal/selector" "github.com/ipld/go-ipld-prime/traversal/selector/builder" ) @@ -10,19 +10,13 @@ import ( // NewUnparsableSelectorSpec returns a spec that will fail when you attempt to // validate it or decompose to a node + selector. func NewUnparsableSelectorSpec() ipld.Node { - ssb := builder.NewSelectorSpecBuilder(ipldfree.NodeBuilder()) + ssb := builder.NewSelectorSpecBuilder(basicnode.Style.Any) return ssb.ExploreRecursiveEdge().Node() } // NewInvalidSelectorSpec returns a spec that will fail when you attempt to // validate it on the responder side func NewInvalidSelectorSpec() ipld.Node { - ssb := builder.NewSelectorSpecBuilder(ipldfree.NodeBuilder()) + ssb := builder.NewSelectorSpecBuilder(basicnode.Style.Any) return ssb.ExploreRecursive(selector.RecursionLimitNone(), ssb.ExploreAll(ssb.ExploreRecursiveEdge())).Node() } - -// NewUnencodableSelectorSpec returns a spec that will fail when you attempt to -// encode it. -func NewUnencodableSelectorSpec() ipld.Node { - return &ipldfree.Node{} -} diff --git a/testutil/testnodes_test.go b/testutil/testnodes_test.go index 2612a9e3..c47ce98f 100644 --- a/testutil/testnodes_test.go +++ b/testutil/testnodes_test.go @@ -12,9 +12,3 @@ func TestFailParseSelectorSpec(t *testing.T) { _, err := ipldutil.ParseSelector(spec) require.Error(t, err, "unparsable selector should not parse") } - -func TestFailEncodingSelectorSpec(t *testing.T) { - spec := NewUnencodableSelectorSpec() - _, err := ipldutil.EncodeNode(spec) - require.Error(t, err, "unencodable selector should not encode") -} From 5bde6038c4f3b0c986e51f22963324520ab9041b Mon Sep 17 00:00:00 2001 From: hannahhoward Date: Tue, 28 Apr 2020 12:15:01 -0700 Subject: [PATCH 2/3] fix(deps): upgrade ipld-prime with bug fix use ipld prime with fixed marshalling bug to get tests passing --- go.mod | 18 ++++++++---- go.sum | 91 ++++++++++------------------------------------------------ 2 files changed, 28 insertions(+), 81 deletions(-) diff --git a/go.mod b/go.mod index e5d04e9e..408e4590 100644 --- a/go.mod +++ b/go.mod @@ -3,9 +3,9 @@ module github.com/ipfs/go-graphsync go 1.12 require ( - github.com/filecoin-project/go-data-transfer v0.0.0-20200408061858-82c58b423ca6 - github.com/filecoin-project/go-fil-markets v0.0.0-20200408062434-d92f329a6428 github.com/gogo/protobuf v1.3.1 + github.com/golang/protobuf v1.3.2 // indirect + github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f // indirect github.com/ipfs/go-block-format v0.0.2 github.com/ipfs/go-blockservice v0.1.3 github.com/ipfs/go-cid v0.0.5 @@ -16,18 +16,26 @@ require ( github.com/ipfs/go-ipfs-exchange-offline v0.0.1 github.com/ipfs/go-ipfs-files v0.0.8 github.com/ipfs/go-ipfs-util v0.0.1 + github.com/ipfs/go-ipld-cbor v0.0.4 // indirect github.com/ipfs/go-ipld-format v0.2.0 github.com/ipfs/go-log v1.0.2 github.com/ipfs/go-merkledag v0.3.1 github.com/ipfs/go-peertaskqueue v0.2.0 github.com/ipfs/go-unixfs v0.2.4 - github.com/ipld/go-ipld-prime v0.0.2-0.20200331163611-44af114587ec - github.com/ipld/go-ipld-prime-proto v0.0.0-20200331015814-a6d6f408ac98 + github.com/ipld/go-ipld-prime v0.0.2-0.20200428162820-8b59dc292b8e + github.com/ipld/go-ipld-prime-proto v0.0.0-20200428191222-c1ffdadc01e1 github.com/jbenet/go-random v0.0.0-20190219211222-123a90aedc0c github.com/libp2p/go-libp2p v0.6.0 github.com/libp2p/go-libp2p-core v0.5.0 - github.com/libp2p/go-libp2p-peer v0.2.0 + github.com/libp2p/go-libp2p-record v0.1.1 // indirect github.com/multiformats/go-multiaddr v0.2.1 github.com/multiformats/go-multihash v0.0.13 + github.com/polydawn/refmt v0.0.0-20190809202753-05966cbd336a // indirect + github.com/smartystreets/assertions v1.0.1 // indirect + github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 // indirect github.com/stretchr/testify v1.4.0 + github.com/whyrusleeping/cbor-gen v0.0.0-20200402171437-3d27c146c105 // indirect + go.uber.org/multierr v1.4.0 // indirect + golang.org/x/net v0.0.0-20190724013045-ca1201d0de80 // indirect + golang.org/x/tools v0.0.0-20191216173652-a0e659d51361 // indirect ) diff --git a/go.sum b/go.sum index a676ed4b..eb60701a 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,7 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/Kubuxu/go-os-helper v0.0.1/go.mod h1:N8B+I7vPCT80IcP58r50u4+gEEcsZETFUpAzWW2ep1Y= github.com/Stebalien/go-bitfield v0.0.1 h1:X3kbSSPUaJK60wV2hjOPZwmpljr6VGCqdq4cBLhbQBo= @@ -32,7 +33,6 @@ github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3Ee github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3 h1:HVTnpeuvF6Owjd5mniCL8DEXo7uYXdQEmOP4FJbV5tg= github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3/go.mod h1:p1d6YEZWvFzEh4KLyvBcVSnrfNDDvK2zfK/4x2v/4pE= github.com/cskr/pubsub v1.0.2 h1:vlOzMhl6PFn60gRlTQQsIfVwaPB/B/8MziK8FhEPt/0= @@ -49,28 +49,6 @@ github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6ps github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/fatih/color v1.8.0/go.mod h1:3l45GVGkyrnYNl9HoIjnp2NnNWvh6hLAqD8yTfGjnw8= -github.com/filecoin-project/filecoin-ffi v0.0.0-20200304181354-4446ff8a1bb9/go.mod h1:PtH9YP0rURHUKHrKeEBeWg/BqIBMQOz8wtlXlVGREBE= -github.com/filecoin-project/go-address v0.0.0-20200107215422-da8eea2842b5/go.mod h1:SAOwJoakQ8EPjwNIsiakIQKsoKdkcbx8U3IapgCg9R0= -github.com/filecoin-project/go-address v0.0.2-0.20200218010043-eb9bb40ed5be h1:TooKBwR/g8jG0hZ3lqe9S5sy2vTUcLOZLlz3M5wGn2E= -github.com/filecoin-project/go-address v0.0.2-0.20200218010043-eb9bb40ed5be/go.mod h1:SAOwJoakQ8EPjwNIsiakIQKsoKdkcbx8U3IapgCg9R0= -github.com/filecoin-project/go-amt-ipld/v2 v2.0.1-0.20200131012142-05d80eeccc5e h1:IOoff6yAZSJ5zHCPY2jzGNwQYQU6ygsRVe/cSnJrY+o= -github.com/filecoin-project/go-amt-ipld/v2 v2.0.1-0.20200131012142-05d80eeccc5e/go.mod h1:boRtQhzmxNocrMxOXo1NYn4oUc1NGvR8tEa79wApNXg= -github.com/filecoin-project/go-cbor-util v0.0.0-20191219014500-08c40a1e63a2/go.mod h1:pqTiPHobNkOVM5thSRsHYjyQfq7O5QSCMhvuu9JoDlg= -github.com/filecoin-project/go-crypto v0.0.0-20191218222705-effae4ea9f03/go.mod h1:+viYnvGtUTgJRdy6oaeF4MTFKAfatX071MPDPBL11EQ= -github.com/filecoin-project/go-data-transfer v0.0.0-20200408061858-82c58b423ca6 h1:CIQ7RlW7I3E+JBxfKiK0ZWO9HPSBqlI5aeA/sdwyVTc= -github.com/filecoin-project/go-data-transfer v0.0.0-20200408061858-82c58b423ca6/go.mod h1:7b5/sG9Jj33aWqft8XsH8yIdxZBACqS5tx9hv4uj2Ck= -github.com/filecoin-project/go-fil-commcid v0.0.0-20200208005934-2b8bd03caca5/go.mod h1:JbkIgFF/Z9BDlvrJO1FuKkaWsH673/UdFaiVS6uIHlA= -github.com/filecoin-project/go-fil-markets v0.0.0-20200408062434-d92f329a6428 h1:y8P10ZwfmsKMVHrqcU1L8Bgj2q42O6LzaySI+XaogXE= -github.com/filecoin-project/go-fil-markets v0.0.0-20200408062434-d92f329a6428/go.mod h1:NmuTIqaivdyUzmvHOUCsTDGEtNjOZQwC1cgW3W/02m4= -github.com/filecoin-project/go-padreader v0.0.0-20200210211231-548257017ca6/go.mod h1:0HgYnrkeSU4lu1p+LEOeDpFsNBssa0OGGriWdA4hvaE= -github.com/filecoin-project/go-paramfetch v0.0.2-0.20200218225740-47c639bab663/go.mod h1:fZzmf4tftbwf9S37XRifoJlz7nCjRdIrMGLR07dKLCc= -github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200326160829-51775363aa18/go.mod h1:xAd/X905Ncgj8kkHsP2pmQUf6MQT2qJTDcOEfkwCjYc= -github.com/filecoin-project/go-statemachine v0.0.0-20200226041606-2074af6d51d9/go.mod h1:FGwQgZAt2Gh5mjlwJUlVB62JeYdo+if0xWxSEfBD9ig= -github.com/filecoin-project/go-statestore v0.1.0/go.mod h1:LFc9hD+fRxPqiHiaqUEZOinUJB4WARkRfNl10O7kTnI= -github.com/filecoin-project/specs-actors v0.0.0-20200210130641-2d1fbd8672cf/go.mod h1:xtDZUB6pe4Pksa/bAJbJ693OilaC5Wbot9jMhLm3cZA= -github.com/filecoin-project/specs-actors v0.0.0-20200226200336-94c9b92b2775 h1:j6EdTc5hIHe31ydt9SjgJNDi/ck50y5wa1OJ+4YZ6zk= -github.com/filecoin-project/specs-actors v0.0.0-20200226200336-94c9b92b2775/go.mod h1:0HAWYrvajFHDgRaKbF0rl+IybVLZL5z4gQ8koCMPhoU= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/go-check/check v0.0.0-20180628173108-788fd7840127 h1:0gkP6mzaMqkmpcJYCFOLkIBwI7xFExG03bbkOkCvUPI= @@ -88,12 +66,13 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= @@ -102,6 +81,7 @@ github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGa github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherjs v0.0.0-20190430165422-3e4dfb77656c h1:7lF+Vz0LqiRidnzC1Oq86fpX1q/iEv2KJdrCtttYjT4= github.com/gopherjs/gopherjs v0.0.0-20190430165422-3e4dfb77656c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f h1:KMlcu9X58lhTA/KrfX8Bi1LQSO4pzoVjTiL3h4Jk+Zk= github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= @@ -111,8 +91,6 @@ github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyF github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hannahhoward/cbor-gen-for v0.0.0-20191216214420-3e450425c40c/go.mod h1:WVPCl0HO/0RAL5+vBH2GMxBomlxBF70MAS78+Lu1//k= -github.com/hannahhoward/cbor-gen-for v0.0.0-20191218204337-9ab7b1bcc099/go.mod h1:WVPCl0HO/0RAL5+vBH2GMxBomlxBF70MAS78+Lu1//k= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= @@ -147,7 +125,6 @@ github.com/ipfs/go-cid v0.0.2 h1:tuuKaZPU1M6HcejsO3AcYWW8sZ8MTvyxfc4uqB4eFE8= github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= github.com/ipfs/go-cid v0.0.3 h1:UIAh32wymBpStoe83YCzwVQQ5Oy/H0FdxvUS6DJDzms= github.com/ipfs/go-cid v0.0.3/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-cid v0.0.4-0.20191112011718-79e75dffeb10/go.mod h1:/BYOuUoxkE+0f6tGzlzMvycuN+5l35VOR4Bpg2sCmds= github.com/ipfs/go-cid v0.0.4/go.mod h1:4LLaPOQwmk5z9LBgQnpkivrx8BJjUyGwTXCd5Xfj6+M= github.com/ipfs/go-cid v0.0.5 h1:o0Ix8e/ql7Zb5UVUJEUfjsWCIY8t48++9lR8qi6oiJU= github.com/ipfs/go-cid v0.0.5/go.mod h1:plgt+Y5MnOey4vO4UlUazGqdbEXuFYitED67FexhXog= @@ -169,9 +146,6 @@ github.com/ipfs/go-ds-badger v0.0.5/go.mod h1:g5AuuCGmr7efyzQhLL8MzwqcauPojGPUaH github.com/ipfs/go-ds-badger v0.2.1/go.mod h1:Tx7l3aTph3FMFrRS838dcSJh+jjA7cX9DrGVwx/NOwE= github.com/ipfs/go-ds-leveldb v0.0.1/go.mod h1:feO8V3kubwsEF22n0YRQCffeb79OOYIykR4L04tMOYc= github.com/ipfs/go-ds-leveldb v0.4.1/go.mod h1:jpbku/YqBSsBc1qgME8BkWS4AxzF2cEu1Ii2r79Hh9s= -github.com/ipfs/go-graphsync v0.0.6-0.20200408061628-e1a98fc64c42/go.mod h1:pX9G90DyPVZCFGcjWlpDTl1rTGU+TAG3SA6bg8GXQXc= -github.com/ipfs/go-hamt-ipld v0.0.15-0.20200131012125-dd88a59d3f2e h1:bUtmeXx6JpjxRPlMdlKfPXC5kKhLHuueXKgs1Txb9ZU= -github.com/ipfs/go-hamt-ipld v0.0.15-0.20200131012125-dd88a59d3f2e/go.mod h1:9aQJu/i/TaRDW6jqB5U217dLIDopn50wxLdHXM2CTfE= github.com/ipfs/go-ipfs-blockstore v0.0.1 h1:O9n3PbmTYZoNhkgkEyrXTznbmktIXif62xLX+8dPHzc= github.com/ipfs/go-ipfs-blockstore v0.0.1/go.mod h1:d3WClOmRQKFnJ0Jz/jj/zmksX0ma1gROTlovZKBmN08= github.com/ipfs/go-ipfs-blockstore v0.1.0/go.mod h1:5aD0AvHPi7mZc6Ci1WCAhiBQu2IsfTduLl+422H6Rqw= @@ -195,8 +169,6 @@ github.com/ipfs/go-ipfs-exchange-interface v0.0.1/go.mod h1:c8MwfHjtQjPoDyiy9cFq github.com/ipfs/go-ipfs-exchange-offline v0.0.1 h1:P56jYKZF7lDDOLx5SotVh5KFxoY6C81I1NSHW1FxGew= github.com/ipfs/go-ipfs-exchange-offline v0.0.1/go.mod h1:WhHSFCVYX36H/anEKQboAzpUws3x7UeEGkzQc3iNkM0= github.com/ipfs/go-ipfs-files v0.0.3/go.mod h1:INEFm0LL2LWXBhNJ2PMIIb2w45hpXgPjNoE7yA8Y1d4= -github.com/ipfs/go-ipfs-files v0.0.4 h1:WzRCivcybUQch/Qh6v8LBRhKtRsjnwyiuOV09mK7mrE= -github.com/ipfs/go-ipfs-files v0.0.4/go.mod h1:INEFm0LL2LWXBhNJ2PMIIb2w45hpXgPjNoE7yA8Y1d4= github.com/ipfs/go-ipfs-files v0.0.8 h1:8o0oFJkJ8UkO/ABl8T6ac6tKF3+NIpj67aAB6ZpusRg= github.com/ipfs/go-ipfs-files v0.0.8/go.mod h1:wiN/jSG8FKyk7N0WyctKSvq3ljIa2NNTiZB55kpTdOs= github.com/ipfs/go-ipfs-posinfo v0.0.1 h1:Esoxj+1JgSjX0+ylc0hUmJCOv6V2vFoZiETLR6OtpRs= @@ -222,17 +194,12 @@ github.com/ipfs/go-ipld-format v0.2.0 h1:xGlJKkArkmBvowr+GMCX0FEZtkro71K1AwiKnL3 github.com/ipfs/go-ipld-format v0.2.0/go.mod h1:3l3C1uKoadTPbeNfrDi+xMInYKlx2Cvg1BuydPSdzQs= github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/ipfs/go-log v1.0.0/go.mod h1:JO7RzlMK6rA+CIxFMLOuB6Wf5b81GDiKElL7UPSIKjA= -github.com/ipfs/go-log v1.0.1/go.mod h1:HuWlQttfN6FWNHRhlY5yMk/lW7evQC0HHGOxEwMRR8I= github.com/ipfs/go-log v1.0.2 h1:s19ZwJxH8rPWzypjcDpqPLIyV7BnbLqvpli3iZoqYK0= github.com/ipfs/go-log v1.0.2/go.mod h1:1MNjMxe0u6xvJZgeqbJ8vdo2TKaGwZ1a0Bpza+sr2Sk= -github.com/ipfs/go-log/v2 v2.0.1/go.mod h1:O7P1lJt27vWHhOwQmcFEvlmo49ry2VY2+JfBWFaa9+0= github.com/ipfs/go-log/v2 v2.0.2 h1:xguurydRdfKMJjKyxNXNU8lYP0VZH1NUwJRwUorjuEw= github.com/ipfs/go-log/v2 v2.0.2/go.mod h1:O7P1lJt27vWHhOwQmcFEvlmo49ry2VY2+JfBWFaa9+0= github.com/ipfs/go-merkledag v0.2.3 h1:aMdkK9G1hEeNvn3VXfiEMLY0iJnbiQQUHnM0HFJREsE= github.com/ipfs/go-merkledag v0.2.3/go.mod h1:SQiXrtSts3KGNmgOzMICy5c0POOpUNQLvB3ClKnBAlk= -github.com/ipfs/go-merkledag v0.2.4 h1:ZSHQSe9BENfixUjT+MaLeHEeZGxrZQfgo3KT3SLosF8= -github.com/ipfs/go-merkledag v0.2.4/go.mod h1:SQiXrtSts3KGNmgOzMICy5c0POOpUNQLvB3ClKnBAlk= github.com/ipfs/go-merkledag v0.3.1 h1:3UqWINBEr3/N+r6OwgFXAddDP/8zpQX/8J7IGVOCqRQ= github.com/ipfs/go-merkledag v0.3.1/go.mod h1:fvkZNNZixVW6cKSZ/JfLlON5OlgTXNdRLz0p6QG/I2M= github.com/ipfs/go-metrics-interface v0.0.1 h1:j+cpbjYvu4R8zbleSs36gvB7jR+wsL2fGD6n0jO4kdg= @@ -242,27 +209,14 @@ github.com/ipfs/go-peertaskqueue v0.1.0/go.mod h1:Jmk3IyCcfl1W3jTW3YpghSwSEC6IJ3 github.com/ipfs/go-peertaskqueue v0.1.1/go.mod h1:Jmk3IyCcfl1W3jTW3YpghSwSEC6IJ3Vzz/jUmWw8Z0U= github.com/ipfs/go-peertaskqueue v0.2.0 h1:2cSr7exUGKYyDeUyQ7P/nHPs9P7Ht/B+ROrpN1EJOjc= github.com/ipfs/go-peertaskqueue v0.2.0/go.mod h1:5/eNrBEbtSKWCG+kQK8K8fGNixoYUnr+P7jivavs9lY= -github.com/ipfs/go-unixfs v0.2.2-0.20190827150610-868af2e9e5cb h1:tmWYgjltxwM7PDmFJgWgLuy5qx24csUvRoIiO+F/zQ4= -github.com/ipfs/go-unixfs v0.2.2-0.20190827150610-868af2e9e5cb/go.mod h1:IwAAgul1UQIcNZzKPYZWOCijryFBeCV79cNubPzol+k= github.com/ipfs/go-unixfs v0.2.4 h1:6NwppOXefWIyysZ4LR/qUBPvXd5//8J3jiMdvpbw6Lo= github.com/ipfs/go-unixfs v0.2.4/go.mod h1:SUdisfUjNoSDzzhGVxvCL9QO/nKdwXdr+gbMUdqcbYw= github.com/ipfs/go-verifcid v0.0.1 h1:m2HI7zIuR5TFyQ1b79Da5N9dnnCP1vcu2QqawmWlK2E= github.com/ipfs/go-verifcid v0.0.1/go.mod h1:5Hrva5KBeIog4A+UpqlaIU+DEstipcJYQQZc0g37pY0= -github.com/ipld/go-car v0.0.5-0.20200316204026-3e2cf7af0fab/go.mod h1:yR5AsJ38xTwwgwGpbh60ICtdLPp5lGfuH28PAAzaEhM= -github.com/ipld/go-ipld-prime v0.0.2-0.20191108012745-28a82f04c785 h1:fASnkvtR+SmB2y453RxmDD3Uvd4LonVUgFGk9JoDaZs= -github.com/ipld/go-ipld-prime v0.0.2-0.20191108012745-28a82f04c785/go.mod h1:bDDSvVz7vaK12FNvMeRYnpRFkSUPNQOiCYQezMD/P3w= -github.com/ipld/go-ipld-prime v0.0.2-0.20200229094926-eb71617f4aeb h1:uvoZ2aTjsTt/6W5hkzj3JkPMY3oHvcla4WA29k4Jk0I= -github.com/ipld/go-ipld-prime v0.0.2-0.20200229094926-eb71617f4aeb/go.mod h1:uVIwe/u0H4VdKv3kaN1ck7uCb6yD9cFLS9/ELyXbsw8= -github.com/ipld/go-ipld-prime v0.0.2-0.20200327122045-fc80c2b0149d/go.mod h1:uVIwe/u0H4VdKv3kaN1ck7uCb6yD9cFLS9/ELyXbsw8= -github.com/ipld/go-ipld-prime v0.0.2-0.20200331163611-44af114587ec h1:BhJ/pwukgBhmlzLfM6CeINszfzavl4ythOHALsovBOc= -github.com/ipld/go-ipld-prime v0.0.2-0.20200331163611-44af114587ec/go.mod h1:uVIwe/u0H4VdKv3kaN1ck7uCb6yD9cFLS9/ELyXbsw8= -github.com/ipld/go-ipld-prime-proto v0.0.0-20191113031812-e32bd156a1e5 h1:lSip43rAdyGA+yRQuy6ju0ucZkWpYc1F2CTQtZTVW/4= -github.com/ipld/go-ipld-prime-proto v0.0.0-20191113031812-e32bd156a1e5/go.mod h1:gcvzoEDBjwycpXt3LBE061wT9f46szXGHAmj9uoP6fU= -github.com/ipld/go-ipld-prime-proto v0.0.0-20200331015814-a6d6f408ac98 h1:SZ0fO/ir0lAAeKAU87s8wMpTp9wRuOScdwNpw0DT6HI= -github.com/ipld/go-ipld-prime-proto v0.0.0-20200331015814-a6d6f408ac98/go.mod h1:gYRFQ2pKw0riArR4YCWmqmSW6rdytGW4ynwqOAx0VqY= -github.com/ipld/go-ipld-prime-proto v0.0.0-20200409003434-8cf97d9cb362 h1:ZPMg5SLiHu/FzBIv7p8obE3VGwiKaRNnM+QxiYsk+tg= -github.com/ipld/go-ipld-prime-proto v0.0.0-20200409003434-8cf97d9cb362/go.mod h1:ScHZhxNfNoOTfM87iqdAC37cDh56S+0/LK0NtyriaBk= -github.com/ipsn/go-secp256k1 v0.0.0-20180726113642-9d62b9f0bc52/go.mod h1:fdg+/X9Gg4AsAIzWpEHwnqd+QY3b7lajxyjE1m4hkq4= +github.com/ipld/go-ipld-prime v0.0.2-0.20200428162820-8b59dc292b8e h1:ZISbJlM0urTANR9KRfRaqlBmyOj5uUtxs2r4Up9IXsA= +github.com/ipld/go-ipld-prime v0.0.2-0.20200428162820-8b59dc292b8e/go.mod h1:uVIwe/u0H4VdKv3kaN1ck7uCb6yD9cFLS9/ELyXbsw8= +github.com/ipld/go-ipld-prime-proto v0.0.0-20200428191222-c1ffdadc01e1 h1:K1Ysr7kgIlo7YQkPqdkA6H7BVdIugvuAz7OQUTJxLdE= +github.com/ipld/go-ipld-prime-proto v0.0.0-20200428191222-c1ffdadc01e1/go.mod h1:OAV6xBmuTLsPZ+epzKkPB1e25FHk/vCtyatkdHcArLs= github.com/jackpal/gateway v1.0.5 h1:qzXWUJfuMdlLMtt0a3Dgt+xkWQiA5itDEITVJtuSwMc= github.com/jackpal/gateway v1.0.5/go.mod h1:lTpwd4ACLXmpyiCTRtfiNyVnUmqT9RivzCDQetPfnjA= github.com/jackpal/go-nat-pmp v1.0.1 h1:i0LektDkO1QlrTm/cSuP+PyBCDnYvjPLGl4LdWEMiaA= @@ -370,6 +324,7 @@ github.com/libp2p/go-libp2p-pnet v0.2.0 h1:J6htxttBipJujEjz1y0a5+eYoiPcFHhSYHH6n github.com/libp2p/go-libp2p-pnet v0.2.0/go.mod h1:Qqvq6JH/oMZGwqs3N1Fqhv8NVhrdYcO0BW4wssv21LA= github.com/libp2p/go-libp2p-record v0.1.0 h1:wHwBGbFzymoIl69BpgwIu0O6ta3TXGcMPvHUAcodzRc= github.com/libp2p/go-libp2p-record v0.1.0/go.mod h1:ujNc8iuE5dlKWVy6wuL6dd58t0n7xI4hAIl8pE6wu5Q= +github.com/libp2p/go-libp2p-record v0.1.1 h1:ZJK2bHXYUBqObHX+rHLSNrM3M8fmJUlUHrodDPPATmY= github.com/libp2p/go-libp2p-record v0.1.1/go.mod h1:VRgKajOyMVgP/F0L5g3kH7SVskp17vFi2xheb5uMJtg= github.com/libp2p/go-libp2p-secio v0.1.0/go.mod h1:tMJo2w7h3+wN4pgU2LSYeiKPrfqBgkOsdiKK77hE7c8= github.com/libp2p/go-libp2p-secio v0.2.0 h1:ywzZBsWEEz2KNTn5RtzauEDq5RFEefPsttXYwAWqHng= @@ -446,15 +401,11 @@ github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0X github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= -github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/miekg/dns v1.1.12/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= @@ -512,7 +463,6 @@ github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKT github.com/multiformats/go-multihash v0.0.5 h1:1wxmCvTXAifAepIMyF39vZinRw5sbqjPs/UIi93+uik= github.com/multiformats/go-multihash v0.0.5/go.mod h1:lt/HCbqlQwlPBz7lv0sQCdtfcMtlJvakRUn/0Ual8po= github.com/multiformats/go-multihash v0.0.8/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew= -github.com/multiformats/go-multihash v0.0.9/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew= github.com/multiformats/go-multihash v0.0.10/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew= github.com/multiformats/go-multihash v0.0.13 h1:06x+mk/zj1FoMsgNejLpy6QTvJqlSt/BhLEy87zidlc= github.com/multiformats/go-multihash v0.0.13/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc= @@ -540,9 +490,6 @@ github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/otiai10/copy v1.0.2/go.mod h1:c7RpqBkwMom4bYTSkLSym4VSJz/XtncWRAj/J4PEIMY= -github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= -github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -559,17 +506,17 @@ github.com/polydawn/refmt v0.0.0-20190809202753-05966cbd336a h1:hjZfReYVLbqFkAtr github.com/polydawn/refmt v0.0.0-20190809202753-05966cbd336a/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/assertions v1.0.0 h1:UVQPSSmc3qtTi+zPPkCXvZX9VvW/xT/NsRvKfwY81a8= github.com/smartystreets/assertions v1.0.0/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM= +github.com/smartystreets/assertions v1.0.1 h1:voD4ITNjPL5jjBfgR/r8fPIIBrliWrWHeiJApdr3r4w= github.com/smartystreets/assertions v1.0.1/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM= github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa/go.mod h1:2RVY1rIf+2J2o/IM9+vPq9RzmHDSseB7FoXiSNIUsoU= github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a h1:pa8hGb/2YqsZKovtsgrwcDH1RZhVbTKCjLp47XpqCDs= github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 h1:WN9BUFbdyOsSH/XohnWpXOlq9NBD5sGAB2FciQMUEe8= github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/smola/gocompat v0.2.0/go.mod h1:1B0MlxbmoZNo3h8guHp8HztB3BSYR5itql9qtVc0ypY= github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a h1:/eS3yfGjQKG+9kayBkj0ip1BGhq6zJ3eaVksphxAaek= @@ -594,17 +541,12 @@ github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJy github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= -github.com/urfave/cli/v2 v2.0.0/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= github.com/warpfork/go-wish v0.0.0-20180510122957-5ad1f5abf436/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= github.com/warpfork/go-wish v0.0.0-20190328234359-8b3e70f8e830 h1:8kxMKmKzXXL4Ru1nyhvdms/JjWt+3YLpvRb/bAjO/y0= github.com/warpfork/go-wish v0.0.0-20190328234359-8b3e70f8e830/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= github.com/warpfork/go-wish v0.0.0-20200122115046-b9ea61034e4a h1:G++j5e0OC488te356JvdhaM8YS6nMsjLAYF7JxCv07w= github.com/warpfork/go-wish v0.0.0-20200122115046-b9ea61034e4a/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= -github.com/whyrusleeping/cbor-gen v0.0.0-20191212224538-d370462a7e8a/go.mod h1:xdlJQaiqipF0HW+Mzpg7XRM3fWbGvfgFlcppuvlkIvY= -github.com/whyrusleeping/cbor-gen v0.0.0-20191216205031-b047b6acb3c0/go.mod h1:xdlJQaiqipF0HW+Mzpg7XRM3fWbGvfgFlcppuvlkIvY= github.com/whyrusleeping/cbor-gen v0.0.0-20200123233031-1cdf64d27158/go.mod h1:Xj/M2wWU+QdTdRbu/L/1dIZY8/Wb2K9pAhtroQuxJJI= -github.com/whyrusleeping/cbor-gen v0.0.0-20200206220010-03c9665e2a66/go.mod h1:Xj/M2wWU+QdTdRbu/L/1dIZY8/Wb2K9pAhtroQuxJJI= github.com/whyrusleeping/cbor-gen v0.0.0-20200402171437-3d27c146c105 h1:Sh6UG5dW5xW8Ek2CtRGq4ipdEvvx9hOyBJjEGyTYDl0= github.com/whyrusleeping/cbor-gen v0.0.0-20200402171437-3d27c146c105/go.mod h1:Xj/M2wWU+QdTdRbu/L/1dIZY8/Wb2K9pAhtroQuxJJI= github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f h1:jQa4QT2UP9WYv2nzyawpKMOCl+Z/jW7djv2/J50lj9E= @@ -637,6 +579,7 @@ go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.4.0 h1:f3WCSC2KzAcBXGATIxAB1E2XuCpNU255wNKZ505qi3E= go.uber.org/multierr v1.4.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= +go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee h1:0mgffUl7nfd+FpvXMVz4IDEaUSmT1ysygQC7qYo7sG4= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= go.uber.org/zap v1.10.0 h1:ORx85nbTijNz8ljznvCMR1ZBIPKFn3jQrag10X2AsuM= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= @@ -657,7 +600,6 @@ golang.org/x/crypto v0.0.0-20190618222545-ea8f1a30c443 h1:IcSOAf4PyMp3U3XbIEj1/x golang.org/x/crypto v0.0.0-20190618222545-ea8f1a30c443/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200117160349-530e935923ad/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d h1:1ZiEyfaQIg3Qh0EoqpwAakHVhecoE5wlSg5GjnafJGw= golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -665,6 +607,7 @@ golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= @@ -689,7 +632,6 @@ golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180202135801-37707fdb30a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -708,10 +650,7 @@ golang.org/x/sys v0.0.0-20190524122548-abf6ff778158/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190610200419-93c9922d18ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb h1:fgwFCsaw9buMuxNd6+DQfAuSFqbNiQZpcgJQAgJsK6k= golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191210023423-ac6580df4449/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae h1:/WDfKMnPU+m5M4xB+6x4kaepxRw6jWvR5iDRdvjHgy8= @@ -731,6 +670,7 @@ golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3 golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361 h1:RIIXAeV6GvDBuADKumTODatUqANFZ+5BPMnzsy4hulY= golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7 h1:9zdDQZ7Thm29KFXgAX/+yaf3eVbP7djjWp/dXAppNCc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -750,7 +690,6 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/cheggaaa/pb.v1 v1.0.28/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= @@ -763,6 +702,6 @@ gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= From af2cff935423ee7935b8753487d9c7c458aa8df4 Mon Sep 17 00:00:00 2001 From: hannahhoward Date: Tue, 28 Apr 2020 12:24:26 -0700 Subject: [PATCH 3/3] fix(lint): fix lint error --- testutil/testchain.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testutil/testchain.go b/testutil/testchain.go index 7633c258..992f3e34 100644 --- a/testutil/testchain.go +++ b/testutil/testchain.go @@ -71,7 +71,7 @@ func createBlock(parents []ipld.Link, size uint64) (ipld.Node, error) { if err != nil { return nil, err } - mnblnb.Finish() + err = mnblnb.Finish() if err != nil { return nil, err }