From 31ed41086152fde095b352a37e955b420e7a8399 Mon Sep 17 00:00:00 2001 From: Petar Maymounkov Date: Fri, 10 Jun 2022 15:01:24 -0700 Subject: [PATCH 1/5] bump edelweiss dep --- go.mod | 10 +++++----- go.sum | 33 ++++++++++++++++++--------------- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/go.mod b/go.mod index 3fcb910..a637b0f 100644 --- a/go.mod +++ b/go.mod @@ -3,11 +3,11 @@ module github.com/ipfs/go-delegated-routing go 1.17 require ( - github.com/ipfs/go-cid v0.0.7 + github.com/ipfs/go-cid v0.2.0 github.com/ipfs/go-ipns v0.1.2 github.com/ipfs/go-log v1.0.5 - github.com/ipld/edelweiss v0.1.2 - github.com/ipld/go-ipld-prime v0.16.0 + github.com/ipld/edelweiss v0.1.3-0.20220610182123-8f900960562b + github.com/ipld/go-ipld-prime v0.16.1-0.20220607160121-f0c1fdf6c6ad github.com/libp2p/go-libp2p-core v0.9.0 github.com/libp2p/go-libp2p-record v0.1.3 github.com/multiformats/go-multiaddr v0.5.0 @@ -28,7 +28,7 @@ require ( github.com/multiformats/go-base32 v0.0.3 // indirect github.com/multiformats/go-base36 v0.1.0 // indirect github.com/multiformats/go-multibase v0.0.3 // indirect - github.com/multiformats/go-multicodec v0.3.0 // indirect + github.com/multiformats/go-multicodec v0.4.1 // indirect github.com/multiformats/go-varint v0.0.6 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/pkg/errors v0.8.1 // indirect @@ -38,7 +38,7 @@ require ( go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect go.uber.org/zap v1.16.0 // indirect - golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83 // indirect + golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf // indirect golang.org/x/sys v0.0.0-20210309074719-68d13333faf2 // indirect lukechampine.com/blake3 v1.1.6 // indirect ) diff --git a/go.sum b/go.sum index 6268fd8..6d04ff0 100644 --- a/go.sum +++ b/go.sum @@ -32,9 +32,8 @@ github.com/dgraph-io/ristretto v0.0.2/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70d 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/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= -github.com/frankban/quicktest v1.14.0/go.mod h1:NeW+ay9A/U67EYXNFA1nPE8e/tnQv/09mUdL/ijj8og= -github.com/frankban/quicktest v1.14.2 h1:SPb1KFFmM+ybpEjPUhCCkZOM5xlovT5UbrMvWnXyBns= -github.com/frankban/quicktest v1.14.2/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= +github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= +github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= @@ -48,9 +47,9 @@ github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= @@ -64,8 +63,9 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt github.com/ipfs/go-cid v0.0.3/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= github.com/ipfs/go-cid v0.0.4/go.mod h1:4LLaPOQwmk5z9LBgQnpkivrx8BJjUyGwTXCd5Xfj6+M= github.com/ipfs/go-cid v0.0.5/go.mod h1:plgt+Y5MnOey4vO4UlUazGqdbEXuFYitED67FexhXog= -github.com/ipfs/go-cid v0.0.7 h1:ysQJVJA3fNDF1qigJbsSQOdjhVLsOEoPdh0+R97k3jY= github.com/ipfs/go-cid v0.0.7/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqgC/I= +github.com/ipfs/go-cid v0.2.0 h1:01JTiihFq9en9Vz0lc0VDWvZe/uBonGpzo4THP0vcQ0= +github.com/ipfs/go-cid v0.2.0/go.mod h1:P+HXFDF4CVhaVayiEb4wkAy7zBHxBwsJyt0Y5U6MLro= github.com/ipfs/go-datastore v0.4.1/go.mod h1:SX/xMIKoCszPqp+z9JhPYCmoOoXTvaa13XEbGtsFUhA= github.com/ipfs/go-datastore v0.4.4/go.mod h1:SX/xMIKoCszPqp+z9JhPYCmoOoXTvaa13XEbGtsFUhA= github.com/ipfs/go-datastore v0.4.5/go.mod h1:eXTcaaiN6uOlVCLS9GjJUJtlvJfM3xk23w3fyfrmmJs= @@ -82,12 +82,11 @@ github.com/ipfs/go-log v1.0.5/go.mod h1:j0b8ZoR+7+R99LD9jZ6+AJsrzkPbSXbZfGakb5JP github.com/ipfs/go-log/v2 v2.0.5/go.mod h1:eZs4Xt4ZUJQFM3DlanGhy7TkwwawCZcSByscwkWG+dw= github.com/ipfs/go-log/v2 v2.1.3 h1:1iS3IU7aXRlbgUpN8yTTpJ53NXYjAe37vcI5+5nYrzk= github.com/ipfs/go-log/v2 v2.1.3/go.mod h1:/8d0SH3Su5Ooc31QlL1WysJhvyOTDCjcCZ9Axpmri6g= -github.com/ipld/edelweiss v0.1.2 h1:dpcC0V+O4tLgIpLG5E4Lqbpp1N1ytnVnvcHYd1lHfN0= -github.com/ipld/edelweiss v0.1.2/go.mod h1:14NnBVHgrPO8cqDnKg7vc69LGI0aCAcax6mj21+99ec= +github.com/ipld/edelweiss v0.1.3-0.20220610182123-8f900960562b h1:BBXLY3jgC3wR1XjUseYzwRfDylAABR6D6t/cQcaHCjM= +github.com/ipld/edelweiss v0.1.3-0.20220610182123-8f900960562b/go.mod h1:egFT0Za/aOmwj2YeUlJwoi/C4ULZoBiFhXouVIGuoqM= github.com/ipld/go-ipld-prime v0.9.0/go.mod h1:KvBLMr4PX1gWptgkzRjVZCrLmSGcZCb/jioOQwCqZN8= -github.com/ipld/go-ipld-prime v0.14.4-0.20211217152141-008fd70fc96f/go.mod h1:QcE4Y9n/ZZr8Ijg5bGPT0GqYWgZ1704nH0RDcQtgTP0= -github.com/ipld/go-ipld-prime v0.16.0 h1:RS5hhjB/mcpeEPJvfyj0qbOj/QL+/j05heZ0qa97dVo= -github.com/ipld/go-ipld-prime v0.16.0/go.mod h1:axSCuOCBPqrH+gvXr2w9uAOulJqBPhHPT2PjoiiU1qA= +github.com/ipld/go-ipld-prime v0.16.1-0.20220607160121-f0c1fdf6c6ad h1:Ucb+0lclJXzmCFX8Fqawl9AqNlcHWhktuPxOi4zL1ic= +github.com/ipld/go-ipld-prime v0.16.1-0.20220607160121-f0c1fdf6c6ad/go.mod h1:IInaTjkNLKAZoliYXvjlB3CFQa7IPReVwxOb0oke/RA= github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= github.com/jbenet/goprocess v0.1.3/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= @@ -175,8 +174,8 @@ github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/g github.com/multiformats/go-multibase v0.0.3 h1:l/B6bJDQjvQ5G52jw4QGSYeOTZoAwIO77RblWplfIqk= github.com/multiformats/go-multibase v0.0.3/go.mod h1:5+1R4eQrT3PkYZ24C3W2Ue2tPwIdYQD509ZjSb5y9Oc= github.com/multiformats/go-multicodec v0.2.0/go.mod h1:/y4YVwkfMyry5kFbMTbLJKErhycTIftytRV+llXdyS4= -github.com/multiformats/go-multicodec v0.3.0 h1:tstDwfIjiHbnIjeM5Lp+pMrSeN+LCMsEwOrkPmWm03A= -github.com/multiformats/go-multicodec v0.3.0/go.mod h1:qGGaQmioCDh+TeFOnxrbU0DaIPw8yFgAZgFG0V7p1qQ= +github.com/multiformats/go-multicodec v0.4.1 h1:BSJbf+zpghcZMZrwTYBGwy0CPcVZGWiC72Cp8bBd4R4= +github.com/multiformats/go-multicodec v0.4.1/go.mod h1:1Hj/eHRaVWSXiSNNfcEPcwZleTmdNP81xlxDLnWU9GQ= github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= 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= @@ -235,7 +234,7 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 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/warpfork/go-testmark v0.3.0/go.mod h1:jhEf8FVxd+F17juRubpmut64NEG6I2rgkUhlcqqXwE0= +github.com/warpfork/go-testmark v0.10.0/go.mod h1:jhEf8FVxd+F17juRubpmut64NEG6I2rgkUhlcqqXwE0= 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/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= @@ -267,8 +266,9 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83 h1:/ZScEX8SfEmUGRHs0gxpqteO5nfNW6axyZbBdw9A12g= golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf h1:B2n+Zi5QeYRDAEodEu72OS36gmTWjgpXr2+cWcBW90o= +golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= 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= @@ -289,6 +289,7 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -308,9 +309,11 @@ golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210309074719-68d13333faf2 h1:46ULzRKLh1CwgRq2dC5SlBzEqqNCi8rreOZnNrbqcIY= golang.org/x/sys v0.0.0-20210309074719-68d13333faf2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= From eea942648e4f7fb6213fbf0944e8c176f007e77c Mon Sep 17 00:00:00 2001 From: Petar Maymounkov Date: Fri, 10 Jun 2022 15:12:32 -0700 Subject: [PATCH 2/5] bump other deps --- go.mod | 7 +++++-- go.sum | 26 +++++++++++++++++++++++--- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index a637b0f..de4e57d 100644 --- a/go.mod +++ b/go.mod @@ -8,14 +8,17 @@ require ( github.com/ipfs/go-log v1.0.5 github.com/ipld/edelweiss v0.1.3-0.20220610182123-8f900960562b github.com/ipld/go-ipld-prime v0.16.1-0.20220607160121-f0c1fdf6c6ad - github.com/libp2p/go-libp2p-core v0.9.0 + github.com/libp2p/go-libp2p-core v0.16.1 github.com/libp2p/go-libp2p-record v0.1.3 github.com/multiformats/go-multiaddr v0.5.0 github.com/multiformats/go-multihash v0.1.0 ) require ( - github.com/btcsuite/btcd v0.20.1-beta // indirect + github.com/btcsuite/btcd v0.22.1 // indirect + github.com/btcsuite/btcd/btcec/v2 v2.1.3 // indirect + github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/ipfs/go-ipfs-util v0.0.1 // indirect github.com/ipfs/go-log/v2 v2.1.3 // indirect diff --git a/go.sum b/go.sum index 6d04ff0..ab788ed 100644 --- a/go.sum +++ b/go.sum @@ -6,13 +6,22 @@ github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAE github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/btcsuite/btcd v0.0.0-20190824003749-130ea5bddde3/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= -github.com/btcsuite/btcd v0.20.1-beta h1:Ik4hyJqN8Jfyv3S4AGBOmyouMsYE3EdYODkMbQjwPGw= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= +github.com/btcsuite/btcd v0.22.1 h1:CnwP9LM/M9xuRrGSCGeMVs9iv09uMqwsVX7EeIpgV2c= +github.com/btcsuite/btcd v0.22.1/go.mod h1:wqgTSL29+50LRkmOVknEdmt8ZojIzhuWvgu/iptuN7Y= +github.com/btcsuite/btcd/btcec/v2 v2.1.3 h1:xM/n3yIhHAhHy04z4i43C8p4ehixJZMsnrVJkgl+MTE= +github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= +github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce/go.mod h1:0DVlHczLPewLcPGEIeUEzfOJhqGPQ0mJJRDBtD307+o= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= +github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I= github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= +github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= @@ -27,6 +36,11 @@ github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= +github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= +github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= github.com/dgraph-io/badger v1.6.2/go.mod h1:JW2yswe3V058sS0kZ2h/AXeDSqFjxnZcRrVH//y2UQE= github.com/dgraph-io/ristretto v0.0.2/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= @@ -123,8 +137,8 @@ github.com/libp2p/go-flow-metrics v0.0.3/go.mod h1:HeoSNUrOJVK1jEpDqVEiUOIXqhbnS github.com/libp2p/go-libp2p-core v0.2.5/go.mod h1:6+5zJmKhsf7yHn1RbmYDu08qDUpIUxGdqHuEZckmZOA= github.com/libp2p/go-libp2p-core v0.5.3/go.mod h1:uN7L2D4EvPCvzSH5SrhR72UWbnSGpt5/a35Sm4upn4Y= github.com/libp2p/go-libp2p-core v0.8.6/go.mod h1:dgHr0l0hIKfWpGpqAMbpo19pen9wJfdCGv51mTmdpmM= -github.com/libp2p/go-libp2p-core v0.9.0 h1:t97Mv0LIBZlP2FXVRNKKVzHJCIjbIWGxYptGId4+htU= -github.com/libp2p/go-libp2p-core v0.9.0/go.mod h1:ESsbz31oC3C1AvMJoGx26RTuCkNhmkSRCqZ0kQtJ2/8= +github.com/libp2p/go-libp2p-core v0.16.1 h1:bWoiEBqVkpJ13hbv/f69tHODp86t6mvc4fBN4DkK73M= +github.com/libp2p/go-libp2p-core v0.16.1/go.mod h1:O3i/7y+LqUb0N+qhzXjBjjpchgptWAVMG1Voegk7b4c= github.com/libp2p/go-libp2p-peerstore v0.2.8 h1:nJghUlUkFVvyk7ccsM67oFA6kqUkwyCM1G4WPVMCWYA= github.com/libp2p/go-libp2p-peerstore v0.2.8/go.mod h1:gGiPlXdz7mIHd2vfAsHzBNAMqSDkt2UBFwgcITgw1lA= github.com/libp2p/go-libp2p-record v0.1.2/go.mod h1:pal0eNcT5nqZaTV7UGhqeGqxFgGdsU/9W//C8dqjQDk= @@ -166,6 +180,7 @@ github.com/multiformats/go-multiaddr v0.1.1/go.mod h1:aMKBKNEYmzmDmxfX88/vz+J5IU github.com/multiformats/go-multiaddr v0.2.1/go.mod h1:s/Apk6IyxfvMjDafnhJgJ3/46z7tZ04iMk5wP4QMGGE= github.com/multiformats/go-multiaddr v0.2.2/go.mod h1:NtfXiOtHvghW9KojvtySjH5y0u0xW5UouOmQQrn6a3Y= github.com/multiformats/go-multiaddr v0.3.3/go.mod h1:lCKNGP1EQ1eZ35Za2wlqnabm9xQkib3fyB+nZXHLag0= +github.com/multiformats/go-multiaddr v0.4.1/go.mod h1:3afI9HfVW8csiF8UZqtpYRiDyew8pRX7qLIGHu9FLuM= github.com/multiformats/go-multiaddr v0.5.0 h1:i/JuOoVg4szYQ4YEzDGtb2h0o8M7CG/Yq6cGlcjWZpM= github.com/multiformats/go-multiaddr v0.5.0/go.mod h1:3KAxNkUqLTJ20AAwN4XVX4kZar+bR+gh4zgbfr3SNug= github.com/multiformats/go-multiaddr-fmt v0.1.0 h1:WLEFClPycPkp4fnIzoFoV9FVd49/eQsuaL3/CWe167E= @@ -191,6 +206,7 @@ github.com/multiformats/go-varint v0.0.6 h1:gk85QWKxh3TazbLxED/NlDVv8+q+ReFJk7Y2 github.com/multiformats/go-varint v0.0.6/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= @@ -265,6 +281,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf h1:B2n+Zi5QeYRDAEodEu72OS36gmTWjgpXr2+cWcBW90o= @@ -279,6 +297,7 @@ golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKG golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -354,6 +373,7 @@ gopkg.in/src-d/go-log.v1 v1.0.1/go.mod h1:GN34hKP0g305ysm2/hctJ0Y8nWP3zxXXJ8GFab gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= From 6caa5d61bf29fde61148af4221411353b255ef1c Mon Sep 17 00:00:00 2001 From: Petar Maymounkov Date: Mon, 13 Jun 2022 14:02:23 -0700 Subject: [PATCH 3/5] add go:generate --- gen/proto/proto_edelweiss.go | 1652 +++++++++++++++++----------------- gen/routing.go | 1 + 2 files changed, 847 insertions(+), 806 deletions(-) diff --git a/gen/proto/proto_edelweiss.go b/gen/proto/proto_edelweiss.go index 891ec0d..d103156 100644 --- a/gen/proto/proto_edelweiss.go +++ b/gen/proto/proto_edelweiss.go @@ -3,24 +3,24 @@ package proto import ( - pd8 "bytes" - pd6 "context" - pd11 "errors" + pd7 "bytes" + pd9 "context" + pd10 "errors" pd3 "fmt" - pd7 "io" + pd11 "io" pd15 "io/ioutil" pd4 "net/http" - pd5 "net/url" - pd14 "sync" - - pd17 "github.com/ipfs/go-cid" - pd12 "github.com/ipfs/go-log" - pd13 "github.com/ipld/edelweiss/services" - pd2 "github.com/ipld/edelweiss/values" - pd10 "github.com/ipld/go-ipld-prime" - pd9 "github.com/ipld/go-ipld-prime/codec/dagjson" - pd1 "github.com/ipld/go-ipld-prime/datamodel" - pd16 "github.com/ipld/go-ipld-prime/linking/cid" + pd6 "net/url" + pd13 "sync" + + pd16 "github.com/ipfs/go-cid" + pd14 "github.com/ipfs/go-log" + pd12 "github.com/ipld/edelweiss/services" + pd1 "github.com/ipld/edelweiss/values" + pd5 "github.com/ipld/go-ipld-prime" + pd8 "github.com/ipld/go-ipld-prime/codec/dagjson" + pd2 "github.com/ipld/go-ipld-prime/datamodel" + pd17 "github.com/ipld/go-ipld-prime/linking/cid" ) // -- protocol type DelegatedRouting_IdentifyArg -- @@ -28,16 +28,16 @@ import ( type DelegatedRouting_IdentifyArg struct { } -func (x DelegatedRouting_IdentifyArg) Node() pd1.Node { +func (x DelegatedRouting_IdentifyArg) Node() pd2.Node { return x } -func (x *DelegatedRouting_IdentifyArg) Parse(n pd1.Node) error { - if n.Kind() != pd1.Kind_Map { - return pd2.ErrNA +func (x *DelegatedRouting_IdentifyArg) Parse(n pd2.Node) error { + if n.Kind() != pd2.Kind_Map { + return pd1.ErrNA } iter := n.MapIterator() - fieldMap := map[string]pd2.ParseFunc{} + fieldMap := map[string]pd1.ParseFunc{} for !iter.Done() { if kn, vn, err := iter.Next(); err != nil { return err @@ -53,7 +53,7 @@ func (x *DelegatedRouting_IdentifyArg) Parse(n pd1.Node) error { } } for _, fieldParse := range fieldMap { - if err := fieldParse(pd1.Null); err != nil { + if err := fieldParse(pd2.Null); err != nil { return err } } @@ -65,66 +65,66 @@ type DelegatedRouting_IdentifyArg_MapIterator struct { s *DelegatedRouting_IdentifyArg } -func (x *DelegatedRouting_IdentifyArg_MapIterator) Next() (key pd1.Node, value pd1.Node, err error) { +func (x *DelegatedRouting_IdentifyArg_MapIterator) Next() (key pd2.Node, value pd2.Node, err error) { x.i++ switch x.i { } - return nil, nil, pd2.ErrNA + return nil, nil, pd1.ErrNA } func (x *DelegatedRouting_IdentifyArg_MapIterator) Done() bool { return x.i+1 >= 0 } -func (x DelegatedRouting_IdentifyArg) Kind() pd1.Kind { - return pd1.Kind_Map +func (x DelegatedRouting_IdentifyArg) Kind() pd2.Kind { + return pd2.Kind_Map } -func (x DelegatedRouting_IdentifyArg) LookupByString(key string) (pd1.Node, error) { +func (x DelegatedRouting_IdentifyArg) LookupByString(key string) (pd2.Node, error) { switch key { } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x DelegatedRouting_IdentifyArg) LookupByNode(key pd1.Node) (pd1.Node, error) { +func (x DelegatedRouting_IdentifyArg) LookupByNode(key pd2.Node) (pd2.Node, error) { switch key.Kind() { - case pd1.Kind_String: + case pd2.Kind_String: if s, err := key.AsString(); err != nil { return nil, err } else { return x.LookupByString(s) } - case pd1.Kind_Int: + case pd2.Kind_Int: if i, err := key.AsInt(); err != nil { return nil, err } else { return x.LookupByIndex(i) } } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x DelegatedRouting_IdentifyArg) LookupByIndex(idx int64) (pd1.Node, error) { +func (x DelegatedRouting_IdentifyArg) LookupByIndex(idx int64) (pd2.Node, error) { switch idx { } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x DelegatedRouting_IdentifyArg) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { +func (x DelegatedRouting_IdentifyArg) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { switch seg.String() { } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x DelegatedRouting_IdentifyArg) MapIterator() pd1.MapIterator { +func (x DelegatedRouting_IdentifyArg) MapIterator() pd2.MapIterator { return &DelegatedRouting_IdentifyArg_MapIterator{-1, &x} } -func (x DelegatedRouting_IdentifyArg) ListIterator() pd1.ListIterator { +func (x DelegatedRouting_IdentifyArg) ListIterator() pd2.ListIterator { return nil } @@ -141,54 +141,54 @@ func (x DelegatedRouting_IdentifyArg) IsNull() bool { } func (x DelegatedRouting_IdentifyArg) AsBool() (bool, error) { - return false, pd2.ErrNA + return false, pd1.ErrNA } func (x DelegatedRouting_IdentifyArg) AsInt() (int64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (x DelegatedRouting_IdentifyArg) AsFloat() (float64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (x DelegatedRouting_IdentifyArg) AsString() (string, error) { - return "", pd2.ErrNA + return "", pd1.ErrNA } func (x DelegatedRouting_IdentifyArg) AsBytes() ([]byte, error) { - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x DelegatedRouting_IdentifyArg) AsLink() (pd1.Link, error) { - return nil, pd2.ErrNA +func (x DelegatedRouting_IdentifyArg) AsLink() (pd2.Link, error) { + return nil, pd1.ErrNA } -func (x DelegatedRouting_IdentifyArg) Prototype() pd1.NodePrototype { +func (x DelegatedRouting_IdentifyArg) Prototype() pd2.NodePrototype { return nil } // -- protocol type AnonList1 -- -type AnonList1 []pd2.String +type AnonList1 []pd1.String -func (v AnonList1) Node() pd1.Node { +func (v AnonList1) Node() pd2.Node { return v } -func (v *AnonList1) Parse(n pd1.Node) error { - if n.Kind() == pd1.Kind_Null { +func (v *AnonList1) Parse(n pd2.Node) error { + if n.Kind() == pd2.Kind_Null { *v = nil return nil } - if n.Kind() != pd1.Kind_List { - return pd2.ErrNA + if n.Kind() != pd2.Kind_List { + return pd1.ErrNA } else { *v = make(AnonList1, n.Length()) iter := n.ListIterator() for !iter.Done() { if i, n, err := iter.Next(); err != nil { - return pd2.ErrNA + return pd1.ErrNA } else if err = (*v)[i].Parse(n); err != nil { return err } @@ -197,39 +197,39 @@ func (v *AnonList1) Parse(n pd1.Node) error { } } -func (AnonList1) Kind() pd1.Kind { - return pd1.Kind_List +func (AnonList1) Kind() pd2.Kind { + return pd2.Kind_List } -func (AnonList1) LookupByString(string) (pd1.Node, error) { - return nil, pd2.ErrNA +func (AnonList1) LookupByString(string) (pd2.Node, error) { + return nil, pd1.ErrNA } -func (AnonList1) LookupByNode(key pd1.Node) (pd1.Node, error) { - return nil, pd2.ErrNA +func (AnonList1) LookupByNode(key pd2.Node) (pd2.Node, error) { + return nil, pd1.ErrNA } -func (v AnonList1) LookupByIndex(i int64) (pd1.Node, error) { +func (v AnonList1) LookupByIndex(i int64) (pd2.Node, error) { if i < 0 || i >= v.Length() { - return nil, pd2.ErrBounds + return nil, pd1.ErrBounds } else { return v[i].Node(), nil } } -func (v AnonList1) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { +func (v AnonList1) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { if i, err := seg.Index(); err != nil { - return nil, pd2.ErrNA + return nil, pd1.ErrNA } else { return v.LookupByIndex(i) } } -func (AnonList1) MapIterator() pd1.MapIterator { +func (AnonList1) MapIterator() pd2.MapIterator { return nil } -func (v AnonList1) ListIterator() pd1.ListIterator { +func (v AnonList1) ListIterator() pd2.ListIterator { return &AnonList1_ListIterator{v, 0} } @@ -246,30 +246,30 @@ func (AnonList1) IsNull() bool { } func (v AnonList1) AsBool() (bool, error) { - return false, pd2.ErrNA + return false, pd1.ErrNA } func (AnonList1) AsInt() (int64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (AnonList1) AsFloat() (float64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (AnonList1) AsString() (string, error) { - return "", pd2.ErrNA + return "", pd1.ErrNA } func (AnonList1) AsBytes() ([]byte, error) { - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (AnonList1) AsLink() (pd1.Link, error) { - return nil, pd2.ErrNA +func (AnonList1) AsLink() (pd2.Link, error) { + return nil, pd1.ErrNA } -func (AnonList1) Prototype() pd1.NodePrototype { +func (AnonList1) Prototype() pd2.NodePrototype { return nil // not needed } @@ -278,9 +278,9 @@ type AnonList1_ListIterator struct { at int64 } -func (iter *AnonList1_ListIterator) Next() (int64, pd1.Node, error) { +func (iter *AnonList1_ListIterator) Next() (int64, pd2.Node, error) { if iter.Done() { - return -1, nil, pd2.ErrBounds + return -1, nil, pd1.ErrBounds } v := iter.list[iter.at] i := int64(iter.at) @@ -298,16 +298,16 @@ type DelegatedRouting_IdentifyResult struct { Methods AnonList1 } -func (x DelegatedRouting_IdentifyResult) Node() pd1.Node { +func (x DelegatedRouting_IdentifyResult) Node() pd2.Node { return x } -func (x *DelegatedRouting_IdentifyResult) Parse(n pd1.Node) error { - if n.Kind() != pd1.Kind_Map { - return pd2.ErrNA +func (x *DelegatedRouting_IdentifyResult) Parse(n pd2.Node) error { + if n.Kind() != pd2.Kind_Map { + return pd1.ErrNA } iter := n.MapIterator() - fieldMap := map[string]pd2.ParseFunc{ + fieldMap := map[string]pd1.ParseFunc{ "Methods": x.Methods.Parse, } for !iter.Done() { @@ -333,7 +333,7 @@ func (x *DelegatedRouting_IdentifyResult) Parse(n pd1.Node) error { } } for _, fieldParse := range fieldMap { - if err := fieldParse(pd1.Null); err != nil { + if err := fieldParse(pd2.Null); err != nil { return err } } @@ -345,74 +345,74 @@ type DelegatedRouting_IdentifyResult_MapIterator struct { s *DelegatedRouting_IdentifyResult } -func (x *DelegatedRouting_IdentifyResult_MapIterator) Next() (key pd1.Node, value pd1.Node, err error) { +func (x *DelegatedRouting_IdentifyResult_MapIterator) Next() (key pd2.Node, value pd2.Node, err error) { x.i++ switch x.i { case 0: - return pd2.String("Methods"), x.s.Methods.Node(), nil + return pd1.String("Methods"), x.s.Methods.Node(), nil } - return nil, nil, pd2.ErrNA + return nil, nil, pd1.ErrNA } func (x *DelegatedRouting_IdentifyResult_MapIterator) Done() bool { return x.i+1 >= 1 } -func (x DelegatedRouting_IdentifyResult) Kind() pd1.Kind { - return pd1.Kind_Map +func (x DelegatedRouting_IdentifyResult) Kind() pd2.Kind { + return pd2.Kind_Map } -func (x DelegatedRouting_IdentifyResult) LookupByString(key string) (pd1.Node, error) { +func (x DelegatedRouting_IdentifyResult) LookupByString(key string) (pd2.Node, error) { switch key { case "Methods": return x.Methods.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x DelegatedRouting_IdentifyResult) LookupByNode(key pd1.Node) (pd1.Node, error) { +func (x DelegatedRouting_IdentifyResult) LookupByNode(key pd2.Node) (pd2.Node, error) { switch key.Kind() { - case pd1.Kind_String: + case pd2.Kind_String: if s, err := key.AsString(); err != nil { return nil, err } else { return x.LookupByString(s) } - case pd1.Kind_Int: + case pd2.Kind_Int: if i, err := key.AsInt(); err != nil { return nil, err } else { return x.LookupByIndex(i) } } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x DelegatedRouting_IdentifyResult) LookupByIndex(idx int64) (pd1.Node, error) { +func (x DelegatedRouting_IdentifyResult) LookupByIndex(idx int64) (pd2.Node, error) { switch idx { case 0: return x.Methods.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x DelegatedRouting_IdentifyResult) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { +func (x DelegatedRouting_IdentifyResult) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { switch seg.String() { case "0", "Methods": return x.Methods.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x DelegatedRouting_IdentifyResult) MapIterator() pd1.MapIterator { +func (x DelegatedRouting_IdentifyResult) MapIterator() pd2.MapIterator { return &DelegatedRouting_IdentifyResult_MapIterator{-1, &x} } -func (x DelegatedRouting_IdentifyResult) ListIterator() pd1.ListIterator { +func (x DelegatedRouting_IdentifyResult) ListIterator() pd2.ListIterator { return nil } @@ -429,49 +429,49 @@ func (x DelegatedRouting_IdentifyResult) IsNull() bool { } func (x DelegatedRouting_IdentifyResult) AsBool() (bool, error) { - return false, pd2.ErrNA + return false, pd1.ErrNA } func (x DelegatedRouting_IdentifyResult) AsInt() (int64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (x DelegatedRouting_IdentifyResult) AsFloat() (float64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (x DelegatedRouting_IdentifyResult) AsString() (string, error) { - return "", pd2.ErrNA + return "", pd1.ErrNA } func (x DelegatedRouting_IdentifyResult) AsBytes() ([]byte, error) { - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x DelegatedRouting_IdentifyResult) AsLink() (pd1.Link, error) { - return nil, pd2.ErrNA +func (x DelegatedRouting_IdentifyResult) AsLink() (pd2.Link, error) { + return nil, pd1.ErrNA } -func (x DelegatedRouting_IdentifyResult) Prototype() pd1.NodePrototype { +func (x DelegatedRouting_IdentifyResult) Prototype() pd2.NodePrototype { return nil } // -- protocol type DelegatedRouting_Error -- type DelegatedRouting_Error struct { - Code pd2.String + Code pd1.String } -func (x DelegatedRouting_Error) Node() pd1.Node { +func (x DelegatedRouting_Error) Node() pd2.Node { return x } -func (x *DelegatedRouting_Error) Parse(n pd1.Node) error { - if n.Kind() != pd1.Kind_Map { - return pd2.ErrNA +func (x *DelegatedRouting_Error) Parse(n pd2.Node) error { + if n.Kind() != pd2.Kind_Map { + return pd1.ErrNA } iter := n.MapIterator() - fieldMap := map[string]pd2.ParseFunc{ + fieldMap := map[string]pd1.ParseFunc{ "Code": x.Code.Parse, } for !iter.Done() { @@ -497,7 +497,7 @@ func (x *DelegatedRouting_Error) Parse(n pd1.Node) error { } } for _, fieldParse := range fieldMap { - if err := fieldParse(pd1.Null); err != nil { + if err := fieldParse(pd2.Null); err != nil { return err } } @@ -509,74 +509,74 @@ type DelegatedRouting_Error_MapIterator struct { s *DelegatedRouting_Error } -func (x *DelegatedRouting_Error_MapIterator) Next() (key pd1.Node, value pd1.Node, err error) { +func (x *DelegatedRouting_Error_MapIterator) Next() (key pd2.Node, value pd2.Node, err error) { x.i++ switch x.i { case 0: - return pd2.String("Code"), x.s.Code.Node(), nil + return pd1.String("Code"), x.s.Code.Node(), nil } - return nil, nil, pd2.ErrNA + return nil, nil, pd1.ErrNA } func (x *DelegatedRouting_Error_MapIterator) Done() bool { return x.i+1 >= 1 } -func (x DelegatedRouting_Error) Kind() pd1.Kind { - return pd1.Kind_Map +func (x DelegatedRouting_Error) Kind() pd2.Kind { + return pd2.Kind_Map } -func (x DelegatedRouting_Error) LookupByString(key string) (pd1.Node, error) { +func (x DelegatedRouting_Error) LookupByString(key string) (pd2.Node, error) { switch key { case "Code": return x.Code.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x DelegatedRouting_Error) LookupByNode(key pd1.Node) (pd1.Node, error) { +func (x DelegatedRouting_Error) LookupByNode(key pd2.Node) (pd2.Node, error) { switch key.Kind() { - case pd1.Kind_String: + case pd2.Kind_String: if s, err := key.AsString(); err != nil { return nil, err } else { return x.LookupByString(s) } - case pd1.Kind_Int: + case pd2.Kind_Int: if i, err := key.AsInt(); err != nil { return nil, err } else { return x.LookupByIndex(i) } } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x DelegatedRouting_Error) LookupByIndex(idx int64) (pd1.Node, error) { +func (x DelegatedRouting_Error) LookupByIndex(idx int64) (pd2.Node, error) { switch idx { case 0: return x.Code.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x DelegatedRouting_Error) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { +func (x DelegatedRouting_Error) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { switch seg.String() { case "0", "Code": return x.Code.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x DelegatedRouting_Error) MapIterator() pd1.MapIterator { +func (x DelegatedRouting_Error) MapIterator() pd2.MapIterator { return &DelegatedRouting_Error_MapIterator{-1, &x} } -func (x DelegatedRouting_Error) ListIterator() pd1.ListIterator { +func (x DelegatedRouting_Error) ListIterator() pd2.ListIterator { return nil } @@ -593,30 +593,30 @@ func (x DelegatedRouting_Error) IsNull() bool { } func (x DelegatedRouting_Error) AsBool() (bool, error) { - return false, pd2.ErrNA + return false, pd1.ErrNA } func (x DelegatedRouting_Error) AsInt() (int64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (x DelegatedRouting_Error) AsFloat() (float64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (x DelegatedRouting_Error) AsString() (string, error) { - return "", pd2.ErrNA + return "", pd1.ErrNA } func (x DelegatedRouting_Error) AsBytes() ([]byte, error) { - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x DelegatedRouting_Error) AsLink() (pd1.Link, error) { - return nil, pd2.ErrNA +func (x DelegatedRouting_Error) AsLink() (pd2.Link, error) { + return nil, pd1.ErrNA } -func (x DelegatedRouting_Error) Prototype() pd1.NodePrototype { +func (x DelegatedRouting_Error) Prototype() pd2.NodePrototype { return nil } @@ -629,10 +629,10 @@ type AnonInductive4 struct { PutIPNS *PutIPNSRequest } -func (x *AnonInductive4) Parse(n pd1.Node) error { +func (x *AnonInductive4) Parse(n pd2.Node) error { *x = AnonInductive4{} - if n.Kind() != pd1.Kind_Map { - return pd2.ErrNA + if n.Kind() != pd2.Kind_Map { + return pd1.ErrNA } iter := n.MapIterator() kn, vn, err := iter.Next() @@ -684,20 +684,20 @@ type AnonInductive4_MapIterator struct { s *AnonInductive4 } -func (x *AnonInductive4_MapIterator) Next() (key pd1.Node, value pd1.Node, err error) { +func (x *AnonInductive4_MapIterator) Next() (key pd2.Node, value pd2.Node, err error) { if x.done { - return nil, nil, pd2.ErrNA + return nil, nil, pd1.ErrNA } else { x.done = true switch { case x.s.Identify != nil: - return pd2.String("IdentifyRequest"), x.s.Identify.Node(), nil + return pd1.String("IdentifyRequest"), x.s.Identify.Node(), nil case x.s.FindProviders != nil: - return pd2.String("FindProvidersRequest"), x.s.FindProviders.Node(), nil + return pd1.String("FindProvidersRequest"), x.s.FindProviders.Node(), nil case x.s.GetIPNS != nil: - return pd2.String("GetIPNSRequest"), x.s.GetIPNS.Node(), nil + return pd1.String("GetIPNSRequest"), x.s.GetIPNS.Node(), nil case x.s.PutIPNS != nil: - return pd2.String("PutIPNSRequest"), x.s.PutIPNS.Node(), nil + return pd1.String("PutIPNSRequest"), x.s.PutIPNS.Node(), nil default: return nil, nil, pd3.Errorf("no inductive cases are set") @@ -709,15 +709,15 @@ func (x *AnonInductive4_MapIterator) Done() bool { return x.done } -func (x AnonInductive4) Node() pd1.Node { +func (x AnonInductive4) Node() pd2.Node { return x } -func (x AnonInductive4) Kind() pd1.Kind { - return pd1.Kind_Map +func (x AnonInductive4) Kind() pd2.Kind { + return pd2.Kind_Map } -func (x AnonInductive4) LookupByString(key string) (pd1.Node, error) { +func (x AnonInductive4) LookupByString(key string) (pd2.Node, error) { switch { case x.Identify != nil && key == "IdentifyRequest": return x.Identify.Node(), nil @@ -729,12 +729,12 @@ func (x AnonInductive4) LookupByString(key string) (pd1.Node, error) { return x.PutIPNS.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x AnonInductive4) LookupByNode(key pd1.Node) (pd1.Node, error) { - if key.Kind() != pd1.Kind_String { - return nil, pd2.ErrNA +func (x AnonInductive4) LookupByNode(key pd2.Node) (pd2.Node, error) { + if key.Kind() != pd2.Kind_String { + return nil, pd1.ErrNA } if s, err := key.AsString(); err != nil { return nil, err @@ -743,11 +743,11 @@ func (x AnonInductive4) LookupByNode(key pd1.Node) (pd1.Node, error) { } } -func (x AnonInductive4) LookupByIndex(idx int64) (pd1.Node, error) { - return nil, pd2.ErrNA +func (x AnonInductive4) LookupByIndex(idx int64) (pd2.Node, error) { + return nil, pd1.ErrNA } -func (x AnonInductive4) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { +func (x AnonInductive4) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { switch seg.String() { case "IdentifyRequest": return x.Identify.Node(), nil @@ -759,14 +759,14 @@ func (x AnonInductive4) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { return x.PutIPNS.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x AnonInductive4) MapIterator() pd1.MapIterator { +func (x AnonInductive4) MapIterator() pd2.MapIterator { return &AnonInductive4_MapIterator{false, &x} } -func (x AnonInductive4) ListIterator() pd1.ListIterator { +func (x AnonInductive4) ListIterator() pd2.ListIterator { return nil } @@ -783,30 +783,30 @@ func (x AnonInductive4) IsNull() bool { } func (x AnonInductive4) AsBool() (bool, error) { - return false, pd2.ErrNA + return false, pd1.ErrNA } func (x AnonInductive4) AsInt() (int64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (x AnonInductive4) AsFloat() (float64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (x AnonInductive4) AsString() (string, error) { - return "", pd2.ErrNA + return "", pd1.ErrNA } func (x AnonInductive4) AsBytes() ([]byte, error) { - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x AnonInductive4) AsLink() (pd1.Link, error) { - return nil, pd2.ErrNA +func (x AnonInductive4) AsLink() (pd2.Link, error) { + return nil, pd1.ErrNA } -func (x AnonInductive4) Prototype() pd1.NodePrototype { +func (x AnonInductive4) Prototype() pd2.NodePrototype { return nil } @@ -820,10 +820,10 @@ type AnonInductive5 struct { Error *DelegatedRouting_Error } -func (x *AnonInductive5) Parse(n pd1.Node) error { +func (x *AnonInductive5) Parse(n pd2.Node) error { *x = AnonInductive5{} - if n.Kind() != pd1.Kind_Map { - return pd2.ErrNA + if n.Kind() != pd2.Kind_Map { + return pd1.ErrNA } iter := n.MapIterator() kn, vn, err := iter.Next() @@ -882,22 +882,22 @@ type AnonInductive5_MapIterator struct { s *AnonInductive5 } -func (x *AnonInductive5_MapIterator) Next() (key pd1.Node, value pd1.Node, err error) { +func (x *AnonInductive5_MapIterator) Next() (key pd2.Node, value pd2.Node, err error) { if x.done { - return nil, nil, pd2.ErrNA + return nil, nil, pd1.ErrNA } else { x.done = true switch { case x.s.Identify != nil: - return pd2.String("IdentifyResponse"), x.s.Identify.Node(), nil + return pd1.String("IdentifyResponse"), x.s.Identify.Node(), nil case x.s.FindProviders != nil: - return pd2.String("FindProvidersResponse"), x.s.FindProviders.Node(), nil + return pd1.String("FindProvidersResponse"), x.s.FindProviders.Node(), nil case x.s.GetIPNS != nil: - return pd2.String("GetIPNSResponse"), x.s.GetIPNS.Node(), nil + return pd1.String("GetIPNSResponse"), x.s.GetIPNS.Node(), nil case x.s.PutIPNS != nil: - return pd2.String("PutIPNSResponse"), x.s.PutIPNS.Node(), nil + return pd1.String("PutIPNSResponse"), x.s.PutIPNS.Node(), nil case x.s.Error != nil: - return pd2.String("Error"), x.s.Error.Node(), nil + return pd1.String("Error"), x.s.Error.Node(), nil default: return nil, nil, pd3.Errorf("no inductive cases are set") @@ -909,15 +909,15 @@ func (x *AnonInductive5_MapIterator) Done() bool { return x.done } -func (x AnonInductive5) Node() pd1.Node { +func (x AnonInductive5) Node() pd2.Node { return x } -func (x AnonInductive5) Kind() pd1.Kind { - return pd1.Kind_Map +func (x AnonInductive5) Kind() pd2.Kind { + return pd2.Kind_Map } -func (x AnonInductive5) LookupByString(key string) (pd1.Node, error) { +func (x AnonInductive5) LookupByString(key string) (pd2.Node, error) { switch { case x.Identify != nil && key == "IdentifyResponse": return x.Identify.Node(), nil @@ -931,12 +931,12 @@ func (x AnonInductive5) LookupByString(key string) (pd1.Node, error) { return x.Error.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x AnonInductive5) LookupByNode(key pd1.Node) (pd1.Node, error) { - if key.Kind() != pd1.Kind_String { - return nil, pd2.ErrNA +func (x AnonInductive5) LookupByNode(key pd2.Node) (pd2.Node, error) { + if key.Kind() != pd2.Kind_String { + return nil, pd1.ErrNA } if s, err := key.AsString(); err != nil { return nil, err @@ -945,11 +945,11 @@ func (x AnonInductive5) LookupByNode(key pd1.Node) (pd1.Node, error) { } } -func (x AnonInductive5) LookupByIndex(idx int64) (pd1.Node, error) { - return nil, pd2.ErrNA +func (x AnonInductive5) LookupByIndex(idx int64) (pd2.Node, error) { + return nil, pd1.ErrNA } -func (x AnonInductive5) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { +func (x AnonInductive5) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { switch seg.String() { case "IdentifyResponse": return x.Identify.Node(), nil @@ -963,14 +963,14 @@ func (x AnonInductive5) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { return x.Error.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x AnonInductive5) MapIterator() pd1.MapIterator { +func (x AnonInductive5) MapIterator() pd2.MapIterator { return &AnonInductive5_MapIterator{false, &x} } -func (x AnonInductive5) ListIterator() pd1.ListIterator { +func (x AnonInductive5) ListIterator() pd2.ListIterator { return nil } @@ -987,51 +987,51 @@ func (x AnonInductive5) IsNull() bool { } func (x AnonInductive5) AsBool() (bool, error) { - return false, pd2.ErrNA + return false, pd1.ErrNA } func (x AnonInductive5) AsInt() (int64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (x AnonInductive5) AsFloat() (float64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (x AnonInductive5) AsString() (string, error) { - return "", pd2.ErrNA + return "", pd1.ErrNA } func (x AnonInductive5) AsBytes() ([]byte, error) { - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x AnonInductive5) AsLink() (pd1.Link, error) { - return nil, pd2.ErrNA +func (x AnonInductive5) AsLink() (pd2.Link, error) { + return nil, pd1.ErrNA } -func (x AnonInductive5) Prototype() pd1.NodePrototype { +func (x AnonInductive5) Prototype() pd2.NodePrototype { return nil } -var logger_client_DelegatedRouting = pd12.Logger("service/client/delegatedrouting") +var logger_client_DelegatedRouting = pd14.Logger("service/client/delegatedrouting") type DelegatedRouting_Client interface { - Identify(ctx pd6.Context, req *DelegatedRouting_IdentifyArg) ([]*DelegatedRouting_IdentifyResult, error) + Identify(ctx pd9.Context, req *DelegatedRouting_IdentifyArg) ([]*DelegatedRouting_IdentifyResult, error) - FindProviders(ctx pd6.Context, req *FindProvidersRequest) ([]*FindProvidersResponse, error) + FindProviders(ctx pd9.Context, req *FindProvidersRequest) ([]*FindProvidersResponse, error) - GetIPNS(ctx pd6.Context, req *GetIPNSRequest) ([]*GetIPNSResponse, error) + GetIPNS(ctx pd9.Context, req *GetIPNSRequest) ([]*GetIPNSResponse, error) - PutIPNS(ctx pd6.Context, req *PutIPNSRequest) ([]*PutIPNSResponse, error) + PutIPNS(ctx pd9.Context, req *PutIPNSRequest) ([]*PutIPNSResponse, error) - Identify_Async(ctx pd6.Context, req *DelegatedRouting_IdentifyArg) (<-chan DelegatedRouting_Identify_AsyncResult, error) + Identify_Async(ctx pd9.Context, req *DelegatedRouting_IdentifyArg) (<-chan DelegatedRouting_Identify_AsyncResult, error) - FindProviders_Async(ctx pd6.Context, req *FindProvidersRequest) (<-chan DelegatedRouting_FindProviders_AsyncResult, error) + FindProviders_Async(ctx pd9.Context, req *FindProvidersRequest) (<-chan DelegatedRouting_FindProviders_AsyncResult, error) - GetIPNS_Async(ctx pd6.Context, req *GetIPNSRequest) (<-chan DelegatedRouting_GetIPNS_AsyncResult, error) + GetIPNS_Async(ctx pd9.Context, req *GetIPNSRequest) (<-chan DelegatedRouting_GetIPNS_AsyncResult, error) - PutIPNS_Async(ctx pd6.Context, req *PutIPNSRequest) (<-chan DelegatedRouting_PutIPNS_AsyncResult, error) + PutIPNS_Async(ctx pd9.Context, req *PutIPNSRequest) (<-chan DelegatedRouting_PutIPNS_AsyncResult, error) } type DelegatedRouting_Identify_AsyncResult struct { @@ -1058,8 +1058,8 @@ type DelegatedRouting_ClientOption func(*client_DelegatedRouting) error type client_DelegatedRouting struct { httpClient *pd4.Client - endpoint *pd5.URL - ulk pd14.Mutex + endpoint *pd6.URL + ulk pd13.Mutex unsupported map[string]bool // cache of methods not supported by server } @@ -1071,7 +1071,7 @@ func DelegatedRouting_Client_WithHTTPClient(hc *pd4.Client) DelegatedRouting_Cli } func New_DelegatedRouting_Client(endpoint string, opts ...DelegatedRouting_ClientOption) (*client_DelegatedRouting, error) { - u, err := pd5.Parse(endpoint) + u, err := pd6.Parse(endpoint) if err != nil { return nil, err } @@ -1084,8 +1084,8 @@ func New_DelegatedRouting_Client(endpoint string, opts ...DelegatedRouting_Clien return c, nil } -func (c *client_DelegatedRouting) Identify(ctx pd6.Context, req *DelegatedRouting_IdentifyArg) ([]*DelegatedRouting_IdentifyResult, error) { - ctx, cancel := pd6.WithCancel(ctx) +func (c *client_DelegatedRouting) Identify(ctx pd9.Context, req *DelegatedRouting_IdentifyArg) ([]*DelegatedRouting_IdentifyResult, error) { + ctx, cancel := pd9.WithCancel(ctx) defer cancel() ch, err := c.Identify_Async(ctx, req) if err != nil { @@ -1113,27 +1113,27 @@ func (c *client_DelegatedRouting) Identify(ctx pd6.Context, req *DelegatedRoutin } } -func (c *client_DelegatedRouting) Identify_Async(ctx pd6.Context, req *DelegatedRouting_IdentifyArg) (<-chan DelegatedRouting_Identify_AsyncResult, error) { +func (c *client_DelegatedRouting) Identify_Async(ctx pd9.Context, req *DelegatedRouting_IdentifyArg) (<-chan DelegatedRouting_Identify_AsyncResult, error) { // check if we have memoized that this method is not supported by the server c.ulk.Lock() notSupported := c.unsupported["Identify"] c.ulk.Unlock() if notSupported { - return nil, pd13.ErrSchema + return nil, pd12.ErrSchema } envelope := &AnonInductive4{ Identify: req, } - buf, err := pd10.Encode(envelope, pd9.Encode) + buf, err := pd5.Encode(envelope, pd8.Encode) if err != nil { return nil, pd3.Errorf("unexpected serialization error (%v)", err) } // encode request in URL u := *c.endpoint - httpReq, err := pd4.NewRequestWithContext(ctx, "POST", u.String(), pd8.NewReader(buf)) + httpReq, err := pd4.NewRequestWithContext(ctx, "POST", u.String(), pd7.NewReader(buf)) if err != nil { return nil, err } @@ -1155,7 +1155,7 @@ func (c *client_DelegatedRouting) Identify_Async(ctx pd6.Context, req *Delegated c.ulk.Lock() c.unsupported["Identify"] = true c.ulk.Unlock() - return nil, pd13.ErrSchema + return nil, pd12.ErrSchema } // HTTP codes other than 200 correspond to service implementation rejecting the call when it is received // for reasons unrelated to protocol schema @@ -1163,7 +1163,7 @@ func (c *client_DelegatedRouting) Identify_Async(ctx pd6.Context, req *Delegated resp.Body.Close() if resp.Header != nil { if errValues, ok := resp.Header["Error"]; ok && len(errValues) == 1 { - err = pd13.ErrService{Cause: pd3.Errorf("%s", errValues[0])} + err = pd12.ErrService{Cause: pd3.Errorf("%s", errValues[0])} } else { err = pd3.Errorf("service rejected the call, no cause provided") } @@ -1178,29 +1178,39 @@ func (c *client_DelegatedRouting) Identify_Async(ctx pd6.Context, req *Delegated return ch, nil } -func process_DelegatedRouting_Identify_AsyncResult(ctx pd6.Context, ch chan<- DelegatedRouting_Identify_AsyncResult, r pd7.ReadCloser) { +func process_DelegatedRouting_Identify_AsyncResult(ctx pd9.Context, ch chan<- DelegatedRouting_Identify_AsyncResult, r pd11.ReadCloser) { defer close(ch) defer r.Close() + opt := pd8.DecodeOptions{ + ParseLinks: true, + ParseBytes: true, + DontParseBeyondEnd: true, + } for { var out DelegatedRouting_Identify_AsyncResult - n, err := pd10.DecodeStreaming(r, pd9.Decode) - if pd11.Is(err, pd7.EOF) || pd11.Is(err, pd7.ErrUnexpectedEOF) { + n, err := pd5.DecodeStreaming(r, opt.Decode) + if pd10.Is(err, pd11.EOF) || pd10.Is(err, pd11.ErrUnexpectedEOF) { return } if err != nil { - out = DelegatedRouting_Identify_AsyncResult{Err: pd13.ErrProto{Cause: err}} // IPLD decode error + out = DelegatedRouting_Identify_AsyncResult{Err: pd12.ErrProto{Cause: err}} // IPLD decode error } else { - env := &AnonInductive5{} - if err = env.Parse(n); err != nil { - out = DelegatedRouting_Identify_AsyncResult{Err: pd13.ErrProto{Cause: err}} // schema decode error - } else if env.Error != nil { - out = DelegatedRouting_Identify_AsyncResult{Err: pd13.ErrService{Cause: pd11.New(string(env.Error.Code))}} // service-level error - } else if env.Identify != nil { - out = DelegatedRouting_Identify_AsyncResult{Resp: env.Identify} + var x [1]byte + if k, err := r.Read(x[:]); k != 1 || x[0] != '\n' { + out = DelegatedRouting_Identify_AsyncResult{Err: pd12.ErrProto{Cause: pd3.Errorf("missing new line after result: err (%v), read (%d), char (%q)", err, k, string(x[:]))}} // Edelweiss decode error } else { - continue + env := &AnonInductive5{} + if err = env.Parse(n); err != nil { + out = DelegatedRouting_Identify_AsyncResult{Err: pd12.ErrProto{Cause: err}} // schema decode error + } else if env.Error != nil { + out = DelegatedRouting_Identify_AsyncResult{Err: pd12.ErrService{Cause: pd10.New(string(env.Error.Code))}} // service-level error + } else if env.Identify != nil { + out = DelegatedRouting_Identify_AsyncResult{Resp: env.Identify} + } else { + continue + } } } @@ -1212,8 +1222,8 @@ func process_DelegatedRouting_Identify_AsyncResult(ctx pd6.Context, ch chan<- De } } -func (c *client_DelegatedRouting) FindProviders(ctx pd6.Context, req *FindProvidersRequest) ([]*FindProvidersResponse, error) { - ctx, cancel := pd6.WithCancel(ctx) +func (c *client_DelegatedRouting) FindProviders(ctx pd9.Context, req *FindProvidersRequest) ([]*FindProvidersResponse, error) { + ctx, cancel := pd9.WithCancel(ctx) defer cancel() ch, err := c.FindProviders_Async(ctx, req) if err != nil { @@ -1241,27 +1251,27 @@ func (c *client_DelegatedRouting) FindProviders(ctx pd6.Context, req *FindProvid } } -func (c *client_DelegatedRouting) FindProviders_Async(ctx pd6.Context, req *FindProvidersRequest) (<-chan DelegatedRouting_FindProviders_AsyncResult, error) { +func (c *client_DelegatedRouting) FindProviders_Async(ctx pd9.Context, req *FindProvidersRequest) (<-chan DelegatedRouting_FindProviders_AsyncResult, error) { // check if we have memoized that this method is not supported by the server c.ulk.Lock() notSupported := c.unsupported["FindProviders"] c.ulk.Unlock() if notSupported { - return nil, pd13.ErrSchema + return nil, pd12.ErrSchema } envelope := &AnonInductive4{ FindProviders: req, } - buf, err := pd10.Encode(envelope, pd9.Encode) + buf, err := pd5.Encode(envelope, pd8.Encode) if err != nil { return nil, pd3.Errorf("unexpected serialization error (%v)", err) } // encode request in URL u := *c.endpoint - httpReq, err := pd4.NewRequestWithContext(ctx, "POST", u.String(), pd8.NewReader(buf)) + httpReq, err := pd4.NewRequestWithContext(ctx, "POST", u.String(), pd7.NewReader(buf)) if err != nil { return nil, err } @@ -1283,7 +1293,7 @@ func (c *client_DelegatedRouting) FindProviders_Async(ctx pd6.Context, req *Find c.ulk.Lock() c.unsupported["FindProviders"] = true c.ulk.Unlock() - return nil, pd13.ErrSchema + return nil, pd12.ErrSchema } // HTTP codes other than 200 correspond to service implementation rejecting the call when it is received // for reasons unrelated to protocol schema @@ -1291,7 +1301,7 @@ func (c *client_DelegatedRouting) FindProviders_Async(ctx pd6.Context, req *Find resp.Body.Close() if resp.Header != nil { if errValues, ok := resp.Header["Error"]; ok && len(errValues) == 1 { - err = pd13.ErrService{Cause: pd3.Errorf("%s", errValues[0])} + err = pd12.ErrService{Cause: pd3.Errorf("%s", errValues[0])} } else { err = pd3.Errorf("service rejected the call, no cause provided") } @@ -1306,29 +1316,39 @@ func (c *client_DelegatedRouting) FindProviders_Async(ctx pd6.Context, req *Find return ch, nil } -func process_DelegatedRouting_FindProviders_AsyncResult(ctx pd6.Context, ch chan<- DelegatedRouting_FindProviders_AsyncResult, r pd7.ReadCloser) { +func process_DelegatedRouting_FindProviders_AsyncResult(ctx pd9.Context, ch chan<- DelegatedRouting_FindProviders_AsyncResult, r pd11.ReadCloser) { defer close(ch) defer r.Close() + opt := pd8.DecodeOptions{ + ParseLinks: true, + ParseBytes: true, + DontParseBeyondEnd: true, + } for { var out DelegatedRouting_FindProviders_AsyncResult - n, err := pd10.DecodeStreaming(r, pd9.Decode) - if pd11.Is(err, pd7.EOF) || pd11.Is(err, pd7.ErrUnexpectedEOF) { + n, err := pd5.DecodeStreaming(r, opt.Decode) + if pd10.Is(err, pd11.EOF) || pd10.Is(err, pd11.ErrUnexpectedEOF) { return } if err != nil { - out = DelegatedRouting_FindProviders_AsyncResult{Err: pd13.ErrProto{Cause: err}} // IPLD decode error + out = DelegatedRouting_FindProviders_AsyncResult{Err: pd12.ErrProto{Cause: err}} // IPLD decode error } else { - env := &AnonInductive5{} - if err = env.Parse(n); err != nil { - out = DelegatedRouting_FindProviders_AsyncResult{Err: pd13.ErrProto{Cause: err}} // schema decode error - } else if env.Error != nil { - out = DelegatedRouting_FindProviders_AsyncResult{Err: pd13.ErrService{Cause: pd11.New(string(env.Error.Code))}} // service-level error - } else if env.FindProviders != nil { - out = DelegatedRouting_FindProviders_AsyncResult{Resp: env.FindProviders} + var x [1]byte + if k, err := r.Read(x[:]); k != 1 || x[0] != '\n' { + out = DelegatedRouting_FindProviders_AsyncResult{Err: pd12.ErrProto{Cause: pd3.Errorf("missing new line after result: err (%v), read (%d), char (%q)", err, k, string(x[:]))}} // Edelweiss decode error } else { - continue + env := &AnonInductive5{} + if err = env.Parse(n); err != nil { + out = DelegatedRouting_FindProviders_AsyncResult{Err: pd12.ErrProto{Cause: err}} // schema decode error + } else if env.Error != nil { + out = DelegatedRouting_FindProviders_AsyncResult{Err: pd12.ErrService{Cause: pd10.New(string(env.Error.Code))}} // service-level error + } else if env.FindProviders != nil { + out = DelegatedRouting_FindProviders_AsyncResult{Resp: env.FindProviders} + } else { + continue + } } } @@ -1340,8 +1360,8 @@ func process_DelegatedRouting_FindProviders_AsyncResult(ctx pd6.Context, ch chan } } -func (c *client_DelegatedRouting) GetIPNS(ctx pd6.Context, req *GetIPNSRequest) ([]*GetIPNSResponse, error) { - ctx, cancel := pd6.WithCancel(ctx) +func (c *client_DelegatedRouting) GetIPNS(ctx pd9.Context, req *GetIPNSRequest) ([]*GetIPNSResponse, error) { + ctx, cancel := pd9.WithCancel(ctx) defer cancel() ch, err := c.GetIPNS_Async(ctx, req) if err != nil { @@ -1369,27 +1389,27 @@ func (c *client_DelegatedRouting) GetIPNS(ctx pd6.Context, req *GetIPNSRequest) } } -func (c *client_DelegatedRouting) GetIPNS_Async(ctx pd6.Context, req *GetIPNSRequest) (<-chan DelegatedRouting_GetIPNS_AsyncResult, error) { +func (c *client_DelegatedRouting) GetIPNS_Async(ctx pd9.Context, req *GetIPNSRequest) (<-chan DelegatedRouting_GetIPNS_AsyncResult, error) { // check if we have memoized that this method is not supported by the server c.ulk.Lock() notSupported := c.unsupported["GetIPNS"] c.ulk.Unlock() if notSupported { - return nil, pd13.ErrSchema + return nil, pd12.ErrSchema } envelope := &AnonInductive4{ GetIPNS: req, } - buf, err := pd10.Encode(envelope, pd9.Encode) + buf, err := pd5.Encode(envelope, pd8.Encode) if err != nil { return nil, pd3.Errorf("unexpected serialization error (%v)", err) } // encode request in URL u := *c.endpoint - httpReq, err := pd4.NewRequestWithContext(ctx, "POST", u.String(), pd8.NewReader(buf)) + httpReq, err := pd4.NewRequestWithContext(ctx, "POST", u.String(), pd7.NewReader(buf)) if err != nil { return nil, err } @@ -1411,7 +1431,7 @@ func (c *client_DelegatedRouting) GetIPNS_Async(ctx pd6.Context, req *GetIPNSReq c.ulk.Lock() c.unsupported["GetIPNS"] = true c.ulk.Unlock() - return nil, pd13.ErrSchema + return nil, pd12.ErrSchema } // HTTP codes other than 200 correspond to service implementation rejecting the call when it is received // for reasons unrelated to protocol schema @@ -1419,7 +1439,7 @@ func (c *client_DelegatedRouting) GetIPNS_Async(ctx pd6.Context, req *GetIPNSReq resp.Body.Close() if resp.Header != nil { if errValues, ok := resp.Header["Error"]; ok && len(errValues) == 1 { - err = pd13.ErrService{Cause: pd3.Errorf("%s", errValues[0])} + err = pd12.ErrService{Cause: pd3.Errorf("%s", errValues[0])} } else { err = pd3.Errorf("service rejected the call, no cause provided") } @@ -1434,29 +1454,39 @@ func (c *client_DelegatedRouting) GetIPNS_Async(ctx pd6.Context, req *GetIPNSReq return ch, nil } -func process_DelegatedRouting_GetIPNS_AsyncResult(ctx pd6.Context, ch chan<- DelegatedRouting_GetIPNS_AsyncResult, r pd7.ReadCloser) { +func process_DelegatedRouting_GetIPNS_AsyncResult(ctx pd9.Context, ch chan<- DelegatedRouting_GetIPNS_AsyncResult, r pd11.ReadCloser) { defer close(ch) defer r.Close() + opt := pd8.DecodeOptions{ + ParseLinks: true, + ParseBytes: true, + DontParseBeyondEnd: true, + } for { var out DelegatedRouting_GetIPNS_AsyncResult - n, err := pd10.DecodeStreaming(r, pd9.Decode) - if pd11.Is(err, pd7.EOF) || pd11.Is(err, pd7.ErrUnexpectedEOF) { + n, err := pd5.DecodeStreaming(r, opt.Decode) + if pd10.Is(err, pd11.EOF) || pd10.Is(err, pd11.ErrUnexpectedEOF) { return } if err != nil { - out = DelegatedRouting_GetIPNS_AsyncResult{Err: pd13.ErrProto{Cause: err}} // IPLD decode error + out = DelegatedRouting_GetIPNS_AsyncResult{Err: pd12.ErrProto{Cause: err}} // IPLD decode error } else { - env := &AnonInductive5{} - if err = env.Parse(n); err != nil { - out = DelegatedRouting_GetIPNS_AsyncResult{Err: pd13.ErrProto{Cause: err}} // schema decode error - } else if env.Error != nil { - out = DelegatedRouting_GetIPNS_AsyncResult{Err: pd13.ErrService{Cause: pd11.New(string(env.Error.Code))}} // service-level error - } else if env.GetIPNS != nil { - out = DelegatedRouting_GetIPNS_AsyncResult{Resp: env.GetIPNS} + var x [1]byte + if k, err := r.Read(x[:]); k != 1 || x[0] != '\n' { + out = DelegatedRouting_GetIPNS_AsyncResult{Err: pd12.ErrProto{Cause: pd3.Errorf("missing new line after result: err (%v), read (%d), char (%q)", err, k, string(x[:]))}} // Edelweiss decode error } else { - continue + env := &AnonInductive5{} + if err = env.Parse(n); err != nil { + out = DelegatedRouting_GetIPNS_AsyncResult{Err: pd12.ErrProto{Cause: err}} // schema decode error + } else if env.Error != nil { + out = DelegatedRouting_GetIPNS_AsyncResult{Err: pd12.ErrService{Cause: pd10.New(string(env.Error.Code))}} // service-level error + } else if env.GetIPNS != nil { + out = DelegatedRouting_GetIPNS_AsyncResult{Resp: env.GetIPNS} + } else { + continue + } } } @@ -1468,8 +1498,8 @@ func process_DelegatedRouting_GetIPNS_AsyncResult(ctx pd6.Context, ch chan<- Del } } -func (c *client_DelegatedRouting) PutIPNS(ctx pd6.Context, req *PutIPNSRequest) ([]*PutIPNSResponse, error) { - ctx, cancel := pd6.WithCancel(ctx) +func (c *client_DelegatedRouting) PutIPNS(ctx pd9.Context, req *PutIPNSRequest) ([]*PutIPNSResponse, error) { + ctx, cancel := pd9.WithCancel(ctx) defer cancel() ch, err := c.PutIPNS_Async(ctx, req) if err != nil { @@ -1497,27 +1527,27 @@ func (c *client_DelegatedRouting) PutIPNS(ctx pd6.Context, req *PutIPNSRequest) } } -func (c *client_DelegatedRouting) PutIPNS_Async(ctx pd6.Context, req *PutIPNSRequest) (<-chan DelegatedRouting_PutIPNS_AsyncResult, error) { +func (c *client_DelegatedRouting) PutIPNS_Async(ctx pd9.Context, req *PutIPNSRequest) (<-chan DelegatedRouting_PutIPNS_AsyncResult, error) { // check if we have memoized that this method is not supported by the server c.ulk.Lock() notSupported := c.unsupported["PutIPNS"] c.ulk.Unlock() if notSupported { - return nil, pd13.ErrSchema + return nil, pd12.ErrSchema } envelope := &AnonInductive4{ PutIPNS: req, } - buf, err := pd10.Encode(envelope, pd9.Encode) + buf, err := pd5.Encode(envelope, pd8.Encode) if err != nil { return nil, pd3.Errorf("unexpected serialization error (%v)", err) } // encode request in URL u := *c.endpoint - httpReq, err := pd4.NewRequestWithContext(ctx, "POST", u.String(), pd8.NewReader(buf)) + httpReq, err := pd4.NewRequestWithContext(ctx, "POST", u.String(), pd7.NewReader(buf)) if err != nil { return nil, err } @@ -1539,7 +1569,7 @@ func (c *client_DelegatedRouting) PutIPNS_Async(ctx pd6.Context, req *PutIPNSReq c.ulk.Lock() c.unsupported["PutIPNS"] = true c.ulk.Unlock() - return nil, pd13.ErrSchema + return nil, pd12.ErrSchema } // HTTP codes other than 200 correspond to service implementation rejecting the call when it is received // for reasons unrelated to protocol schema @@ -1547,7 +1577,7 @@ func (c *client_DelegatedRouting) PutIPNS_Async(ctx pd6.Context, req *PutIPNSReq resp.Body.Close() if resp.Header != nil { if errValues, ok := resp.Header["Error"]; ok && len(errValues) == 1 { - err = pd13.ErrService{Cause: pd3.Errorf("%s", errValues[0])} + err = pd12.ErrService{Cause: pd3.Errorf("%s", errValues[0])} } else { err = pd3.Errorf("service rejected the call, no cause provided") } @@ -1562,29 +1592,39 @@ func (c *client_DelegatedRouting) PutIPNS_Async(ctx pd6.Context, req *PutIPNSReq return ch, nil } -func process_DelegatedRouting_PutIPNS_AsyncResult(ctx pd6.Context, ch chan<- DelegatedRouting_PutIPNS_AsyncResult, r pd7.ReadCloser) { +func process_DelegatedRouting_PutIPNS_AsyncResult(ctx pd9.Context, ch chan<- DelegatedRouting_PutIPNS_AsyncResult, r pd11.ReadCloser) { defer close(ch) defer r.Close() + opt := pd8.DecodeOptions{ + ParseLinks: true, + ParseBytes: true, + DontParseBeyondEnd: true, + } for { var out DelegatedRouting_PutIPNS_AsyncResult - n, err := pd10.DecodeStreaming(r, pd9.Decode) - if pd11.Is(err, pd7.EOF) || pd11.Is(err, pd7.ErrUnexpectedEOF) { + n, err := pd5.DecodeStreaming(r, opt.Decode) + if pd10.Is(err, pd11.EOF) || pd10.Is(err, pd11.ErrUnexpectedEOF) { return } if err != nil { - out = DelegatedRouting_PutIPNS_AsyncResult{Err: pd13.ErrProto{Cause: err}} // IPLD decode error + out = DelegatedRouting_PutIPNS_AsyncResult{Err: pd12.ErrProto{Cause: err}} // IPLD decode error } else { - env := &AnonInductive5{} - if err = env.Parse(n); err != nil { - out = DelegatedRouting_PutIPNS_AsyncResult{Err: pd13.ErrProto{Cause: err}} // schema decode error - } else if env.Error != nil { - out = DelegatedRouting_PutIPNS_AsyncResult{Err: pd13.ErrService{Cause: pd11.New(string(env.Error.Code))}} // service-level error - } else if env.PutIPNS != nil { - out = DelegatedRouting_PutIPNS_AsyncResult{Resp: env.PutIPNS} + var x [1]byte + if k, err := r.Read(x[:]); k != 1 || x[0] != '\n' { + out = DelegatedRouting_PutIPNS_AsyncResult{Err: pd12.ErrProto{Cause: pd3.Errorf("missing new line after result: err (%v), read (%d), char (%q)", err, k, string(x[:]))}} // Edelweiss decode error } else { - continue + env := &AnonInductive5{} + if err = env.Parse(n); err != nil { + out = DelegatedRouting_PutIPNS_AsyncResult{Err: pd12.ErrProto{Cause: err}} // schema decode error + } else if env.Error != nil { + out = DelegatedRouting_PutIPNS_AsyncResult{Err: pd12.ErrService{Cause: pd10.New(string(env.Error.Code))}} // service-level error + } else if env.PutIPNS != nil { + out = DelegatedRouting_PutIPNS_AsyncResult{Resp: env.PutIPNS} + } else { + continue + } } } @@ -1596,12 +1636,12 @@ func process_DelegatedRouting_PutIPNS_AsyncResult(ctx pd6.Context, ch chan<- Del } } -var logger_server_DelegatedRouting = pd12.Logger("service/server/delegatedrouting") +var logger_server_DelegatedRouting = pd14.Logger("service/server/delegatedrouting") type DelegatedRouting_Server interface { - FindProviders(ctx pd6.Context, req *FindProvidersRequest) (<-chan *DelegatedRouting_FindProviders_AsyncResult, error) - GetIPNS(ctx pd6.Context, req *GetIPNSRequest) (<-chan *DelegatedRouting_GetIPNS_AsyncResult, error) - PutIPNS(ctx pd6.Context, req *PutIPNSRequest) (<-chan *DelegatedRouting_PutIPNS_AsyncResult, error) + FindProviders(ctx pd9.Context, req *FindProvidersRequest) (<-chan *DelegatedRouting_FindProviders_AsyncResult, error) + GetIPNS(ctx pd9.Context, req *GetIPNSRequest) (<-chan *DelegatedRouting_GetIPNS_AsyncResult, error) + PutIPNS(ctx pd9.Context, req *PutIPNSRequest) (<-chan *DelegatedRouting_PutIPNS_AsyncResult, error) } func DelegatedRouting_AsyncHandler(s DelegatedRouting_Server) pd4.HandlerFunc { @@ -1613,7 +1653,7 @@ func DelegatedRouting_AsyncHandler(s DelegatedRouting_Server) pd4.HandlerFunc { writer.WriteHeader(400) return } - n, err := pd10.Decode(msg, pd9.Decode) + n, err := pd5.Decode(msg, pd8.Decode) if err != nil { logger_server_DelegatedRouting.Errorf("received request not decodeable (%v)", err) writer.WriteHeader(400) @@ -1634,7 +1674,7 @@ func DelegatedRouting_AsyncHandler(s DelegatedRouting_Server) pd4.HandlerFunc { switch { case env.FindProviders != nil: - ch, err := s.FindProviders(pd6.Background(), env.FindProviders) + ch, err := s.FindProviders(pd9.Background(), env.FindProviders) if err != nil { logger_server_DelegatedRouting.Errorf("service rejected request (%v)", err) writer.Header()["Error"] = []string{err.Error()} @@ -1644,12 +1684,12 @@ func DelegatedRouting_AsyncHandler(s DelegatedRouting_Server) pd4.HandlerFunc { for resp := range ch { var env *AnonInductive5 if resp.Err != nil { - env = &AnonInductive5{Error: &DelegatedRouting_Error{Code: pd2.String(resp.Err.Error())}} + env = &AnonInductive5{Error: &DelegatedRouting_Error{Code: pd1.String(resp.Err.Error())}} } else { env = &AnonInductive5{FindProviders: resp.Resp} } - var buf pd8.Buffer - if err = pd10.EncodeStreaming(&buf, env, pd9.Encode); err != nil { + var buf pd7.Buffer + if err = pd5.EncodeStreaming(&buf, env, pd8.Encode); err != nil { logger_server_DelegatedRouting.Errorf("cannot encode response (%v)", err) continue } @@ -1658,7 +1698,7 @@ func DelegatedRouting_AsyncHandler(s DelegatedRouting_Server) pd4.HandlerFunc { } case env.GetIPNS != nil: - ch, err := s.GetIPNS(pd6.Background(), env.GetIPNS) + ch, err := s.GetIPNS(pd9.Background(), env.GetIPNS) if err != nil { logger_server_DelegatedRouting.Errorf("service rejected request (%v)", err) writer.Header()["Error"] = []string{err.Error()} @@ -1668,12 +1708,12 @@ func DelegatedRouting_AsyncHandler(s DelegatedRouting_Server) pd4.HandlerFunc { for resp := range ch { var env *AnonInductive5 if resp.Err != nil { - env = &AnonInductive5{Error: &DelegatedRouting_Error{Code: pd2.String(resp.Err.Error())}} + env = &AnonInductive5{Error: &DelegatedRouting_Error{Code: pd1.String(resp.Err.Error())}} } else { env = &AnonInductive5{GetIPNS: resp.Resp} } - var buf pd8.Buffer - if err = pd10.EncodeStreaming(&buf, env, pd9.Encode); err != nil { + var buf pd7.Buffer + if err = pd5.EncodeStreaming(&buf, env, pd8.Encode); err != nil { logger_server_DelegatedRouting.Errorf("cannot encode response (%v)", err) continue } @@ -1682,7 +1722,7 @@ func DelegatedRouting_AsyncHandler(s DelegatedRouting_Server) pd4.HandlerFunc { } case env.PutIPNS != nil: - ch, err := s.PutIPNS(pd6.Background(), env.PutIPNS) + ch, err := s.PutIPNS(pd9.Background(), env.PutIPNS) if err != nil { logger_server_DelegatedRouting.Errorf("service rejected request (%v)", err) writer.Header()["Error"] = []string{err.Error()} @@ -1692,12 +1732,12 @@ func DelegatedRouting_AsyncHandler(s DelegatedRouting_Server) pd4.HandlerFunc { for resp := range ch { var env *AnonInductive5 if resp.Err != nil { - env = &AnonInductive5{Error: &DelegatedRouting_Error{Code: pd2.String(resp.Err.Error())}} + env = &AnonInductive5{Error: &DelegatedRouting_Error{Code: pd1.String(resp.Err.Error())}} } else { env = &AnonInductive5{PutIPNS: resp.Resp} } - var buf pd8.Buffer - if err = pd10.EncodeStreaming(&buf, env, pd9.Encode); err != nil { + var buf pd7.Buffer + if err = pd5.EncodeStreaming(&buf, env, pd8.Encode); err != nil { logger_server_DelegatedRouting.Errorf("cannot encode response (%v)", err) continue } @@ -1709,15 +1749,15 @@ func DelegatedRouting_AsyncHandler(s DelegatedRouting_Server) pd4.HandlerFunc { var env *AnonInductive5 env = &AnonInductive5{ Identify: &DelegatedRouting_IdentifyResult{ - Methods: []pd2.String{ + Methods: []pd1.String{ "FindProviders", "GetIPNS", "PutIPNS", }, }, } - var buf pd8.Buffer - if err = pd10.EncodeStreaming(&buf, env, pd9.Encode); err != nil { + var buf pd7.Buffer + if err = pd5.EncodeStreaming(&buf, env, pd8.Encode); err != nil { logger_server_DelegatedRouting.Errorf("cannot encode identify response (%v)", err) writer.WriteHeader(500) return @@ -1738,16 +1778,16 @@ type FindProvidersRequest struct { Key LinkToAny } -func (x FindProvidersRequest) Node() pd1.Node { +func (x FindProvidersRequest) Node() pd2.Node { return x } -func (x *FindProvidersRequest) Parse(n pd1.Node) error { - if n.Kind() != pd1.Kind_Map { - return pd2.ErrNA +func (x *FindProvidersRequest) Parse(n pd2.Node) error { + if n.Kind() != pd2.Kind_Map { + return pd1.ErrNA } iter := n.MapIterator() - fieldMap := map[string]pd2.ParseFunc{ + fieldMap := map[string]pd1.ParseFunc{ "Key": x.Key.Parse, } for !iter.Done() { @@ -1773,7 +1813,7 @@ func (x *FindProvidersRequest) Parse(n pd1.Node) error { } } for _, fieldParse := range fieldMap { - if err := fieldParse(pd1.Null); err != nil { + if err := fieldParse(pd2.Null); err != nil { return err } } @@ -1785,74 +1825,74 @@ type FindProvidersRequest_MapIterator struct { s *FindProvidersRequest } -func (x *FindProvidersRequest_MapIterator) Next() (key pd1.Node, value pd1.Node, err error) { +func (x *FindProvidersRequest_MapIterator) Next() (key pd2.Node, value pd2.Node, err error) { x.i++ switch x.i { case 0: - return pd2.String("Key"), x.s.Key.Node(), nil + return pd1.String("Key"), x.s.Key.Node(), nil } - return nil, nil, pd2.ErrNA + return nil, nil, pd1.ErrNA } func (x *FindProvidersRequest_MapIterator) Done() bool { return x.i+1 >= 1 } -func (x FindProvidersRequest) Kind() pd1.Kind { - return pd1.Kind_Map +func (x FindProvidersRequest) Kind() pd2.Kind { + return pd2.Kind_Map } -func (x FindProvidersRequest) LookupByString(key string) (pd1.Node, error) { +func (x FindProvidersRequest) LookupByString(key string) (pd2.Node, error) { switch key { case "Key": return x.Key.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x FindProvidersRequest) LookupByNode(key pd1.Node) (pd1.Node, error) { +func (x FindProvidersRequest) LookupByNode(key pd2.Node) (pd2.Node, error) { switch key.Kind() { - case pd1.Kind_String: + case pd2.Kind_String: if s, err := key.AsString(); err != nil { return nil, err } else { return x.LookupByString(s) } - case pd1.Kind_Int: + case pd2.Kind_Int: if i, err := key.AsInt(); err != nil { return nil, err } else { return x.LookupByIndex(i) } } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x FindProvidersRequest) LookupByIndex(idx int64) (pd1.Node, error) { +func (x FindProvidersRequest) LookupByIndex(idx int64) (pd2.Node, error) { switch idx { case 0: return x.Key.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x FindProvidersRequest) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { +func (x FindProvidersRequest) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { switch seg.String() { case "0", "Key": return x.Key.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x FindProvidersRequest) MapIterator() pd1.MapIterator { +func (x FindProvidersRequest) MapIterator() pd2.MapIterator { return &FindProvidersRequest_MapIterator{-1, &x} } -func (x FindProvidersRequest) ListIterator() pd1.ListIterator { +func (x FindProvidersRequest) ListIterator() pd2.ListIterator { return nil } @@ -1869,30 +1909,30 @@ func (x FindProvidersRequest) IsNull() bool { } func (x FindProvidersRequest) AsBool() (bool, error) { - return false, pd2.ErrNA + return false, pd1.ErrNA } func (x FindProvidersRequest) AsInt() (int64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (x FindProvidersRequest) AsFloat() (float64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (x FindProvidersRequest) AsString() (string, error) { - return "", pd2.ErrNA + return "", pd1.ErrNA } func (x FindProvidersRequest) AsBytes() ([]byte, error) { - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x FindProvidersRequest) AsLink() (pd1.Link, error) { - return nil, pd2.ErrNA +func (x FindProvidersRequest) AsLink() (pd2.Link, error) { + return nil, pd1.ErrNA } -func (x FindProvidersRequest) Prototype() pd1.NodePrototype { +func (x FindProvidersRequest) Prototype() pd2.NodePrototype { return nil } @@ -1900,23 +1940,23 @@ func (x FindProvidersRequest) Prototype() pd1.NodePrototype { type ProvidersList []Provider -func (v ProvidersList) Node() pd1.Node { +func (v ProvidersList) Node() pd2.Node { return v } -func (v *ProvidersList) Parse(n pd1.Node) error { - if n.Kind() == pd1.Kind_Null { +func (v *ProvidersList) Parse(n pd2.Node) error { + if n.Kind() == pd2.Kind_Null { *v = nil return nil } - if n.Kind() != pd1.Kind_List { - return pd2.ErrNA + if n.Kind() != pd2.Kind_List { + return pd1.ErrNA } else { *v = make(ProvidersList, n.Length()) iter := n.ListIterator() for !iter.Done() { if i, n, err := iter.Next(); err != nil { - return pd2.ErrNA + return pd1.ErrNA } else if err = (*v)[i].Parse(n); err != nil { return err } @@ -1925,39 +1965,39 @@ func (v *ProvidersList) Parse(n pd1.Node) error { } } -func (ProvidersList) Kind() pd1.Kind { - return pd1.Kind_List +func (ProvidersList) Kind() pd2.Kind { + return pd2.Kind_List } -func (ProvidersList) LookupByString(string) (pd1.Node, error) { - return nil, pd2.ErrNA +func (ProvidersList) LookupByString(string) (pd2.Node, error) { + return nil, pd1.ErrNA } -func (ProvidersList) LookupByNode(key pd1.Node) (pd1.Node, error) { - return nil, pd2.ErrNA +func (ProvidersList) LookupByNode(key pd2.Node) (pd2.Node, error) { + return nil, pd1.ErrNA } -func (v ProvidersList) LookupByIndex(i int64) (pd1.Node, error) { +func (v ProvidersList) LookupByIndex(i int64) (pd2.Node, error) { if i < 0 || i >= v.Length() { - return nil, pd2.ErrBounds + return nil, pd1.ErrBounds } else { return v[i].Node(), nil } } -func (v ProvidersList) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { +func (v ProvidersList) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { if i, err := seg.Index(); err != nil { - return nil, pd2.ErrNA + return nil, pd1.ErrNA } else { return v.LookupByIndex(i) } } -func (ProvidersList) MapIterator() pd1.MapIterator { +func (ProvidersList) MapIterator() pd2.MapIterator { return nil } -func (v ProvidersList) ListIterator() pd1.ListIterator { +func (v ProvidersList) ListIterator() pd2.ListIterator { return &ProvidersList_ListIterator{v, 0} } @@ -1974,30 +2014,30 @@ func (ProvidersList) IsNull() bool { } func (v ProvidersList) AsBool() (bool, error) { - return false, pd2.ErrNA + return false, pd1.ErrNA } func (ProvidersList) AsInt() (int64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (ProvidersList) AsFloat() (float64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (ProvidersList) AsString() (string, error) { - return "", pd2.ErrNA + return "", pd1.ErrNA } func (ProvidersList) AsBytes() ([]byte, error) { - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (ProvidersList) AsLink() (pd1.Link, error) { - return nil, pd2.ErrNA +func (ProvidersList) AsLink() (pd2.Link, error) { + return nil, pd1.ErrNA } -func (ProvidersList) Prototype() pd1.NodePrototype { +func (ProvidersList) Prototype() pd2.NodePrototype { return nil // not needed } @@ -2006,9 +2046,9 @@ type ProvidersList_ListIterator struct { at int64 } -func (iter *ProvidersList_ListIterator) Next() (int64, pd1.Node, error) { +func (iter *ProvidersList_ListIterator) Next() (int64, pd2.Node, error) { if iter.Done() { - return -1, nil, pd2.ErrBounds + return -1, nil, pd1.ErrBounds } v := iter.list[iter.at] i := int64(iter.at) @@ -2026,16 +2066,16 @@ type FindProvidersResponse struct { Providers ProvidersList } -func (x FindProvidersResponse) Node() pd1.Node { +func (x FindProvidersResponse) Node() pd2.Node { return x } -func (x *FindProvidersResponse) Parse(n pd1.Node) error { - if n.Kind() != pd1.Kind_Map { - return pd2.ErrNA +func (x *FindProvidersResponse) Parse(n pd2.Node) error { + if n.Kind() != pd2.Kind_Map { + return pd1.ErrNA } iter := n.MapIterator() - fieldMap := map[string]pd2.ParseFunc{ + fieldMap := map[string]pd1.ParseFunc{ "Providers": x.Providers.Parse, } for !iter.Done() { @@ -2061,7 +2101,7 @@ func (x *FindProvidersResponse) Parse(n pd1.Node) error { } } for _, fieldParse := range fieldMap { - if err := fieldParse(pd1.Null); err != nil { + if err := fieldParse(pd2.Null); err != nil { return err } } @@ -2073,74 +2113,74 @@ type FindProvidersResponse_MapIterator struct { s *FindProvidersResponse } -func (x *FindProvidersResponse_MapIterator) Next() (key pd1.Node, value pd1.Node, err error) { +func (x *FindProvidersResponse_MapIterator) Next() (key pd2.Node, value pd2.Node, err error) { x.i++ switch x.i { case 0: - return pd2.String("Providers"), x.s.Providers.Node(), nil + return pd1.String("Providers"), x.s.Providers.Node(), nil } - return nil, nil, pd2.ErrNA + return nil, nil, pd1.ErrNA } func (x *FindProvidersResponse_MapIterator) Done() bool { return x.i+1 >= 1 } -func (x FindProvidersResponse) Kind() pd1.Kind { - return pd1.Kind_Map +func (x FindProvidersResponse) Kind() pd2.Kind { + return pd2.Kind_Map } -func (x FindProvidersResponse) LookupByString(key string) (pd1.Node, error) { +func (x FindProvidersResponse) LookupByString(key string) (pd2.Node, error) { switch key { case "Providers": return x.Providers.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x FindProvidersResponse) LookupByNode(key pd1.Node) (pd1.Node, error) { +func (x FindProvidersResponse) LookupByNode(key pd2.Node) (pd2.Node, error) { switch key.Kind() { - case pd1.Kind_String: + case pd2.Kind_String: if s, err := key.AsString(); err != nil { return nil, err } else { return x.LookupByString(s) } - case pd1.Kind_Int: + case pd2.Kind_Int: if i, err := key.AsInt(); err != nil { return nil, err } else { return x.LookupByIndex(i) } } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x FindProvidersResponse) LookupByIndex(idx int64) (pd1.Node, error) { +func (x FindProvidersResponse) LookupByIndex(idx int64) (pd2.Node, error) { switch idx { case 0: return x.Providers.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x FindProvidersResponse) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { +func (x FindProvidersResponse) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { switch seg.String() { case "0", "Providers": return x.Providers.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x FindProvidersResponse) MapIterator() pd1.MapIterator { +func (x FindProvidersResponse) MapIterator() pd2.MapIterator { return &FindProvidersResponse_MapIterator{-1, &x} } -func (x FindProvidersResponse) ListIterator() pd1.ListIterator { +func (x FindProvidersResponse) ListIterator() pd2.ListIterator { return nil } @@ -2157,49 +2197,49 @@ func (x FindProvidersResponse) IsNull() bool { } func (x FindProvidersResponse) AsBool() (bool, error) { - return false, pd2.ErrNA + return false, pd1.ErrNA } func (x FindProvidersResponse) AsInt() (int64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (x FindProvidersResponse) AsFloat() (float64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (x FindProvidersResponse) AsString() (string, error) { - return "", pd2.ErrNA + return "", pd1.ErrNA } func (x FindProvidersResponse) AsBytes() ([]byte, error) { - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x FindProvidersResponse) AsLink() (pd1.Link, error) { - return nil, pd2.ErrNA +func (x FindProvidersResponse) AsLink() (pd2.Link, error) { + return nil, pd1.ErrNA } -func (x FindProvidersResponse) Prototype() pd1.NodePrototype { +func (x FindProvidersResponse) Prototype() pd2.NodePrototype { return nil } // -- protocol type GetIPNSRequest -- type GetIPNSRequest struct { - ID pd2.Bytes + ID pd1.Bytes } -func (x GetIPNSRequest) Node() pd1.Node { +func (x GetIPNSRequest) Node() pd2.Node { return x } -func (x *GetIPNSRequest) Parse(n pd1.Node) error { - if n.Kind() != pd1.Kind_Map { - return pd2.ErrNA +func (x *GetIPNSRequest) Parse(n pd2.Node) error { + if n.Kind() != pd2.Kind_Map { + return pd1.ErrNA } iter := n.MapIterator() - fieldMap := map[string]pd2.ParseFunc{ + fieldMap := map[string]pd1.ParseFunc{ "ID": x.ID.Parse, } for !iter.Done() { @@ -2225,7 +2265,7 @@ func (x *GetIPNSRequest) Parse(n pd1.Node) error { } } for _, fieldParse := range fieldMap { - if err := fieldParse(pd1.Null); err != nil { + if err := fieldParse(pd2.Null); err != nil { return err } } @@ -2237,74 +2277,74 @@ type GetIPNSRequest_MapIterator struct { s *GetIPNSRequest } -func (x *GetIPNSRequest_MapIterator) Next() (key pd1.Node, value pd1.Node, err error) { +func (x *GetIPNSRequest_MapIterator) Next() (key pd2.Node, value pd2.Node, err error) { x.i++ switch x.i { case 0: - return pd2.String("ID"), x.s.ID.Node(), nil + return pd1.String("ID"), x.s.ID.Node(), nil } - return nil, nil, pd2.ErrNA + return nil, nil, pd1.ErrNA } func (x *GetIPNSRequest_MapIterator) Done() bool { return x.i+1 >= 1 } -func (x GetIPNSRequest) Kind() pd1.Kind { - return pd1.Kind_Map +func (x GetIPNSRequest) Kind() pd2.Kind { + return pd2.Kind_Map } -func (x GetIPNSRequest) LookupByString(key string) (pd1.Node, error) { +func (x GetIPNSRequest) LookupByString(key string) (pd2.Node, error) { switch key { case "ID": return x.ID.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x GetIPNSRequest) LookupByNode(key pd1.Node) (pd1.Node, error) { +func (x GetIPNSRequest) LookupByNode(key pd2.Node) (pd2.Node, error) { switch key.Kind() { - case pd1.Kind_String: + case pd2.Kind_String: if s, err := key.AsString(); err != nil { return nil, err } else { return x.LookupByString(s) } - case pd1.Kind_Int: + case pd2.Kind_Int: if i, err := key.AsInt(); err != nil { return nil, err } else { return x.LookupByIndex(i) } } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x GetIPNSRequest) LookupByIndex(idx int64) (pd1.Node, error) { +func (x GetIPNSRequest) LookupByIndex(idx int64) (pd2.Node, error) { switch idx { case 0: return x.ID.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x GetIPNSRequest) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { +func (x GetIPNSRequest) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { switch seg.String() { case "0", "ID": return x.ID.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x GetIPNSRequest) MapIterator() pd1.MapIterator { +func (x GetIPNSRequest) MapIterator() pd2.MapIterator { return &GetIPNSRequest_MapIterator{-1, &x} } -func (x GetIPNSRequest) ListIterator() pd1.ListIterator { +func (x GetIPNSRequest) ListIterator() pd2.ListIterator { return nil } @@ -2321,49 +2361,49 @@ func (x GetIPNSRequest) IsNull() bool { } func (x GetIPNSRequest) AsBool() (bool, error) { - return false, pd2.ErrNA + return false, pd1.ErrNA } func (x GetIPNSRequest) AsInt() (int64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (x GetIPNSRequest) AsFloat() (float64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (x GetIPNSRequest) AsString() (string, error) { - return "", pd2.ErrNA + return "", pd1.ErrNA } func (x GetIPNSRequest) AsBytes() ([]byte, error) { - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x GetIPNSRequest) AsLink() (pd1.Link, error) { - return nil, pd2.ErrNA +func (x GetIPNSRequest) AsLink() (pd2.Link, error) { + return nil, pd1.ErrNA } -func (x GetIPNSRequest) Prototype() pd1.NodePrototype { +func (x GetIPNSRequest) Prototype() pd2.NodePrototype { return nil } // -- protocol type GetIPNSResponse -- type GetIPNSResponse struct { - Record pd2.Bytes + Record pd1.Bytes } -func (x GetIPNSResponse) Node() pd1.Node { +func (x GetIPNSResponse) Node() pd2.Node { return x } -func (x *GetIPNSResponse) Parse(n pd1.Node) error { - if n.Kind() != pd1.Kind_Map { - return pd2.ErrNA +func (x *GetIPNSResponse) Parse(n pd2.Node) error { + if n.Kind() != pd2.Kind_Map { + return pd1.ErrNA } iter := n.MapIterator() - fieldMap := map[string]pd2.ParseFunc{ + fieldMap := map[string]pd1.ParseFunc{ "Record": x.Record.Parse, } for !iter.Done() { @@ -2389,7 +2429,7 @@ func (x *GetIPNSResponse) Parse(n pd1.Node) error { } } for _, fieldParse := range fieldMap { - if err := fieldParse(pd1.Null); err != nil { + if err := fieldParse(pd2.Null); err != nil { return err } } @@ -2401,74 +2441,74 @@ type GetIPNSResponse_MapIterator struct { s *GetIPNSResponse } -func (x *GetIPNSResponse_MapIterator) Next() (key pd1.Node, value pd1.Node, err error) { +func (x *GetIPNSResponse_MapIterator) Next() (key pd2.Node, value pd2.Node, err error) { x.i++ switch x.i { case 0: - return pd2.String("Record"), x.s.Record.Node(), nil + return pd1.String("Record"), x.s.Record.Node(), nil } - return nil, nil, pd2.ErrNA + return nil, nil, pd1.ErrNA } func (x *GetIPNSResponse_MapIterator) Done() bool { return x.i+1 >= 1 } -func (x GetIPNSResponse) Kind() pd1.Kind { - return pd1.Kind_Map +func (x GetIPNSResponse) Kind() pd2.Kind { + return pd2.Kind_Map } -func (x GetIPNSResponse) LookupByString(key string) (pd1.Node, error) { +func (x GetIPNSResponse) LookupByString(key string) (pd2.Node, error) { switch key { case "Record": return x.Record.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x GetIPNSResponse) LookupByNode(key pd1.Node) (pd1.Node, error) { +func (x GetIPNSResponse) LookupByNode(key pd2.Node) (pd2.Node, error) { switch key.Kind() { - case pd1.Kind_String: + case pd2.Kind_String: if s, err := key.AsString(); err != nil { return nil, err } else { return x.LookupByString(s) } - case pd1.Kind_Int: + case pd2.Kind_Int: if i, err := key.AsInt(); err != nil { return nil, err } else { return x.LookupByIndex(i) } } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x GetIPNSResponse) LookupByIndex(idx int64) (pd1.Node, error) { +func (x GetIPNSResponse) LookupByIndex(idx int64) (pd2.Node, error) { switch idx { case 0: return x.Record.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x GetIPNSResponse) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { +func (x GetIPNSResponse) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { switch seg.String() { case "0", "Record": return x.Record.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x GetIPNSResponse) MapIterator() pd1.MapIterator { +func (x GetIPNSResponse) MapIterator() pd2.MapIterator { return &GetIPNSResponse_MapIterator{-1, &x} } -func (x GetIPNSResponse) ListIterator() pd1.ListIterator { +func (x GetIPNSResponse) ListIterator() pd2.ListIterator { return nil } @@ -2485,50 +2525,50 @@ func (x GetIPNSResponse) IsNull() bool { } func (x GetIPNSResponse) AsBool() (bool, error) { - return false, pd2.ErrNA + return false, pd1.ErrNA } func (x GetIPNSResponse) AsInt() (int64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (x GetIPNSResponse) AsFloat() (float64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (x GetIPNSResponse) AsString() (string, error) { - return "", pd2.ErrNA + return "", pd1.ErrNA } func (x GetIPNSResponse) AsBytes() ([]byte, error) { - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x GetIPNSResponse) AsLink() (pd1.Link, error) { - return nil, pd2.ErrNA +func (x GetIPNSResponse) AsLink() (pd2.Link, error) { + return nil, pd1.ErrNA } -func (x GetIPNSResponse) Prototype() pd1.NodePrototype { +func (x GetIPNSResponse) Prototype() pd2.NodePrototype { return nil } // -- protocol type PutIPNSRequest -- type PutIPNSRequest struct { - ID pd2.Bytes - Record pd2.Bytes + ID pd1.Bytes + Record pd1.Bytes } -func (x PutIPNSRequest) Node() pd1.Node { +func (x PutIPNSRequest) Node() pd2.Node { return x } -func (x *PutIPNSRequest) Parse(n pd1.Node) error { - if n.Kind() != pd1.Kind_Map { - return pd2.ErrNA +func (x *PutIPNSRequest) Parse(n pd2.Node) error { + if n.Kind() != pd2.Kind_Map { + return pd1.ErrNA } iter := n.MapIterator() - fieldMap := map[string]pd2.ParseFunc{ + fieldMap := map[string]pd1.ParseFunc{ "ID": x.ID.Parse, "Record": x.Record.Parse, } @@ -2563,7 +2603,7 @@ func (x *PutIPNSRequest) Parse(n pd1.Node) error { } } for _, fieldParse := range fieldMap { - if err := fieldParse(pd1.Null); err != nil { + if err := fieldParse(pd2.Null); err != nil { return err } } @@ -2575,27 +2615,27 @@ type PutIPNSRequest_MapIterator struct { s *PutIPNSRequest } -func (x *PutIPNSRequest_MapIterator) Next() (key pd1.Node, value pd1.Node, err error) { +func (x *PutIPNSRequest_MapIterator) Next() (key pd2.Node, value pd2.Node, err error) { x.i++ switch x.i { case 0: - return pd2.String("ID"), x.s.ID.Node(), nil + return pd1.String("ID"), x.s.ID.Node(), nil case 1: - return pd2.String("Record"), x.s.Record.Node(), nil + return pd1.String("Record"), x.s.Record.Node(), nil } - return nil, nil, pd2.ErrNA + return nil, nil, pd1.ErrNA } func (x *PutIPNSRequest_MapIterator) Done() bool { return x.i+1 >= 2 } -func (x PutIPNSRequest) Kind() pd1.Kind { - return pd1.Kind_Map +func (x PutIPNSRequest) Kind() pd2.Kind { + return pd2.Kind_Map } -func (x PutIPNSRequest) LookupByString(key string) (pd1.Node, error) { +func (x PutIPNSRequest) LookupByString(key string) (pd2.Node, error) { switch key { case "ID": return x.ID.Node(), nil @@ -2603,28 +2643,28 @@ func (x PutIPNSRequest) LookupByString(key string) (pd1.Node, error) { return x.Record.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x PutIPNSRequest) LookupByNode(key pd1.Node) (pd1.Node, error) { +func (x PutIPNSRequest) LookupByNode(key pd2.Node) (pd2.Node, error) { switch key.Kind() { - case pd1.Kind_String: + case pd2.Kind_String: if s, err := key.AsString(); err != nil { return nil, err } else { return x.LookupByString(s) } - case pd1.Kind_Int: + case pd2.Kind_Int: if i, err := key.AsInt(); err != nil { return nil, err } else { return x.LookupByIndex(i) } } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x PutIPNSRequest) LookupByIndex(idx int64) (pd1.Node, error) { +func (x PutIPNSRequest) LookupByIndex(idx int64) (pd2.Node, error) { switch idx { case 0: return x.ID.Node(), nil @@ -2632,10 +2672,10 @@ func (x PutIPNSRequest) LookupByIndex(idx int64) (pd1.Node, error) { return x.Record.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x PutIPNSRequest) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { +func (x PutIPNSRequest) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { switch seg.String() { case "0", "ID": return x.ID.Node(), nil @@ -2643,14 +2683,14 @@ func (x PutIPNSRequest) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { return x.Record.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x PutIPNSRequest) MapIterator() pd1.MapIterator { +func (x PutIPNSRequest) MapIterator() pd2.MapIterator { return &PutIPNSRequest_MapIterator{-1, &x} } -func (x PutIPNSRequest) ListIterator() pd1.ListIterator { +func (x PutIPNSRequest) ListIterator() pd2.ListIterator { return nil } @@ -2667,30 +2707,30 @@ func (x PutIPNSRequest) IsNull() bool { } func (x PutIPNSRequest) AsBool() (bool, error) { - return false, pd2.ErrNA + return false, pd1.ErrNA } func (x PutIPNSRequest) AsInt() (int64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (x PutIPNSRequest) AsFloat() (float64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (x PutIPNSRequest) AsString() (string, error) { - return "", pd2.ErrNA + return "", pd1.ErrNA } func (x PutIPNSRequest) AsBytes() ([]byte, error) { - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x PutIPNSRequest) AsLink() (pd1.Link, error) { - return nil, pd2.ErrNA +func (x PutIPNSRequest) AsLink() (pd2.Link, error) { + return nil, pd1.ErrNA } -func (x PutIPNSRequest) Prototype() pd1.NodePrototype { +func (x PutIPNSRequest) Prototype() pd2.NodePrototype { return nil } @@ -2699,16 +2739,16 @@ func (x PutIPNSRequest) Prototype() pd1.NodePrototype { type PutIPNSResponse struct { } -func (x PutIPNSResponse) Node() pd1.Node { +func (x PutIPNSResponse) Node() pd2.Node { return x } -func (x *PutIPNSResponse) Parse(n pd1.Node) error { - if n.Kind() != pd1.Kind_Map { - return pd2.ErrNA +func (x *PutIPNSResponse) Parse(n pd2.Node) error { + if n.Kind() != pd2.Kind_Map { + return pd1.ErrNA } iter := n.MapIterator() - fieldMap := map[string]pd2.ParseFunc{} + fieldMap := map[string]pd1.ParseFunc{} for !iter.Done() { if kn, vn, err := iter.Next(); err != nil { return err @@ -2724,7 +2764,7 @@ func (x *PutIPNSResponse) Parse(n pd1.Node) error { } } for _, fieldParse := range fieldMap { - if err := fieldParse(pd1.Null); err != nil { + if err := fieldParse(pd2.Null); err != nil { return err } } @@ -2736,66 +2776,66 @@ type PutIPNSResponse_MapIterator struct { s *PutIPNSResponse } -func (x *PutIPNSResponse_MapIterator) Next() (key pd1.Node, value pd1.Node, err error) { +func (x *PutIPNSResponse_MapIterator) Next() (key pd2.Node, value pd2.Node, err error) { x.i++ switch x.i { } - return nil, nil, pd2.ErrNA + return nil, nil, pd1.ErrNA } func (x *PutIPNSResponse_MapIterator) Done() bool { return x.i+1 >= 0 } -func (x PutIPNSResponse) Kind() pd1.Kind { - return pd1.Kind_Map +func (x PutIPNSResponse) Kind() pd2.Kind { + return pd2.Kind_Map } -func (x PutIPNSResponse) LookupByString(key string) (pd1.Node, error) { +func (x PutIPNSResponse) LookupByString(key string) (pd2.Node, error) { switch key { } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x PutIPNSResponse) LookupByNode(key pd1.Node) (pd1.Node, error) { +func (x PutIPNSResponse) LookupByNode(key pd2.Node) (pd2.Node, error) { switch key.Kind() { - case pd1.Kind_String: + case pd2.Kind_String: if s, err := key.AsString(); err != nil { return nil, err } else { return x.LookupByString(s) } - case pd1.Kind_Int: + case pd2.Kind_Int: if i, err := key.AsInt(); err != nil { return nil, err } else { return x.LookupByIndex(i) } } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x PutIPNSResponse) LookupByIndex(idx int64) (pd1.Node, error) { +func (x PutIPNSResponse) LookupByIndex(idx int64) (pd2.Node, error) { switch idx { } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x PutIPNSResponse) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { +func (x PutIPNSResponse) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { switch seg.String() { } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x PutIPNSResponse) MapIterator() pd1.MapIterator { +func (x PutIPNSResponse) MapIterator() pd2.MapIterator { return &PutIPNSResponse_MapIterator{-1, &x} } -func (x PutIPNSResponse) ListIterator() pd1.ListIterator { +func (x PutIPNSResponse) ListIterator() pd2.ListIterator { return nil } @@ -2812,44 +2852,44 @@ func (x PutIPNSResponse) IsNull() bool { } func (x PutIPNSResponse) AsBool() (bool, error) { - return false, pd2.ErrNA + return false, pd1.ErrNA } func (x PutIPNSResponse) AsInt() (int64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (x PutIPNSResponse) AsFloat() (float64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (x PutIPNSResponse) AsString() (string, error) { - return "", pd2.ErrNA + return "", pd1.ErrNA } func (x PutIPNSResponse) AsBytes() ([]byte, error) { - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x PutIPNSResponse) AsLink() (pd1.Link, error) { - return nil, pd2.ErrNA +func (x PutIPNSResponse) AsLink() (pd2.Link, error) { + return nil, pd1.ErrNA } -func (x PutIPNSResponse) Prototype() pd1.NodePrototype { +func (x PutIPNSResponse) Prototype() pd2.NodePrototype { return nil } // -- protocol type LinkToAny -- -type LinkToAny pd17.Cid +type LinkToAny pd16.Cid -func (v *LinkToAny) Parse(n pd1.Node) error { - if n.Kind() != pd1.Kind_Link { - return pd2.ErrNA +func (v *LinkToAny) Parse(n pd2.Node) error { + if n.Kind() != pd2.Kind_Link { + return pd1.ErrNA } else { ipldLink, _ := n.AsLink() // TODO: Is there a more general way to convert ipld.Link interface into a concrete user object? - cidLink, ok := ipldLink.(pd16.Link) + cidLink, ok := ipldLink.(pd17.Link) if !ok { return pd3.Errorf("only cid links are supported") } else { @@ -2859,35 +2899,35 @@ func (v *LinkToAny) Parse(n pd1.Node) error { } } -func (v LinkToAny) Node() pd1.Node { +func (v LinkToAny) Node() pd2.Node { return v } -func (LinkToAny) Kind() pd1.Kind { - return pd1.Kind_Link +func (LinkToAny) Kind() pd2.Kind { + return pd2.Kind_Link } -func (LinkToAny) LookupByString(string) (pd1.Node, error) { - return nil, pd2.ErrNA +func (LinkToAny) LookupByString(string) (pd2.Node, error) { + return nil, pd1.ErrNA } -func (LinkToAny) LookupByNode(key pd1.Node) (pd1.Node, error) { - return nil, pd2.ErrNA +func (LinkToAny) LookupByNode(key pd2.Node) (pd2.Node, error) { + return nil, pd1.ErrNA } -func (LinkToAny) LookupByIndex(idx int64) (pd1.Node, error) { - return nil, pd2.ErrNA +func (LinkToAny) LookupByIndex(idx int64) (pd2.Node, error) { + return nil, pd1.ErrNA } -func (LinkToAny) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { - return nil, pd2.ErrNA +func (LinkToAny) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { + return nil, pd1.ErrNA } -func (LinkToAny) MapIterator() pd1.MapIterator { +func (LinkToAny) MapIterator() pd2.MapIterator { return nil } -func (LinkToAny) ListIterator() pd1.ListIterator { +func (LinkToAny) ListIterator() pd2.ListIterator { return nil } @@ -2904,30 +2944,30 @@ func (LinkToAny) IsNull() bool { } func (LinkToAny) AsBool() (bool, error) { - return false, pd2.ErrNA + return false, pd1.ErrNA } func (v LinkToAny) AsInt() (int64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (LinkToAny) AsFloat() (float64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (LinkToAny) AsString() (string, error) { - return "", pd2.ErrNA + return "", pd1.ErrNA } func (LinkToAny) AsBytes() ([]byte, error) { - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (v LinkToAny) AsLink() (pd1.Link, error) { - return pd16.Link{Cid: pd17.Cid(v)}, nil +func (v LinkToAny) AsLink() (pd2.Link, error) { + return pd17.Link{Cid: pd16.Cid(v)}, nil } -func (LinkToAny) Prototype() pd1.NodePrototype { +func (LinkToAny) Prototype() pd2.NodePrototype { return nil // not needed } @@ -2938,16 +2978,16 @@ type Provider struct { ProviderProto TransferProtocolList } -func (x Provider) Node() pd1.Node { +func (x Provider) Node() pd2.Node { return x } -func (x *Provider) Parse(n pd1.Node) error { - if n.Kind() != pd1.Kind_Map { - return pd2.ErrNA +func (x *Provider) Parse(n pd2.Node) error { + if n.Kind() != pd2.Kind_Map { + return pd1.ErrNA } iter := n.MapIterator() - fieldMap := map[string]pd2.ParseFunc{ + fieldMap := map[string]pd1.ParseFunc{ "Node": x.ProviderNode.Parse, "Proto": x.ProviderProto.Parse, } @@ -2982,7 +3022,7 @@ func (x *Provider) Parse(n pd1.Node) error { } } for _, fieldParse := range fieldMap { - if err := fieldParse(pd1.Null); err != nil { + if err := fieldParse(pd2.Null); err != nil { return err } } @@ -2994,27 +3034,27 @@ type Provider_MapIterator struct { s *Provider } -func (x *Provider_MapIterator) Next() (key pd1.Node, value pd1.Node, err error) { +func (x *Provider_MapIterator) Next() (key pd2.Node, value pd2.Node, err error) { x.i++ switch x.i { case 0: - return pd2.String("Node"), x.s.ProviderNode.Node(), nil + return pd1.String("Node"), x.s.ProviderNode.Node(), nil case 1: - return pd2.String("Proto"), x.s.ProviderProto.Node(), nil + return pd1.String("Proto"), x.s.ProviderProto.Node(), nil } - return nil, nil, pd2.ErrNA + return nil, nil, pd1.ErrNA } func (x *Provider_MapIterator) Done() bool { return x.i+1 >= 2 } -func (x Provider) Kind() pd1.Kind { - return pd1.Kind_Map +func (x Provider) Kind() pd2.Kind { + return pd2.Kind_Map } -func (x Provider) LookupByString(key string) (pd1.Node, error) { +func (x Provider) LookupByString(key string) (pd2.Node, error) { switch key { case "Node": return x.ProviderNode.Node(), nil @@ -3022,28 +3062,28 @@ func (x Provider) LookupByString(key string) (pd1.Node, error) { return x.ProviderProto.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x Provider) LookupByNode(key pd1.Node) (pd1.Node, error) { +func (x Provider) LookupByNode(key pd2.Node) (pd2.Node, error) { switch key.Kind() { - case pd1.Kind_String: + case pd2.Kind_String: if s, err := key.AsString(); err != nil { return nil, err } else { return x.LookupByString(s) } - case pd1.Kind_Int: + case pd2.Kind_Int: if i, err := key.AsInt(); err != nil { return nil, err } else { return x.LookupByIndex(i) } } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x Provider) LookupByIndex(idx int64) (pd1.Node, error) { +func (x Provider) LookupByIndex(idx int64) (pd2.Node, error) { switch idx { case 0: return x.ProviderNode.Node(), nil @@ -3051,10 +3091,10 @@ func (x Provider) LookupByIndex(idx int64) (pd1.Node, error) { return x.ProviderProto.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x Provider) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { +func (x Provider) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { switch seg.String() { case "0", "Node": return x.ProviderNode.Node(), nil @@ -3062,14 +3102,14 @@ func (x Provider) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { return x.ProviderProto.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x Provider) MapIterator() pd1.MapIterator { +func (x Provider) MapIterator() pd2.MapIterator { return &Provider_MapIterator{-1, &x} } -func (x Provider) ListIterator() pd1.ListIterator { +func (x Provider) ListIterator() pd2.ListIterator { return nil } @@ -3086,30 +3126,30 @@ func (x Provider) IsNull() bool { } func (x Provider) AsBool() (bool, error) { - return false, pd2.ErrNA + return false, pd1.ErrNA } func (x Provider) AsInt() (int64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (x Provider) AsFloat() (float64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (x Provider) AsString() (string, error) { - return "", pd2.ErrNA + return "", pd1.ErrNA } func (x Provider) AsBytes() ([]byte, error) { - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x Provider) AsLink() (pd1.Link, error) { - return nil, pd2.ErrNA +func (x Provider) AsLink() (pd2.Link, error) { + return nil, pd1.ErrNA } -func (x Provider) Prototype() pd1.NodePrototype { +func (x Provider) Prototype() pd2.NodePrototype { return nil } @@ -3117,23 +3157,23 @@ func (x Provider) Prototype() pd1.NodePrototype { type TransferProtocolList []TransferProtocol -func (v TransferProtocolList) Node() pd1.Node { +func (v TransferProtocolList) Node() pd2.Node { return v } -func (v *TransferProtocolList) Parse(n pd1.Node) error { - if n.Kind() == pd1.Kind_Null { +func (v *TransferProtocolList) Parse(n pd2.Node) error { + if n.Kind() == pd2.Kind_Null { *v = nil return nil } - if n.Kind() != pd1.Kind_List { - return pd2.ErrNA + if n.Kind() != pd2.Kind_List { + return pd1.ErrNA } else { *v = make(TransferProtocolList, n.Length()) iter := n.ListIterator() for !iter.Done() { if i, n, err := iter.Next(); err != nil { - return pd2.ErrNA + return pd1.ErrNA } else if err = (*v)[i].Parse(n); err != nil { return err } @@ -3142,39 +3182,39 @@ func (v *TransferProtocolList) Parse(n pd1.Node) error { } } -func (TransferProtocolList) Kind() pd1.Kind { - return pd1.Kind_List +func (TransferProtocolList) Kind() pd2.Kind { + return pd2.Kind_List } -func (TransferProtocolList) LookupByString(string) (pd1.Node, error) { - return nil, pd2.ErrNA +func (TransferProtocolList) LookupByString(string) (pd2.Node, error) { + return nil, pd1.ErrNA } -func (TransferProtocolList) LookupByNode(key pd1.Node) (pd1.Node, error) { - return nil, pd2.ErrNA +func (TransferProtocolList) LookupByNode(key pd2.Node) (pd2.Node, error) { + return nil, pd1.ErrNA } -func (v TransferProtocolList) LookupByIndex(i int64) (pd1.Node, error) { +func (v TransferProtocolList) LookupByIndex(i int64) (pd2.Node, error) { if i < 0 || i >= v.Length() { - return nil, pd2.ErrBounds + return nil, pd1.ErrBounds } else { return v[i].Node(), nil } } -func (v TransferProtocolList) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { +func (v TransferProtocolList) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { if i, err := seg.Index(); err != nil { - return nil, pd2.ErrNA + return nil, pd1.ErrNA } else { return v.LookupByIndex(i) } } -func (TransferProtocolList) MapIterator() pd1.MapIterator { +func (TransferProtocolList) MapIterator() pd2.MapIterator { return nil } -func (v TransferProtocolList) ListIterator() pd1.ListIterator { +func (v TransferProtocolList) ListIterator() pd2.ListIterator { return &TransferProtocolList_ListIterator{v, 0} } @@ -3191,30 +3231,30 @@ func (TransferProtocolList) IsNull() bool { } func (v TransferProtocolList) AsBool() (bool, error) { - return false, pd2.ErrNA + return false, pd1.ErrNA } func (TransferProtocolList) AsInt() (int64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (TransferProtocolList) AsFloat() (float64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (TransferProtocolList) AsString() (string, error) { - return "", pd2.ErrNA + return "", pd1.ErrNA } func (TransferProtocolList) AsBytes() ([]byte, error) { - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (TransferProtocolList) AsLink() (pd1.Link, error) { - return nil, pd2.ErrNA +func (TransferProtocolList) AsLink() (pd2.Link, error) { + return nil, pd1.ErrNA } -func (TransferProtocolList) Prototype() pd1.NodePrototype { +func (TransferProtocolList) Prototype() pd2.NodePrototype { return nil // not needed } @@ -3223,9 +3263,9 @@ type TransferProtocolList_ListIterator struct { at int64 } -func (iter *TransferProtocolList_ListIterator) Next() (int64, pd1.Node, error) { +func (iter *TransferProtocolList_ListIterator) Next() (int64, pd2.Node, error) { if iter.Done() { - return -1, nil, pd2.ErrBounds + return -1, nil, pd1.ErrBounds } v := iter.list[iter.at] i := int64(iter.at) @@ -3243,13 +3283,13 @@ type Node struct { Peer *Peer DefaultKey string - DefaultValue *pd2.Any + DefaultValue *pd1.Any } -func (x *Node) Parse(n pd1.Node) error { +func (x *Node) Parse(n pd2.Node) error { *x = Node{} - if n.Kind() != pd1.Kind_Map { - return pd2.ErrNA + if n.Kind() != pd2.Kind_Map { + return pd1.ErrNA } iter := n.MapIterator() kn, vn, err := iter.Next() @@ -3270,7 +3310,7 @@ func (x *Node) Parse(n pd1.Node) error { return nil default: - var y pd2.Any + var y pd1.Any if err := y.Parse(vn); err != nil { return err } @@ -3287,17 +3327,17 @@ type Node_MapIterator struct { s *Node } -func (x *Node_MapIterator) Next() (key pd1.Node, value pd1.Node, err error) { +func (x *Node_MapIterator) Next() (key pd2.Node, value pd2.Node, err error) { if x.done { - return nil, nil, pd2.ErrNA + return nil, nil, pd1.ErrNA } else { x.done = true switch { case x.s.Peer != nil: - return pd2.String("peer"), x.s.Peer.Node(), nil + return pd1.String("peer"), x.s.Peer.Node(), nil case x.s.DefaultValue != nil: - return pd2.String(x.s.DefaultKey), x.s.DefaultValue.Node(), nil + return pd1.String(x.s.DefaultKey), x.s.DefaultValue.Node(), nil default: return nil, nil, pd3.Errorf("no inductive cases are set") @@ -3309,15 +3349,15 @@ func (x *Node_MapIterator) Done() bool { return x.done } -func (x Node) Node() pd1.Node { +func (x Node) Node() pd2.Node { return x } -func (x Node) Kind() pd1.Kind { - return pd1.Kind_Map +func (x Node) Kind() pd2.Kind { + return pd2.Kind_Map } -func (x Node) LookupByString(key string) (pd1.Node, error) { +func (x Node) LookupByString(key string) (pd2.Node, error) { switch { case x.Peer != nil && key == "peer": return x.Peer.Node(), nil @@ -3326,12 +3366,12 @@ func (x Node) LookupByString(key string) (pd1.Node, error) { return x.DefaultValue.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x Node) LookupByNode(key pd1.Node) (pd1.Node, error) { - if key.Kind() != pd1.Kind_String { - return nil, pd2.ErrNA +func (x Node) LookupByNode(key pd2.Node) (pd2.Node, error) { + if key.Kind() != pd2.Kind_String { + return nil, pd1.ErrNA } if s, err := key.AsString(); err != nil { return nil, err @@ -3340,11 +3380,11 @@ func (x Node) LookupByNode(key pd1.Node) (pd1.Node, error) { } } -func (x Node) LookupByIndex(idx int64) (pd1.Node, error) { - return nil, pd2.ErrNA +func (x Node) LookupByIndex(idx int64) (pd2.Node, error) { + return nil, pd1.ErrNA } -func (x Node) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { +func (x Node) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { switch seg.String() { case "peer": return x.Peer.Node(), nil @@ -3353,14 +3393,14 @@ func (x Node) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { return x.DefaultValue.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x Node) MapIterator() pd1.MapIterator { +func (x Node) MapIterator() pd2.MapIterator { return &Node_MapIterator{false, &x} } -func (x Node) ListIterator() pd1.ListIterator { +func (x Node) ListIterator() pd2.ListIterator { return nil } @@ -3377,54 +3417,54 @@ func (x Node) IsNull() bool { } func (x Node) AsBool() (bool, error) { - return false, pd2.ErrNA + return false, pd1.ErrNA } func (x Node) AsInt() (int64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (x Node) AsFloat() (float64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (x Node) AsString() (string, error) { - return "", pd2.ErrNA + return "", pd1.ErrNA } func (x Node) AsBytes() ([]byte, error) { - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x Node) AsLink() (pd1.Link, error) { - return nil, pd2.ErrNA +func (x Node) AsLink() (pd2.Link, error) { + return nil, pd1.ErrNA } -func (x Node) Prototype() pd1.NodePrototype { +func (x Node) Prototype() pd2.NodePrototype { return nil } // -- protocol type AnonList18 -- -type AnonList18 []pd2.Bytes +type AnonList18 []pd1.Bytes -func (v AnonList18) Node() pd1.Node { +func (v AnonList18) Node() pd2.Node { return v } -func (v *AnonList18) Parse(n pd1.Node) error { - if n.Kind() == pd1.Kind_Null { +func (v *AnonList18) Parse(n pd2.Node) error { + if n.Kind() == pd2.Kind_Null { *v = nil return nil } - if n.Kind() != pd1.Kind_List { - return pd2.ErrNA + if n.Kind() != pd2.Kind_List { + return pd1.ErrNA } else { *v = make(AnonList18, n.Length()) iter := n.ListIterator() for !iter.Done() { if i, n, err := iter.Next(); err != nil { - return pd2.ErrNA + return pd1.ErrNA } else if err = (*v)[i].Parse(n); err != nil { return err } @@ -3433,39 +3473,39 @@ func (v *AnonList18) Parse(n pd1.Node) error { } } -func (AnonList18) Kind() pd1.Kind { - return pd1.Kind_List +func (AnonList18) Kind() pd2.Kind { + return pd2.Kind_List } -func (AnonList18) LookupByString(string) (pd1.Node, error) { - return nil, pd2.ErrNA +func (AnonList18) LookupByString(string) (pd2.Node, error) { + return nil, pd1.ErrNA } -func (AnonList18) LookupByNode(key pd1.Node) (pd1.Node, error) { - return nil, pd2.ErrNA +func (AnonList18) LookupByNode(key pd2.Node) (pd2.Node, error) { + return nil, pd1.ErrNA } -func (v AnonList18) LookupByIndex(i int64) (pd1.Node, error) { +func (v AnonList18) LookupByIndex(i int64) (pd2.Node, error) { if i < 0 || i >= v.Length() { - return nil, pd2.ErrBounds + return nil, pd1.ErrBounds } else { return v[i].Node(), nil } } -func (v AnonList18) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { +func (v AnonList18) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { if i, err := seg.Index(); err != nil { - return nil, pd2.ErrNA + return nil, pd1.ErrNA } else { return v.LookupByIndex(i) } } -func (AnonList18) MapIterator() pd1.MapIterator { +func (AnonList18) MapIterator() pd2.MapIterator { return nil } -func (v AnonList18) ListIterator() pd1.ListIterator { +func (v AnonList18) ListIterator() pd2.ListIterator { return &AnonList18_ListIterator{v, 0} } @@ -3482,30 +3522,30 @@ func (AnonList18) IsNull() bool { } func (v AnonList18) AsBool() (bool, error) { - return false, pd2.ErrNA + return false, pd1.ErrNA } func (AnonList18) AsInt() (int64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (AnonList18) AsFloat() (float64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (AnonList18) AsString() (string, error) { - return "", pd2.ErrNA + return "", pd1.ErrNA } func (AnonList18) AsBytes() ([]byte, error) { - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (AnonList18) AsLink() (pd1.Link, error) { - return nil, pd2.ErrNA +func (AnonList18) AsLink() (pd2.Link, error) { + return nil, pd1.ErrNA } -func (AnonList18) Prototype() pd1.NodePrototype { +func (AnonList18) Prototype() pd2.NodePrototype { return nil // not needed } @@ -3514,9 +3554,9 @@ type AnonList18_ListIterator struct { at int64 } -func (iter *AnonList18_ListIterator) Next() (int64, pd1.Node, error) { +func (iter *AnonList18_ListIterator) Next() (int64, pd2.Node, error) { if iter.Done() { - return -1, nil, pd2.ErrBounds + return -1, nil, pd1.ErrBounds } v := iter.list[iter.at] i := int64(iter.at) @@ -3531,20 +3571,20 @@ func (iter *AnonList18_ListIterator) Done() bool { // -- protocol type Peer -- type Peer struct { - ID pd2.Bytes + ID pd1.Bytes Multiaddresses AnonList18 } -func (x Peer) Node() pd1.Node { +func (x Peer) Node() pd2.Node { return x } -func (x *Peer) Parse(n pd1.Node) error { - if n.Kind() != pd1.Kind_Map { - return pd2.ErrNA +func (x *Peer) Parse(n pd2.Node) error { + if n.Kind() != pd2.Kind_Map { + return pd1.ErrNA } iter := n.MapIterator() - fieldMap := map[string]pd2.ParseFunc{ + fieldMap := map[string]pd1.ParseFunc{ "ID": x.ID.Parse, "Multiaddresses": x.Multiaddresses.Parse, } @@ -3579,7 +3619,7 @@ func (x *Peer) Parse(n pd1.Node) error { } } for _, fieldParse := range fieldMap { - if err := fieldParse(pd1.Null); err != nil { + if err := fieldParse(pd2.Null); err != nil { return err } } @@ -3591,27 +3631,27 @@ type Peer_MapIterator struct { s *Peer } -func (x *Peer_MapIterator) Next() (key pd1.Node, value pd1.Node, err error) { +func (x *Peer_MapIterator) Next() (key pd2.Node, value pd2.Node, err error) { x.i++ switch x.i { case 0: - return pd2.String("ID"), x.s.ID.Node(), nil + return pd1.String("ID"), x.s.ID.Node(), nil case 1: - return pd2.String("Multiaddresses"), x.s.Multiaddresses.Node(), nil + return pd1.String("Multiaddresses"), x.s.Multiaddresses.Node(), nil } - return nil, nil, pd2.ErrNA + return nil, nil, pd1.ErrNA } func (x *Peer_MapIterator) Done() bool { return x.i+1 >= 2 } -func (x Peer) Kind() pd1.Kind { - return pd1.Kind_Map +func (x Peer) Kind() pd2.Kind { + return pd2.Kind_Map } -func (x Peer) LookupByString(key string) (pd1.Node, error) { +func (x Peer) LookupByString(key string) (pd2.Node, error) { switch key { case "ID": return x.ID.Node(), nil @@ -3619,28 +3659,28 @@ func (x Peer) LookupByString(key string) (pd1.Node, error) { return x.Multiaddresses.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x Peer) LookupByNode(key pd1.Node) (pd1.Node, error) { +func (x Peer) LookupByNode(key pd2.Node) (pd2.Node, error) { switch key.Kind() { - case pd1.Kind_String: + case pd2.Kind_String: if s, err := key.AsString(); err != nil { return nil, err } else { return x.LookupByString(s) } - case pd1.Kind_Int: + case pd2.Kind_Int: if i, err := key.AsInt(); err != nil { return nil, err } else { return x.LookupByIndex(i) } } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x Peer) LookupByIndex(idx int64) (pd1.Node, error) { +func (x Peer) LookupByIndex(idx int64) (pd2.Node, error) { switch idx { case 0: return x.ID.Node(), nil @@ -3648,10 +3688,10 @@ func (x Peer) LookupByIndex(idx int64) (pd1.Node, error) { return x.Multiaddresses.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x Peer) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { +func (x Peer) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { switch seg.String() { case "0", "ID": return x.ID.Node(), nil @@ -3659,14 +3699,14 @@ func (x Peer) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { return x.Multiaddresses.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x Peer) MapIterator() pd1.MapIterator { +func (x Peer) MapIterator() pd2.MapIterator { return &Peer_MapIterator{-1, &x} } -func (x Peer) ListIterator() pd1.ListIterator { +func (x Peer) ListIterator() pd2.ListIterator { return nil } @@ -3683,30 +3723,30 @@ func (x Peer) IsNull() bool { } func (x Peer) AsBool() (bool, error) { - return false, pd2.ErrNA + return false, pd1.ErrNA } func (x Peer) AsInt() (int64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (x Peer) AsFloat() (float64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (x Peer) AsString() (string, error) { - return "", pd2.ErrNA + return "", pd1.ErrNA } func (x Peer) AsBytes() ([]byte, error) { - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x Peer) AsLink() (pd1.Link, error) { - return nil, pd2.ErrNA +func (x Peer) AsLink() (pd2.Link, error) { + return nil, pd1.ErrNA } -func (x Peer) Prototype() pd1.NodePrototype { +func (x Peer) Prototype() pd2.NodePrototype { return nil } @@ -3717,13 +3757,13 @@ type TransferProtocol struct { GraphSyncFILv1 *GraphSyncFILv1Protocol DefaultKey string - DefaultValue *pd2.Any + DefaultValue *pd1.Any } -func (x *TransferProtocol) Parse(n pd1.Node) error { +func (x *TransferProtocol) Parse(n pd2.Node) error { *x = TransferProtocol{} - if n.Kind() != pd1.Kind_Map { - return pd2.ErrNA + if n.Kind() != pd2.Kind_Map { + return pd1.ErrNA } iter := n.MapIterator() kn, vn, err := iter.Next() @@ -3751,7 +3791,7 @@ func (x *TransferProtocol) Parse(n pd1.Node) error { return nil default: - var y pd2.Any + var y pd1.Any if err := y.Parse(vn); err != nil { return err } @@ -3768,19 +3808,19 @@ type TransferProtocol_MapIterator struct { s *TransferProtocol } -func (x *TransferProtocol_MapIterator) Next() (key pd1.Node, value pd1.Node, err error) { +func (x *TransferProtocol_MapIterator) Next() (key pd2.Node, value pd2.Node, err error) { if x.done { - return nil, nil, pd2.ErrNA + return nil, nil, pd1.ErrNA } else { x.done = true switch { case x.s.Bitswap != nil: - return pd2.String("2304"), x.s.Bitswap.Node(), nil + return pd1.String("2304"), x.s.Bitswap.Node(), nil case x.s.GraphSyncFILv1 != nil: - return pd2.String("2320"), x.s.GraphSyncFILv1.Node(), nil + return pd1.String("2320"), x.s.GraphSyncFILv1.Node(), nil case x.s.DefaultValue != nil: - return pd2.String(x.s.DefaultKey), x.s.DefaultValue.Node(), nil + return pd1.String(x.s.DefaultKey), x.s.DefaultValue.Node(), nil default: return nil, nil, pd3.Errorf("no inductive cases are set") @@ -3792,15 +3832,15 @@ func (x *TransferProtocol_MapIterator) Done() bool { return x.done } -func (x TransferProtocol) Node() pd1.Node { +func (x TransferProtocol) Node() pd2.Node { return x } -func (x TransferProtocol) Kind() pd1.Kind { - return pd1.Kind_Map +func (x TransferProtocol) Kind() pd2.Kind { + return pd2.Kind_Map } -func (x TransferProtocol) LookupByString(key string) (pd1.Node, error) { +func (x TransferProtocol) LookupByString(key string) (pd2.Node, error) { switch { case x.Bitswap != nil && key == "2304": return x.Bitswap.Node(), nil @@ -3811,12 +3851,12 @@ func (x TransferProtocol) LookupByString(key string) (pd1.Node, error) { return x.DefaultValue.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x TransferProtocol) LookupByNode(key pd1.Node) (pd1.Node, error) { - if key.Kind() != pd1.Kind_String { - return nil, pd2.ErrNA +func (x TransferProtocol) LookupByNode(key pd2.Node) (pd2.Node, error) { + if key.Kind() != pd2.Kind_String { + return nil, pd1.ErrNA } if s, err := key.AsString(); err != nil { return nil, err @@ -3825,11 +3865,11 @@ func (x TransferProtocol) LookupByNode(key pd1.Node) (pd1.Node, error) { } } -func (x TransferProtocol) LookupByIndex(idx int64) (pd1.Node, error) { - return nil, pd2.ErrNA +func (x TransferProtocol) LookupByIndex(idx int64) (pd2.Node, error) { + return nil, pd1.ErrNA } -func (x TransferProtocol) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { +func (x TransferProtocol) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { switch seg.String() { case "2304": return x.Bitswap.Node(), nil @@ -3840,14 +3880,14 @@ func (x TransferProtocol) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) return x.DefaultValue.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x TransferProtocol) MapIterator() pd1.MapIterator { +func (x TransferProtocol) MapIterator() pd2.MapIterator { return &TransferProtocol_MapIterator{false, &x} } -func (x TransferProtocol) ListIterator() pd1.ListIterator { +func (x TransferProtocol) ListIterator() pd2.ListIterator { return nil } @@ -3864,30 +3904,30 @@ func (x TransferProtocol) IsNull() bool { } func (x TransferProtocol) AsBool() (bool, error) { - return false, pd2.ErrNA + return false, pd1.ErrNA } func (x TransferProtocol) AsInt() (int64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (x TransferProtocol) AsFloat() (float64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (x TransferProtocol) AsString() (string, error) { - return "", pd2.ErrNA + return "", pd1.ErrNA } func (x TransferProtocol) AsBytes() ([]byte, error) { - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x TransferProtocol) AsLink() (pd1.Link, error) { - return nil, pd2.ErrNA +func (x TransferProtocol) AsLink() (pd2.Link, error) { + return nil, pd1.ErrNA } -func (x TransferProtocol) Prototype() pd1.NodePrototype { +func (x TransferProtocol) Prototype() pd2.NodePrototype { return nil } @@ -3896,16 +3936,16 @@ func (x TransferProtocol) Prototype() pd1.NodePrototype { type BitswapProtocol struct { } -func (x BitswapProtocol) Node() pd1.Node { +func (x BitswapProtocol) Node() pd2.Node { return x } -func (x *BitswapProtocol) Parse(n pd1.Node) error { - if n.Kind() != pd1.Kind_Map { - return pd2.ErrNA +func (x *BitswapProtocol) Parse(n pd2.Node) error { + if n.Kind() != pd2.Kind_Map { + return pd1.ErrNA } iter := n.MapIterator() - fieldMap := map[string]pd2.ParseFunc{} + fieldMap := map[string]pd1.ParseFunc{} for !iter.Done() { if kn, vn, err := iter.Next(); err != nil { return err @@ -3921,7 +3961,7 @@ func (x *BitswapProtocol) Parse(n pd1.Node) error { } } for _, fieldParse := range fieldMap { - if err := fieldParse(pd1.Null); err != nil { + if err := fieldParse(pd2.Null); err != nil { return err } } @@ -3933,66 +3973,66 @@ type BitswapProtocol_MapIterator struct { s *BitswapProtocol } -func (x *BitswapProtocol_MapIterator) Next() (key pd1.Node, value pd1.Node, err error) { +func (x *BitswapProtocol_MapIterator) Next() (key pd2.Node, value pd2.Node, err error) { x.i++ switch x.i { } - return nil, nil, pd2.ErrNA + return nil, nil, pd1.ErrNA } func (x *BitswapProtocol_MapIterator) Done() bool { return x.i+1 >= 0 } -func (x BitswapProtocol) Kind() pd1.Kind { - return pd1.Kind_Map +func (x BitswapProtocol) Kind() pd2.Kind { + return pd2.Kind_Map } -func (x BitswapProtocol) LookupByString(key string) (pd1.Node, error) { +func (x BitswapProtocol) LookupByString(key string) (pd2.Node, error) { switch key { } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x BitswapProtocol) LookupByNode(key pd1.Node) (pd1.Node, error) { +func (x BitswapProtocol) LookupByNode(key pd2.Node) (pd2.Node, error) { switch key.Kind() { - case pd1.Kind_String: + case pd2.Kind_String: if s, err := key.AsString(); err != nil { return nil, err } else { return x.LookupByString(s) } - case pd1.Kind_Int: + case pd2.Kind_Int: if i, err := key.AsInt(); err != nil { return nil, err } else { return x.LookupByIndex(i) } } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x BitswapProtocol) LookupByIndex(idx int64) (pd1.Node, error) { +func (x BitswapProtocol) LookupByIndex(idx int64) (pd2.Node, error) { switch idx { } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x BitswapProtocol) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { +func (x BitswapProtocol) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { switch seg.String() { } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x BitswapProtocol) MapIterator() pd1.MapIterator { +func (x BitswapProtocol) MapIterator() pd2.MapIterator { return &BitswapProtocol_MapIterator{-1, &x} } -func (x BitswapProtocol) ListIterator() pd1.ListIterator { +func (x BitswapProtocol) ListIterator() pd2.ListIterator { return nil } @@ -4009,30 +4049,30 @@ func (x BitswapProtocol) IsNull() bool { } func (x BitswapProtocol) AsBool() (bool, error) { - return false, pd2.ErrNA + return false, pd1.ErrNA } func (x BitswapProtocol) AsInt() (int64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (x BitswapProtocol) AsFloat() (float64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (x BitswapProtocol) AsString() (string, error) { - return "", pd2.ErrNA + return "", pd1.ErrNA } func (x BitswapProtocol) AsBytes() ([]byte, error) { - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x BitswapProtocol) AsLink() (pd1.Link, error) { - return nil, pd2.ErrNA +func (x BitswapProtocol) AsLink() (pd2.Link, error) { + return nil, pd1.ErrNA } -func (x BitswapProtocol) Prototype() pd1.NodePrototype { +func (x BitswapProtocol) Prototype() pd2.NodePrototype { return nil } @@ -4040,20 +4080,20 @@ func (x BitswapProtocol) Prototype() pd1.NodePrototype { type GraphSyncFILv1Protocol struct { PieceCID LinkToAny - VerifiedDeal pd2.Bool - FastRetrieval pd2.Bool + VerifiedDeal pd1.Bool + FastRetrieval pd1.Bool } -func (x GraphSyncFILv1Protocol) Node() pd1.Node { +func (x GraphSyncFILv1Protocol) Node() pd2.Node { return x } -func (x *GraphSyncFILv1Protocol) Parse(n pd1.Node) error { - if n.Kind() != pd1.Kind_Map { - return pd2.ErrNA +func (x *GraphSyncFILv1Protocol) Parse(n pd2.Node) error { + if n.Kind() != pd2.Kind_Map { + return pd1.ErrNA } iter := n.MapIterator() - fieldMap := map[string]pd2.ParseFunc{ + fieldMap := map[string]pd1.ParseFunc{ "PieceCID": x.PieceCID.Parse, "VerifiedDeal": x.VerifiedDeal.Parse, "FastRetrieval": x.FastRetrieval.Parse, @@ -4097,7 +4137,7 @@ func (x *GraphSyncFILv1Protocol) Parse(n pd1.Node) error { } } for _, fieldParse := range fieldMap { - if err := fieldParse(pd1.Null); err != nil { + if err := fieldParse(pd2.Null); err != nil { return err } } @@ -4109,29 +4149,29 @@ type GraphSyncFILv1Protocol_MapIterator struct { s *GraphSyncFILv1Protocol } -func (x *GraphSyncFILv1Protocol_MapIterator) Next() (key pd1.Node, value pd1.Node, err error) { +func (x *GraphSyncFILv1Protocol_MapIterator) Next() (key pd2.Node, value pd2.Node, err error) { x.i++ switch x.i { case 0: - return pd2.String("PieceCID"), x.s.PieceCID.Node(), nil + return pd1.String("PieceCID"), x.s.PieceCID.Node(), nil case 1: - return pd2.String("VerifiedDeal"), x.s.VerifiedDeal.Node(), nil + return pd1.String("VerifiedDeal"), x.s.VerifiedDeal.Node(), nil case 2: - return pd2.String("FastRetrieval"), x.s.FastRetrieval.Node(), nil + return pd1.String("FastRetrieval"), x.s.FastRetrieval.Node(), nil } - return nil, nil, pd2.ErrNA + return nil, nil, pd1.ErrNA } func (x *GraphSyncFILv1Protocol_MapIterator) Done() bool { return x.i+1 >= 3 } -func (x GraphSyncFILv1Protocol) Kind() pd1.Kind { - return pd1.Kind_Map +func (x GraphSyncFILv1Protocol) Kind() pd2.Kind { + return pd2.Kind_Map } -func (x GraphSyncFILv1Protocol) LookupByString(key string) (pd1.Node, error) { +func (x GraphSyncFILv1Protocol) LookupByString(key string) (pd2.Node, error) { switch key { case "PieceCID": return x.PieceCID.Node(), nil @@ -4141,28 +4181,28 @@ func (x GraphSyncFILv1Protocol) LookupByString(key string) (pd1.Node, error) { return x.FastRetrieval.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x GraphSyncFILv1Protocol) LookupByNode(key pd1.Node) (pd1.Node, error) { +func (x GraphSyncFILv1Protocol) LookupByNode(key pd2.Node) (pd2.Node, error) { switch key.Kind() { - case pd1.Kind_String: + case pd2.Kind_String: if s, err := key.AsString(); err != nil { return nil, err } else { return x.LookupByString(s) } - case pd1.Kind_Int: + case pd2.Kind_Int: if i, err := key.AsInt(); err != nil { return nil, err } else { return x.LookupByIndex(i) } } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x GraphSyncFILv1Protocol) LookupByIndex(idx int64) (pd1.Node, error) { +func (x GraphSyncFILv1Protocol) LookupByIndex(idx int64) (pd2.Node, error) { switch idx { case 0: return x.PieceCID.Node(), nil @@ -4172,10 +4212,10 @@ func (x GraphSyncFILv1Protocol) LookupByIndex(idx int64) (pd1.Node, error) { return x.FastRetrieval.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x GraphSyncFILv1Protocol) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { +func (x GraphSyncFILv1Protocol) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { switch seg.String() { case "0", "PieceCID": return x.PieceCID.Node(), nil @@ -4185,14 +4225,14 @@ func (x GraphSyncFILv1Protocol) LookupBySegment(seg pd1.PathSegment) (pd1.Node, return x.FastRetrieval.Node(), nil } - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x GraphSyncFILv1Protocol) MapIterator() pd1.MapIterator { +func (x GraphSyncFILv1Protocol) MapIterator() pd2.MapIterator { return &GraphSyncFILv1Protocol_MapIterator{-1, &x} } -func (x GraphSyncFILv1Protocol) ListIterator() pd1.ListIterator { +func (x GraphSyncFILv1Protocol) ListIterator() pd2.ListIterator { return nil } @@ -4209,29 +4249,29 @@ func (x GraphSyncFILv1Protocol) IsNull() bool { } func (x GraphSyncFILv1Protocol) AsBool() (bool, error) { - return false, pd2.ErrNA + return false, pd1.ErrNA } func (x GraphSyncFILv1Protocol) AsInt() (int64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (x GraphSyncFILv1Protocol) AsFloat() (float64, error) { - return 0, pd2.ErrNA + return 0, pd1.ErrNA } func (x GraphSyncFILv1Protocol) AsString() (string, error) { - return "", pd2.ErrNA + return "", pd1.ErrNA } func (x GraphSyncFILv1Protocol) AsBytes() ([]byte, error) { - return nil, pd2.ErrNA + return nil, pd1.ErrNA } -func (x GraphSyncFILv1Protocol) AsLink() (pd1.Link, error) { - return nil, pd2.ErrNA +func (x GraphSyncFILv1Protocol) AsLink() (pd2.Link, error) { + return nil, pd1.ErrNA } -func (x GraphSyncFILv1Protocol) Prototype() pd1.NodePrototype { +func (x GraphSyncFILv1Protocol) Prototype() pd2.NodePrototype { return nil } diff --git a/gen/routing.go b/gen/routing.go index 0b8a029..5f56d3c 100644 --- a/gen/routing.go +++ b/gen/routing.go @@ -1,3 +1,4 @@ +//go:generate go run ./routing.go package main import ( From beec7dfd842298882d251a4522ef88729ebe1190 Mon Sep 17 00:00:00 2001 From: Petar Maymounkov Date: Mon, 13 Jun 2022 14:04:52 -0700 Subject: [PATCH 4/5] update edlweiss dep --- gen/proto/proto_edelweiss.go | 1535 +++++++++++++++++----------------- go.mod | 2 +- go.sum | 4 +- 3 files changed, 775 insertions(+), 766 deletions(-) diff --git a/gen/proto/proto_edelweiss.go b/gen/proto/proto_edelweiss.go index d103156..b118c58 100644 --- a/gen/proto/proto_edelweiss.go +++ b/gen/proto/proto_edelweiss.go @@ -3,24 +3,24 @@ package proto import ( - pd7 "bytes" + pd11 "bytes" pd9 "context" - pd10 "errors" + pd12 "errors" pd3 "fmt" - pd11 "io" + pd8 "io" pd15 "io/ioutil" pd4 "net/http" - pd6 "net/url" - pd13 "sync" - - pd16 "github.com/ipfs/go-cid" - pd14 "github.com/ipfs/go-log" - pd12 "github.com/ipld/edelweiss/services" - pd1 "github.com/ipld/edelweiss/values" - pd5 "github.com/ipld/go-ipld-prime" - pd8 "github.com/ipld/go-ipld-prime/codec/dagjson" - pd2 "github.com/ipld/go-ipld-prime/datamodel" - pd17 "github.com/ipld/go-ipld-prime/linking/cid" + pd5 "net/url" + pd6 "sync" + + pd17 "github.com/ipfs/go-cid" + pd13 "github.com/ipfs/go-log" + pd14 "github.com/ipld/edelweiss/services" + pd2 "github.com/ipld/edelweiss/values" + pd10 "github.com/ipld/go-ipld-prime" + pd7 "github.com/ipld/go-ipld-prime/codec/dagjson" + pd1 "github.com/ipld/go-ipld-prime/datamodel" + pd16 "github.com/ipld/go-ipld-prime/linking/cid" ) // -- protocol type DelegatedRouting_IdentifyArg -- @@ -28,16 +28,16 @@ import ( type DelegatedRouting_IdentifyArg struct { } -func (x DelegatedRouting_IdentifyArg) Node() pd2.Node { +func (x DelegatedRouting_IdentifyArg) Node() pd1.Node { return x } -func (x *DelegatedRouting_IdentifyArg) Parse(n pd2.Node) error { - if n.Kind() != pd2.Kind_Map { - return pd1.ErrNA +func (x *DelegatedRouting_IdentifyArg) Parse(n pd1.Node) error { + if n.Kind() != pd1.Kind_Map { + return pd2.ErrNA } iter := n.MapIterator() - fieldMap := map[string]pd1.ParseFunc{} + fieldMap := map[string]pd2.ParseFunc{} for !iter.Done() { if kn, vn, err := iter.Next(); err != nil { return err @@ -53,7 +53,7 @@ func (x *DelegatedRouting_IdentifyArg) Parse(n pd2.Node) error { } } for _, fieldParse := range fieldMap { - if err := fieldParse(pd2.Null); err != nil { + if err := fieldParse(pd1.Null); err != nil { return err } } @@ -65,66 +65,66 @@ type DelegatedRouting_IdentifyArg_MapIterator struct { s *DelegatedRouting_IdentifyArg } -func (x *DelegatedRouting_IdentifyArg_MapIterator) Next() (key pd2.Node, value pd2.Node, err error) { +func (x *DelegatedRouting_IdentifyArg_MapIterator) Next() (key pd1.Node, value pd1.Node, err error) { x.i++ switch x.i { } - return nil, nil, pd1.ErrNA + return nil, nil, pd2.ErrNA } func (x *DelegatedRouting_IdentifyArg_MapIterator) Done() bool { return x.i+1 >= 0 } -func (x DelegatedRouting_IdentifyArg) Kind() pd2.Kind { - return pd2.Kind_Map +func (x DelegatedRouting_IdentifyArg) Kind() pd1.Kind { + return pd1.Kind_Map } -func (x DelegatedRouting_IdentifyArg) LookupByString(key string) (pd2.Node, error) { +func (x DelegatedRouting_IdentifyArg) LookupByString(key string) (pd1.Node, error) { switch key { } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x DelegatedRouting_IdentifyArg) LookupByNode(key pd2.Node) (pd2.Node, error) { +func (x DelegatedRouting_IdentifyArg) LookupByNode(key pd1.Node) (pd1.Node, error) { switch key.Kind() { - case pd2.Kind_String: + case pd1.Kind_String: if s, err := key.AsString(); err != nil { return nil, err } else { return x.LookupByString(s) } - case pd2.Kind_Int: + case pd1.Kind_Int: if i, err := key.AsInt(); err != nil { return nil, err } else { return x.LookupByIndex(i) } } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x DelegatedRouting_IdentifyArg) LookupByIndex(idx int64) (pd2.Node, error) { +func (x DelegatedRouting_IdentifyArg) LookupByIndex(idx int64) (pd1.Node, error) { switch idx { } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x DelegatedRouting_IdentifyArg) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { +func (x DelegatedRouting_IdentifyArg) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { switch seg.String() { } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x DelegatedRouting_IdentifyArg) MapIterator() pd2.MapIterator { +func (x DelegatedRouting_IdentifyArg) MapIterator() pd1.MapIterator { return &DelegatedRouting_IdentifyArg_MapIterator{-1, &x} } -func (x DelegatedRouting_IdentifyArg) ListIterator() pd2.ListIterator { +func (x DelegatedRouting_IdentifyArg) ListIterator() pd1.ListIterator { return nil } @@ -141,54 +141,54 @@ func (x DelegatedRouting_IdentifyArg) IsNull() bool { } func (x DelegatedRouting_IdentifyArg) AsBool() (bool, error) { - return false, pd1.ErrNA + return false, pd2.ErrNA } func (x DelegatedRouting_IdentifyArg) AsInt() (int64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (x DelegatedRouting_IdentifyArg) AsFloat() (float64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (x DelegatedRouting_IdentifyArg) AsString() (string, error) { - return "", pd1.ErrNA + return "", pd2.ErrNA } func (x DelegatedRouting_IdentifyArg) AsBytes() ([]byte, error) { - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x DelegatedRouting_IdentifyArg) AsLink() (pd2.Link, error) { - return nil, pd1.ErrNA +func (x DelegatedRouting_IdentifyArg) AsLink() (pd1.Link, error) { + return nil, pd2.ErrNA } -func (x DelegatedRouting_IdentifyArg) Prototype() pd2.NodePrototype { +func (x DelegatedRouting_IdentifyArg) Prototype() pd1.NodePrototype { return nil } // -- protocol type AnonList1 -- -type AnonList1 []pd1.String +type AnonList1 []pd2.String -func (v AnonList1) Node() pd2.Node { +func (v AnonList1) Node() pd1.Node { return v } -func (v *AnonList1) Parse(n pd2.Node) error { - if n.Kind() == pd2.Kind_Null { +func (v *AnonList1) Parse(n pd1.Node) error { + if n.Kind() == pd1.Kind_Null { *v = nil return nil } - if n.Kind() != pd2.Kind_List { - return pd1.ErrNA + if n.Kind() != pd1.Kind_List { + return pd2.ErrNA } else { *v = make(AnonList1, n.Length()) iter := n.ListIterator() for !iter.Done() { if i, n, err := iter.Next(); err != nil { - return pd1.ErrNA + return pd2.ErrNA } else if err = (*v)[i].Parse(n); err != nil { return err } @@ -197,39 +197,39 @@ func (v *AnonList1) Parse(n pd2.Node) error { } } -func (AnonList1) Kind() pd2.Kind { - return pd2.Kind_List +func (AnonList1) Kind() pd1.Kind { + return pd1.Kind_List } -func (AnonList1) LookupByString(string) (pd2.Node, error) { - return nil, pd1.ErrNA +func (AnonList1) LookupByString(string) (pd1.Node, error) { + return nil, pd2.ErrNA } -func (AnonList1) LookupByNode(key pd2.Node) (pd2.Node, error) { - return nil, pd1.ErrNA +func (AnonList1) LookupByNode(key pd1.Node) (pd1.Node, error) { + return nil, pd2.ErrNA } -func (v AnonList1) LookupByIndex(i int64) (pd2.Node, error) { +func (v AnonList1) LookupByIndex(i int64) (pd1.Node, error) { if i < 0 || i >= v.Length() { - return nil, pd1.ErrBounds + return nil, pd2.ErrBounds } else { return v[i].Node(), nil } } -func (v AnonList1) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { +func (v AnonList1) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { if i, err := seg.Index(); err != nil { - return nil, pd1.ErrNA + return nil, pd2.ErrNA } else { return v.LookupByIndex(i) } } -func (AnonList1) MapIterator() pd2.MapIterator { +func (AnonList1) MapIterator() pd1.MapIterator { return nil } -func (v AnonList1) ListIterator() pd2.ListIterator { +func (v AnonList1) ListIterator() pd1.ListIterator { return &AnonList1_ListIterator{v, 0} } @@ -246,30 +246,30 @@ func (AnonList1) IsNull() bool { } func (v AnonList1) AsBool() (bool, error) { - return false, pd1.ErrNA + return false, pd2.ErrNA } func (AnonList1) AsInt() (int64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (AnonList1) AsFloat() (float64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (AnonList1) AsString() (string, error) { - return "", pd1.ErrNA + return "", pd2.ErrNA } func (AnonList1) AsBytes() ([]byte, error) { - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (AnonList1) AsLink() (pd2.Link, error) { - return nil, pd1.ErrNA +func (AnonList1) AsLink() (pd1.Link, error) { + return nil, pd2.ErrNA } -func (AnonList1) Prototype() pd2.NodePrototype { +func (AnonList1) Prototype() pd1.NodePrototype { return nil // not needed } @@ -278,9 +278,9 @@ type AnonList1_ListIterator struct { at int64 } -func (iter *AnonList1_ListIterator) Next() (int64, pd2.Node, error) { +func (iter *AnonList1_ListIterator) Next() (int64, pd1.Node, error) { if iter.Done() { - return -1, nil, pd1.ErrBounds + return -1, nil, pd2.ErrBounds } v := iter.list[iter.at] i := int64(iter.at) @@ -298,16 +298,16 @@ type DelegatedRouting_IdentifyResult struct { Methods AnonList1 } -func (x DelegatedRouting_IdentifyResult) Node() pd2.Node { +func (x DelegatedRouting_IdentifyResult) Node() pd1.Node { return x } -func (x *DelegatedRouting_IdentifyResult) Parse(n pd2.Node) error { - if n.Kind() != pd2.Kind_Map { - return pd1.ErrNA +func (x *DelegatedRouting_IdentifyResult) Parse(n pd1.Node) error { + if n.Kind() != pd1.Kind_Map { + return pd2.ErrNA } iter := n.MapIterator() - fieldMap := map[string]pd1.ParseFunc{ + fieldMap := map[string]pd2.ParseFunc{ "Methods": x.Methods.Parse, } for !iter.Done() { @@ -333,7 +333,7 @@ func (x *DelegatedRouting_IdentifyResult) Parse(n pd2.Node) error { } } for _, fieldParse := range fieldMap { - if err := fieldParse(pd2.Null); err != nil { + if err := fieldParse(pd1.Null); err != nil { return err } } @@ -345,74 +345,74 @@ type DelegatedRouting_IdentifyResult_MapIterator struct { s *DelegatedRouting_IdentifyResult } -func (x *DelegatedRouting_IdentifyResult_MapIterator) Next() (key pd2.Node, value pd2.Node, err error) { +func (x *DelegatedRouting_IdentifyResult_MapIterator) Next() (key pd1.Node, value pd1.Node, err error) { x.i++ switch x.i { case 0: - return pd1.String("Methods"), x.s.Methods.Node(), nil + return pd2.String("Methods"), x.s.Methods.Node(), nil } - return nil, nil, pd1.ErrNA + return nil, nil, pd2.ErrNA } func (x *DelegatedRouting_IdentifyResult_MapIterator) Done() bool { return x.i+1 >= 1 } -func (x DelegatedRouting_IdentifyResult) Kind() pd2.Kind { - return pd2.Kind_Map +func (x DelegatedRouting_IdentifyResult) Kind() pd1.Kind { + return pd1.Kind_Map } -func (x DelegatedRouting_IdentifyResult) LookupByString(key string) (pd2.Node, error) { +func (x DelegatedRouting_IdentifyResult) LookupByString(key string) (pd1.Node, error) { switch key { case "Methods": return x.Methods.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x DelegatedRouting_IdentifyResult) LookupByNode(key pd2.Node) (pd2.Node, error) { +func (x DelegatedRouting_IdentifyResult) LookupByNode(key pd1.Node) (pd1.Node, error) { switch key.Kind() { - case pd2.Kind_String: + case pd1.Kind_String: if s, err := key.AsString(); err != nil { return nil, err } else { return x.LookupByString(s) } - case pd2.Kind_Int: + case pd1.Kind_Int: if i, err := key.AsInt(); err != nil { return nil, err } else { return x.LookupByIndex(i) } } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x DelegatedRouting_IdentifyResult) LookupByIndex(idx int64) (pd2.Node, error) { +func (x DelegatedRouting_IdentifyResult) LookupByIndex(idx int64) (pd1.Node, error) { switch idx { case 0: return x.Methods.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x DelegatedRouting_IdentifyResult) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { +func (x DelegatedRouting_IdentifyResult) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { switch seg.String() { case "0", "Methods": return x.Methods.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x DelegatedRouting_IdentifyResult) MapIterator() pd2.MapIterator { +func (x DelegatedRouting_IdentifyResult) MapIterator() pd1.MapIterator { return &DelegatedRouting_IdentifyResult_MapIterator{-1, &x} } -func (x DelegatedRouting_IdentifyResult) ListIterator() pd2.ListIterator { +func (x DelegatedRouting_IdentifyResult) ListIterator() pd1.ListIterator { return nil } @@ -429,49 +429,49 @@ func (x DelegatedRouting_IdentifyResult) IsNull() bool { } func (x DelegatedRouting_IdentifyResult) AsBool() (bool, error) { - return false, pd1.ErrNA + return false, pd2.ErrNA } func (x DelegatedRouting_IdentifyResult) AsInt() (int64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (x DelegatedRouting_IdentifyResult) AsFloat() (float64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (x DelegatedRouting_IdentifyResult) AsString() (string, error) { - return "", pd1.ErrNA + return "", pd2.ErrNA } func (x DelegatedRouting_IdentifyResult) AsBytes() ([]byte, error) { - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x DelegatedRouting_IdentifyResult) AsLink() (pd2.Link, error) { - return nil, pd1.ErrNA +func (x DelegatedRouting_IdentifyResult) AsLink() (pd1.Link, error) { + return nil, pd2.ErrNA } -func (x DelegatedRouting_IdentifyResult) Prototype() pd2.NodePrototype { +func (x DelegatedRouting_IdentifyResult) Prototype() pd1.NodePrototype { return nil } // -- protocol type DelegatedRouting_Error -- type DelegatedRouting_Error struct { - Code pd1.String + Code pd2.String } -func (x DelegatedRouting_Error) Node() pd2.Node { +func (x DelegatedRouting_Error) Node() pd1.Node { return x } -func (x *DelegatedRouting_Error) Parse(n pd2.Node) error { - if n.Kind() != pd2.Kind_Map { - return pd1.ErrNA +func (x *DelegatedRouting_Error) Parse(n pd1.Node) error { + if n.Kind() != pd1.Kind_Map { + return pd2.ErrNA } iter := n.MapIterator() - fieldMap := map[string]pd1.ParseFunc{ + fieldMap := map[string]pd2.ParseFunc{ "Code": x.Code.Parse, } for !iter.Done() { @@ -497,7 +497,7 @@ func (x *DelegatedRouting_Error) Parse(n pd2.Node) error { } } for _, fieldParse := range fieldMap { - if err := fieldParse(pd2.Null); err != nil { + if err := fieldParse(pd1.Null); err != nil { return err } } @@ -509,74 +509,74 @@ type DelegatedRouting_Error_MapIterator struct { s *DelegatedRouting_Error } -func (x *DelegatedRouting_Error_MapIterator) Next() (key pd2.Node, value pd2.Node, err error) { +func (x *DelegatedRouting_Error_MapIterator) Next() (key pd1.Node, value pd1.Node, err error) { x.i++ switch x.i { case 0: - return pd1.String("Code"), x.s.Code.Node(), nil + return pd2.String("Code"), x.s.Code.Node(), nil } - return nil, nil, pd1.ErrNA + return nil, nil, pd2.ErrNA } func (x *DelegatedRouting_Error_MapIterator) Done() bool { return x.i+1 >= 1 } -func (x DelegatedRouting_Error) Kind() pd2.Kind { - return pd2.Kind_Map +func (x DelegatedRouting_Error) Kind() pd1.Kind { + return pd1.Kind_Map } -func (x DelegatedRouting_Error) LookupByString(key string) (pd2.Node, error) { +func (x DelegatedRouting_Error) LookupByString(key string) (pd1.Node, error) { switch key { case "Code": return x.Code.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x DelegatedRouting_Error) LookupByNode(key pd2.Node) (pd2.Node, error) { +func (x DelegatedRouting_Error) LookupByNode(key pd1.Node) (pd1.Node, error) { switch key.Kind() { - case pd2.Kind_String: + case pd1.Kind_String: if s, err := key.AsString(); err != nil { return nil, err } else { return x.LookupByString(s) } - case pd2.Kind_Int: + case pd1.Kind_Int: if i, err := key.AsInt(); err != nil { return nil, err } else { return x.LookupByIndex(i) } } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x DelegatedRouting_Error) LookupByIndex(idx int64) (pd2.Node, error) { +func (x DelegatedRouting_Error) LookupByIndex(idx int64) (pd1.Node, error) { switch idx { case 0: return x.Code.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x DelegatedRouting_Error) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { +func (x DelegatedRouting_Error) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { switch seg.String() { case "0", "Code": return x.Code.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x DelegatedRouting_Error) MapIterator() pd2.MapIterator { +func (x DelegatedRouting_Error) MapIterator() pd1.MapIterator { return &DelegatedRouting_Error_MapIterator{-1, &x} } -func (x DelegatedRouting_Error) ListIterator() pd2.ListIterator { +func (x DelegatedRouting_Error) ListIterator() pd1.ListIterator { return nil } @@ -593,30 +593,30 @@ func (x DelegatedRouting_Error) IsNull() bool { } func (x DelegatedRouting_Error) AsBool() (bool, error) { - return false, pd1.ErrNA + return false, pd2.ErrNA } func (x DelegatedRouting_Error) AsInt() (int64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (x DelegatedRouting_Error) AsFloat() (float64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (x DelegatedRouting_Error) AsString() (string, error) { - return "", pd1.ErrNA + return "", pd2.ErrNA } func (x DelegatedRouting_Error) AsBytes() ([]byte, error) { - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x DelegatedRouting_Error) AsLink() (pd2.Link, error) { - return nil, pd1.ErrNA +func (x DelegatedRouting_Error) AsLink() (pd1.Link, error) { + return nil, pd2.ErrNA } -func (x DelegatedRouting_Error) Prototype() pd2.NodePrototype { +func (x DelegatedRouting_Error) Prototype() pd1.NodePrototype { return nil } @@ -629,10 +629,10 @@ type AnonInductive4 struct { PutIPNS *PutIPNSRequest } -func (x *AnonInductive4) Parse(n pd2.Node) error { +func (x *AnonInductive4) Parse(n pd1.Node) error { *x = AnonInductive4{} - if n.Kind() != pd2.Kind_Map { - return pd1.ErrNA + if n.Kind() != pd1.Kind_Map { + return pd2.ErrNA } iter := n.MapIterator() kn, vn, err := iter.Next() @@ -684,20 +684,20 @@ type AnonInductive4_MapIterator struct { s *AnonInductive4 } -func (x *AnonInductive4_MapIterator) Next() (key pd2.Node, value pd2.Node, err error) { +func (x *AnonInductive4_MapIterator) Next() (key pd1.Node, value pd1.Node, err error) { if x.done { - return nil, nil, pd1.ErrNA + return nil, nil, pd2.ErrNA } else { x.done = true switch { case x.s.Identify != nil: - return pd1.String("IdentifyRequest"), x.s.Identify.Node(), nil + return pd2.String("IdentifyRequest"), x.s.Identify.Node(), nil case x.s.FindProviders != nil: - return pd1.String("FindProvidersRequest"), x.s.FindProviders.Node(), nil + return pd2.String("FindProvidersRequest"), x.s.FindProviders.Node(), nil case x.s.GetIPNS != nil: - return pd1.String("GetIPNSRequest"), x.s.GetIPNS.Node(), nil + return pd2.String("GetIPNSRequest"), x.s.GetIPNS.Node(), nil case x.s.PutIPNS != nil: - return pd1.String("PutIPNSRequest"), x.s.PutIPNS.Node(), nil + return pd2.String("PutIPNSRequest"), x.s.PutIPNS.Node(), nil default: return nil, nil, pd3.Errorf("no inductive cases are set") @@ -709,15 +709,15 @@ func (x *AnonInductive4_MapIterator) Done() bool { return x.done } -func (x AnonInductive4) Node() pd2.Node { +func (x AnonInductive4) Node() pd1.Node { return x } -func (x AnonInductive4) Kind() pd2.Kind { - return pd2.Kind_Map +func (x AnonInductive4) Kind() pd1.Kind { + return pd1.Kind_Map } -func (x AnonInductive4) LookupByString(key string) (pd2.Node, error) { +func (x AnonInductive4) LookupByString(key string) (pd1.Node, error) { switch { case x.Identify != nil && key == "IdentifyRequest": return x.Identify.Node(), nil @@ -729,12 +729,12 @@ func (x AnonInductive4) LookupByString(key string) (pd2.Node, error) { return x.PutIPNS.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x AnonInductive4) LookupByNode(key pd2.Node) (pd2.Node, error) { - if key.Kind() != pd2.Kind_String { - return nil, pd1.ErrNA +func (x AnonInductive4) LookupByNode(key pd1.Node) (pd1.Node, error) { + if key.Kind() != pd1.Kind_String { + return nil, pd2.ErrNA } if s, err := key.AsString(); err != nil { return nil, err @@ -743,11 +743,11 @@ func (x AnonInductive4) LookupByNode(key pd2.Node) (pd2.Node, error) { } } -func (x AnonInductive4) LookupByIndex(idx int64) (pd2.Node, error) { - return nil, pd1.ErrNA +func (x AnonInductive4) LookupByIndex(idx int64) (pd1.Node, error) { + return nil, pd2.ErrNA } -func (x AnonInductive4) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { +func (x AnonInductive4) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { switch seg.String() { case "IdentifyRequest": return x.Identify.Node(), nil @@ -759,14 +759,14 @@ func (x AnonInductive4) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { return x.PutIPNS.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x AnonInductive4) MapIterator() pd2.MapIterator { +func (x AnonInductive4) MapIterator() pd1.MapIterator { return &AnonInductive4_MapIterator{false, &x} } -func (x AnonInductive4) ListIterator() pd2.ListIterator { +func (x AnonInductive4) ListIterator() pd1.ListIterator { return nil } @@ -783,30 +783,30 @@ func (x AnonInductive4) IsNull() bool { } func (x AnonInductive4) AsBool() (bool, error) { - return false, pd1.ErrNA + return false, pd2.ErrNA } func (x AnonInductive4) AsInt() (int64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (x AnonInductive4) AsFloat() (float64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (x AnonInductive4) AsString() (string, error) { - return "", pd1.ErrNA + return "", pd2.ErrNA } func (x AnonInductive4) AsBytes() ([]byte, error) { - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x AnonInductive4) AsLink() (pd2.Link, error) { - return nil, pd1.ErrNA +func (x AnonInductive4) AsLink() (pd1.Link, error) { + return nil, pd2.ErrNA } -func (x AnonInductive4) Prototype() pd2.NodePrototype { +func (x AnonInductive4) Prototype() pd1.NodePrototype { return nil } @@ -820,10 +820,10 @@ type AnonInductive5 struct { Error *DelegatedRouting_Error } -func (x *AnonInductive5) Parse(n pd2.Node) error { +func (x *AnonInductive5) Parse(n pd1.Node) error { *x = AnonInductive5{} - if n.Kind() != pd2.Kind_Map { - return pd1.ErrNA + if n.Kind() != pd1.Kind_Map { + return pd2.ErrNA } iter := n.MapIterator() kn, vn, err := iter.Next() @@ -882,22 +882,22 @@ type AnonInductive5_MapIterator struct { s *AnonInductive5 } -func (x *AnonInductive5_MapIterator) Next() (key pd2.Node, value pd2.Node, err error) { +func (x *AnonInductive5_MapIterator) Next() (key pd1.Node, value pd1.Node, err error) { if x.done { - return nil, nil, pd1.ErrNA + return nil, nil, pd2.ErrNA } else { x.done = true switch { case x.s.Identify != nil: - return pd1.String("IdentifyResponse"), x.s.Identify.Node(), nil + return pd2.String("IdentifyResponse"), x.s.Identify.Node(), nil case x.s.FindProviders != nil: - return pd1.String("FindProvidersResponse"), x.s.FindProviders.Node(), nil + return pd2.String("FindProvidersResponse"), x.s.FindProviders.Node(), nil case x.s.GetIPNS != nil: - return pd1.String("GetIPNSResponse"), x.s.GetIPNS.Node(), nil + return pd2.String("GetIPNSResponse"), x.s.GetIPNS.Node(), nil case x.s.PutIPNS != nil: - return pd1.String("PutIPNSResponse"), x.s.PutIPNS.Node(), nil + return pd2.String("PutIPNSResponse"), x.s.PutIPNS.Node(), nil case x.s.Error != nil: - return pd1.String("Error"), x.s.Error.Node(), nil + return pd2.String("Error"), x.s.Error.Node(), nil default: return nil, nil, pd3.Errorf("no inductive cases are set") @@ -909,15 +909,15 @@ func (x *AnonInductive5_MapIterator) Done() bool { return x.done } -func (x AnonInductive5) Node() pd2.Node { +func (x AnonInductive5) Node() pd1.Node { return x } -func (x AnonInductive5) Kind() pd2.Kind { - return pd2.Kind_Map +func (x AnonInductive5) Kind() pd1.Kind { + return pd1.Kind_Map } -func (x AnonInductive5) LookupByString(key string) (pd2.Node, error) { +func (x AnonInductive5) LookupByString(key string) (pd1.Node, error) { switch { case x.Identify != nil && key == "IdentifyResponse": return x.Identify.Node(), nil @@ -931,12 +931,12 @@ func (x AnonInductive5) LookupByString(key string) (pd2.Node, error) { return x.Error.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x AnonInductive5) LookupByNode(key pd2.Node) (pd2.Node, error) { - if key.Kind() != pd2.Kind_String { - return nil, pd1.ErrNA +func (x AnonInductive5) LookupByNode(key pd1.Node) (pd1.Node, error) { + if key.Kind() != pd1.Kind_String { + return nil, pd2.ErrNA } if s, err := key.AsString(); err != nil { return nil, err @@ -945,11 +945,11 @@ func (x AnonInductive5) LookupByNode(key pd2.Node) (pd2.Node, error) { } } -func (x AnonInductive5) LookupByIndex(idx int64) (pd2.Node, error) { - return nil, pd1.ErrNA +func (x AnonInductive5) LookupByIndex(idx int64) (pd1.Node, error) { + return nil, pd2.ErrNA } -func (x AnonInductive5) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { +func (x AnonInductive5) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { switch seg.String() { case "IdentifyResponse": return x.Identify.Node(), nil @@ -963,14 +963,14 @@ func (x AnonInductive5) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { return x.Error.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x AnonInductive5) MapIterator() pd2.MapIterator { +func (x AnonInductive5) MapIterator() pd1.MapIterator { return &AnonInductive5_MapIterator{false, &x} } -func (x AnonInductive5) ListIterator() pd2.ListIterator { +func (x AnonInductive5) ListIterator() pd1.ListIterator { return nil } @@ -987,34 +987,34 @@ func (x AnonInductive5) IsNull() bool { } func (x AnonInductive5) AsBool() (bool, error) { - return false, pd1.ErrNA + return false, pd2.ErrNA } func (x AnonInductive5) AsInt() (int64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (x AnonInductive5) AsFloat() (float64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (x AnonInductive5) AsString() (string, error) { - return "", pd1.ErrNA + return "", pd2.ErrNA } func (x AnonInductive5) AsBytes() ([]byte, error) { - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x AnonInductive5) AsLink() (pd2.Link, error) { - return nil, pd1.ErrNA +func (x AnonInductive5) AsLink() (pd1.Link, error) { + return nil, pd2.ErrNA } -func (x AnonInductive5) Prototype() pd2.NodePrototype { +func (x AnonInductive5) Prototype() pd1.NodePrototype { return nil } -var logger_client_DelegatedRouting = pd14.Logger("service/client/delegatedrouting") +var logger_client_DelegatedRouting = pd13.Logger("service/client/delegatedrouting") type DelegatedRouting_Client interface { Identify(ctx pd9.Context, req *DelegatedRouting_IdentifyArg) ([]*DelegatedRouting_IdentifyResult, error) @@ -1058,8 +1058,8 @@ type DelegatedRouting_ClientOption func(*client_DelegatedRouting) error type client_DelegatedRouting struct { httpClient *pd4.Client - endpoint *pd6.URL - ulk pd13.Mutex + endpoint *pd5.URL + ulk pd6.Mutex unsupported map[string]bool // cache of methods not supported by server } @@ -1071,7 +1071,7 @@ func DelegatedRouting_Client_WithHTTPClient(hc *pd4.Client) DelegatedRouting_Cli } func New_DelegatedRouting_Client(endpoint string, opts ...DelegatedRouting_ClientOption) (*client_DelegatedRouting, error) { - u, err := pd6.Parse(endpoint) + u, err := pd5.Parse(endpoint) if err != nil { return nil, err } @@ -1119,21 +1119,21 @@ func (c *client_DelegatedRouting) Identify_Async(ctx pd9.Context, req *Delegated notSupported := c.unsupported["Identify"] c.ulk.Unlock() if notSupported { - return nil, pd12.ErrSchema + return nil, pd14.ErrSchema } envelope := &AnonInductive4{ Identify: req, } - buf, err := pd5.Encode(envelope, pd8.Encode) + buf, err := pd10.Encode(envelope, pd7.Encode) if err != nil { return nil, pd3.Errorf("unexpected serialization error (%v)", err) } // encode request in URL u := *c.endpoint - httpReq, err := pd4.NewRequestWithContext(ctx, "POST", u.String(), pd7.NewReader(buf)) + httpReq, err := pd4.NewRequestWithContext(ctx, "POST", u.String(), pd11.NewReader(buf)) if err != nil { return nil, err } @@ -1155,7 +1155,7 @@ func (c *client_DelegatedRouting) Identify_Async(ctx pd9.Context, req *Delegated c.ulk.Lock() c.unsupported["Identify"] = true c.ulk.Unlock() - return nil, pd12.ErrSchema + return nil, pd14.ErrSchema } // HTTP codes other than 200 correspond to service implementation rejecting the call when it is received // for reasons unrelated to protocol schema @@ -1163,7 +1163,7 @@ func (c *client_DelegatedRouting) Identify_Async(ctx pd9.Context, req *Delegated resp.Body.Close() if resp.Header != nil { if errValues, ok := resp.Header["Error"]; ok && len(errValues) == 1 { - err = pd12.ErrService{Cause: pd3.Errorf("%s", errValues[0])} + err = pd14.ErrService{Cause: pd3.Errorf("%s", errValues[0])} } else { err = pd3.Errorf("service rejected the call, no cause provided") } @@ -1178,10 +1178,10 @@ func (c *client_DelegatedRouting) Identify_Async(ctx pd9.Context, req *Delegated return ch, nil } -func process_DelegatedRouting_Identify_AsyncResult(ctx pd9.Context, ch chan<- DelegatedRouting_Identify_AsyncResult, r pd11.ReadCloser) { +func process_DelegatedRouting_Identify_AsyncResult(ctx pd9.Context, ch chan<- DelegatedRouting_Identify_AsyncResult, r pd8.ReadCloser) { defer close(ch) defer r.Close() - opt := pd8.DecodeOptions{ + opt := pd7.DecodeOptions{ ParseLinks: true, ParseBytes: true, DontParseBeyondEnd: true, @@ -1189,23 +1189,23 @@ func process_DelegatedRouting_Identify_AsyncResult(ctx pd9.Context, ch chan<- De for { var out DelegatedRouting_Identify_AsyncResult - n, err := pd5.DecodeStreaming(r, opt.Decode) - if pd10.Is(err, pd11.EOF) || pd10.Is(err, pd11.ErrUnexpectedEOF) { + n, err := pd10.DecodeStreaming(r, opt.Decode) + if pd12.Is(err, pd8.EOF) || pd12.Is(err, pd8.ErrUnexpectedEOF) { return } if err != nil { - out = DelegatedRouting_Identify_AsyncResult{Err: pd12.ErrProto{Cause: err}} // IPLD decode error + out = DelegatedRouting_Identify_AsyncResult{Err: pd14.ErrProto{Cause: err}} // IPLD decode error } else { var x [1]byte if k, err := r.Read(x[:]); k != 1 || x[0] != '\n' { - out = DelegatedRouting_Identify_AsyncResult{Err: pd12.ErrProto{Cause: pd3.Errorf("missing new line after result: err (%v), read (%d), char (%q)", err, k, string(x[:]))}} // Edelweiss decode error + out = DelegatedRouting_Identify_AsyncResult{Err: pd14.ErrProto{Cause: pd3.Errorf("missing new line after result: err (%v), read (%d), char (%q)", err, k, string(x[:]))}} // Edelweiss decode error } else { env := &AnonInductive5{} if err = env.Parse(n); err != nil { - out = DelegatedRouting_Identify_AsyncResult{Err: pd12.ErrProto{Cause: err}} // schema decode error + out = DelegatedRouting_Identify_AsyncResult{Err: pd14.ErrProto{Cause: err}} // schema decode error } else if env.Error != nil { - out = DelegatedRouting_Identify_AsyncResult{Err: pd12.ErrService{Cause: pd10.New(string(env.Error.Code))}} // service-level error + out = DelegatedRouting_Identify_AsyncResult{Err: pd14.ErrService{Cause: pd12.New(string(env.Error.Code))}} // service-level error } else if env.Identify != nil { out = DelegatedRouting_Identify_AsyncResult{Resp: env.Identify} } else { @@ -1257,21 +1257,21 @@ func (c *client_DelegatedRouting) FindProviders_Async(ctx pd9.Context, req *Find notSupported := c.unsupported["FindProviders"] c.ulk.Unlock() if notSupported { - return nil, pd12.ErrSchema + return nil, pd14.ErrSchema } envelope := &AnonInductive4{ FindProviders: req, } - buf, err := pd5.Encode(envelope, pd8.Encode) + buf, err := pd10.Encode(envelope, pd7.Encode) if err != nil { return nil, pd3.Errorf("unexpected serialization error (%v)", err) } // encode request in URL u := *c.endpoint - httpReq, err := pd4.NewRequestWithContext(ctx, "POST", u.String(), pd7.NewReader(buf)) + httpReq, err := pd4.NewRequestWithContext(ctx, "POST", u.String(), pd11.NewReader(buf)) if err != nil { return nil, err } @@ -1293,7 +1293,7 @@ func (c *client_DelegatedRouting) FindProviders_Async(ctx pd9.Context, req *Find c.ulk.Lock() c.unsupported["FindProviders"] = true c.ulk.Unlock() - return nil, pd12.ErrSchema + return nil, pd14.ErrSchema } // HTTP codes other than 200 correspond to service implementation rejecting the call when it is received // for reasons unrelated to protocol schema @@ -1301,7 +1301,7 @@ func (c *client_DelegatedRouting) FindProviders_Async(ctx pd9.Context, req *Find resp.Body.Close() if resp.Header != nil { if errValues, ok := resp.Header["Error"]; ok && len(errValues) == 1 { - err = pd12.ErrService{Cause: pd3.Errorf("%s", errValues[0])} + err = pd14.ErrService{Cause: pd3.Errorf("%s", errValues[0])} } else { err = pd3.Errorf("service rejected the call, no cause provided") } @@ -1316,10 +1316,10 @@ func (c *client_DelegatedRouting) FindProviders_Async(ctx pd9.Context, req *Find return ch, nil } -func process_DelegatedRouting_FindProviders_AsyncResult(ctx pd9.Context, ch chan<- DelegatedRouting_FindProviders_AsyncResult, r pd11.ReadCloser) { +func process_DelegatedRouting_FindProviders_AsyncResult(ctx pd9.Context, ch chan<- DelegatedRouting_FindProviders_AsyncResult, r pd8.ReadCloser) { defer close(ch) defer r.Close() - opt := pd8.DecodeOptions{ + opt := pd7.DecodeOptions{ ParseLinks: true, ParseBytes: true, DontParseBeyondEnd: true, @@ -1327,23 +1327,23 @@ func process_DelegatedRouting_FindProviders_AsyncResult(ctx pd9.Context, ch chan for { var out DelegatedRouting_FindProviders_AsyncResult - n, err := pd5.DecodeStreaming(r, opt.Decode) - if pd10.Is(err, pd11.EOF) || pd10.Is(err, pd11.ErrUnexpectedEOF) { + n, err := pd10.DecodeStreaming(r, opt.Decode) + if pd12.Is(err, pd8.EOF) || pd12.Is(err, pd8.ErrUnexpectedEOF) { return } if err != nil { - out = DelegatedRouting_FindProviders_AsyncResult{Err: pd12.ErrProto{Cause: err}} // IPLD decode error + out = DelegatedRouting_FindProviders_AsyncResult{Err: pd14.ErrProto{Cause: err}} // IPLD decode error } else { var x [1]byte if k, err := r.Read(x[:]); k != 1 || x[0] != '\n' { - out = DelegatedRouting_FindProviders_AsyncResult{Err: pd12.ErrProto{Cause: pd3.Errorf("missing new line after result: err (%v), read (%d), char (%q)", err, k, string(x[:]))}} // Edelweiss decode error + out = DelegatedRouting_FindProviders_AsyncResult{Err: pd14.ErrProto{Cause: pd3.Errorf("missing new line after result: err (%v), read (%d), char (%q)", err, k, string(x[:]))}} // Edelweiss decode error } else { env := &AnonInductive5{} if err = env.Parse(n); err != nil { - out = DelegatedRouting_FindProviders_AsyncResult{Err: pd12.ErrProto{Cause: err}} // schema decode error + out = DelegatedRouting_FindProviders_AsyncResult{Err: pd14.ErrProto{Cause: err}} // schema decode error } else if env.Error != nil { - out = DelegatedRouting_FindProviders_AsyncResult{Err: pd12.ErrService{Cause: pd10.New(string(env.Error.Code))}} // service-level error + out = DelegatedRouting_FindProviders_AsyncResult{Err: pd14.ErrService{Cause: pd12.New(string(env.Error.Code))}} // service-level error } else if env.FindProviders != nil { out = DelegatedRouting_FindProviders_AsyncResult{Resp: env.FindProviders} } else { @@ -1395,21 +1395,21 @@ func (c *client_DelegatedRouting) GetIPNS_Async(ctx pd9.Context, req *GetIPNSReq notSupported := c.unsupported["GetIPNS"] c.ulk.Unlock() if notSupported { - return nil, pd12.ErrSchema + return nil, pd14.ErrSchema } envelope := &AnonInductive4{ GetIPNS: req, } - buf, err := pd5.Encode(envelope, pd8.Encode) + buf, err := pd10.Encode(envelope, pd7.Encode) if err != nil { return nil, pd3.Errorf("unexpected serialization error (%v)", err) } // encode request in URL u := *c.endpoint - httpReq, err := pd4.NewRequestWithContext(ctx, "POST", u.String(), pd7.NewReader(buf)) + httpReq, err := pd4.NewRequestWithContext(ctx, "POST", u.String(), pd11.NewReader(buf)) if err != nil { return nil, err } @@ -1431,7 +1431,7 @@ func (c *client_DelegatedRouting) GetIPNS_Async(ctx pd9.Context, req *GetIPNSReq c.ulk.Lock() c.unsupported["GetIPNS"] = true c.ulk.Unlock() - return nil, pd12.ErrSchema + return nil, pd14.ErrSchema } // HTTP codes other than 200 correspond to service implementation rejecting the call when it is received // for reasons unrelated to protocol schema @@ -1439,7 +1439,7 @@ func (c *client_DelegatedRouting) GetIPNS_Async(ctx pd9.Context, req *GetIPNSReq resp.Body.Close() if resp.Header != nil { if errValues, ok := resp.Header["Error"]; ok && len(errValues) == 1 { - err = pd12.ErrService{Cause: pd3.Errorf("%s", errValues[0])} + err = pd14.ErrService{Cause: pd3.Errorf("%s", errValues[0])} } else { err = pd3.Errorf("service rejected the call, no cause provided") } @@ -1454,10 +1454,10 @@ func (c *client_DelegatedRouting) GetIPNS_Async(ctx pd9.Context, req *GetIPNSReq return ch, nil } -func process_DelegatedRouting_GetIPNS_AsyncResult(ctx pd9.Context, ch chan<- DelegatedRouting_GetIPNS_AsyncResult, r pd11.ReadCloser) { +func process_DelegatedRouting_GetIPNS_AsyncResult(ctx pd9.Context, ch chan<- DelegatedRouting_GetIPNS_AsyncResult, r pd8.ReadCloser) { defer close(ch) defer r.Close() - opt := pd8.DecodeOptions{ + opt := pd7.DecodeOptions{ ParseLinks: true, ParseBytes: true, DontParseBeyondEnd: true, @@ -1465,23 +1465,23 @@ func process_DelegatedRouting_GetIPNS_AsyncResult(ctx pd9.Context, ch chan<- Del for { var out DelegatedRouting_GetIPNS_AsyncResult - n, err := pd5.DecodeStreaming(r, opt.Decode) - if pd10.Is(err, pd11.EOF) || pd10.Is(err, pd11.ErrUnexpectedEOF) { + n, err := pd10.DecodeStreaming(r, opt.Decode) + if pd12.Is(err, pd8.EOF) || pd12.Is(err, pd8.ErrUnexpectedEOF) { return } if err != nil { - out = DelegatedRouting_GetIPNS_AsyncResult{Err: pd12.ErrProto{Cause: err}} // IPLD decode error + out = DelegatedRouting_GetIPNS_AsyncResult{Err: pd14.ErrProto{Cause: err}} // IPLD decode error } else { var x [1]byte if k, err := r.Read(x[:]); k != 1 || x[0] != '\n' { - out = DelegatedRouting_GetIPNS_AsyncResult{Err: pd12.ErrProto{Cause: pd3.Errorf("missing new line after result: err (%v), read (%d), char (%q)", err, k, string(x[:]))}} // Edelweiss decode error + out = DelegatedRouting_GetIPNS_AsyncResult{Err: pd14.ErrProto{Cause: pd3.Errorf("missing new line after result: err (%v), read (%d), char (%q)", err, k, string(x[:]))}} // Edelweiss decode error } else { env := &AnonInductive5{} if err = env.Parse(n); err != nil { - out = DelegatedRouting_GetIPNS_AsyncResult{Err: pd12.ErrProto{Cause: err}} // schema decode error + out = DelegatedRouting_GetIPNS_AsyncResult{Err: pd14.ErrProto{Cause: err}} // schema decode error } else if env.Error != nil { - out = DelegatedRouting_GetIPNS_AsyncResult{Err: pd12.ErrService{Cause: pd10.New(string(env.Error.Code))}} // service-level error + out = DelegatedRouting_GetIPNS_AsyncResult{Err: pd14.ErrService{Cause: pd12.New(string(env.Error.Code))}} // service-level error } else if env.GetIPNS != nil { out = DelegatedRouting_GetIPNS_AsyncResult{Resp: env.GetIPNS} } else { @@ -1533,21 +1533,21 @@ func (c *client_DelegatedRouting) PutIPNS_Async(ctx pd9.Context, req *PutIPNSReq notSupported := c.unsupported["PutIPNS"] c.ulk.Unlock() if notSupported { - return nil, pd12.ErrSchema + return nil, pd14.ErrSchema } envelope := &AnonInductive4{ PutIPNS: req, } - buf, err := pd5.Encode(envelope, pd8.Encode) + buf, err := pd10.Encode(envelope, pd7.Encode) if err != nil { return nil, pd3.Errorf("unexpected serialization error (%v)", err) } // encode request in URL u := *c.endpoint - httpReq, err := pd4.NewRequestWithContext(ctx, "POST", u.String(), pd7.NewReader(buf)) + httpReq, err := pd4.NewRequestWithContext(ctx, "POST", u.String(), pd11.NewReader(buf)) if err != nil { return nil, err } @@ -1569,7 +1569,7 @@ func (c *client_DelegatedRouting) PutIPNS_Async(ctx pd9.Context, req *PutIPNSReq c.ulk.Lock() c.unsupported["PutIPNS"] = true c.ulk.Unlock() - return nil, pd12.ErrSchema + return nil, pd14.ErrSchema } // HTTP codes other than 200 correspond to service implementation rejecting the call when it is received // for reasons unrelated to protocol schema @@ -1577,7 +1577,7 @@ func (c *client_DelegatedRouting) PutIPNS_Async(ctx pd9.Context, req *PutIPNSReq resp.Body.Close() if resp.Header != nil { if errValues, ok := resp.Header["Error"]; ok && len(errValues) == 1 { - err = pd12.ErrService{Cause: pd3.Errorf("%s", errValues[0])} + err = pd14.ErrService{Cause: pd3.Errorf("%s", errValues[0])} } else { err = pd3.Errorf("service rejected the call, no cause provided") } @@ -1592,10 +1592,10 @@ func (c *client_DelegatedRouting) PutIPNS_Async(ctx pd9.Context, req *PutIPNSReq return ch, nil } -func process_DelegatedRouting_PutIPNS_AsyncResult(ctx pd9.Context, ch chan<- DelegatedRouting_PutIPNS_AsyncResult, r pd11.ReadCloser) { +func process_DelegatedRouting_PutIPNS_AsyncResult(ctx pd9.Context, ch chan<- DelegatedRouting_PutIPNS_AsyncResult, r pd8.ReadCloser) { defer close(ch) defer r.Close() - opt := pd8.DecodeOptions{ + opt := pd7.DecodeOptions{ ParseLinks: true, ParseBytes: true, DontParseBeyondEnd: true, @@ -1603,23 +1603,23 @@ func process_DelegatedRouting_PutIPNS_AsyncResult(ctx pd9.Context, ch chan<- Del for { var out DelegatedRouting_PutIPNS_AsyncResult - n, err := pd5.DecodeStreaming(r, opt.Decode) - if pd10.Is(err, pd11.EOF) || pd10.Is(err, pd11.ErrUnexpectedEOF) { + n, err := pd10.DecodeStreaming(r, opt.Decode) + if pd12.Is(err, pd8.EOF) || pd12.Is(err, pd8.ErrUnexpectedEOF) { return } if err != nil { - out = DelegatedRouting_PutIPNS_AsyncResult{Err: pd12.ErrProto{Cause: err}} // IPLD decode error + out = DelegatedRouting_PutIPNS_AsyncResult{Err: pd14.ErrProto{Cause: err}} // IPLD decode error } else { var x [1]byte if k, err := r.Read(x[:]); k != 1 || x[0] != '\n' { - out = DelegatedRouting_PutIPNS_AsyncResult{Err: pd12.ErrProto{Cause: pd3.Errorf("missing new line after result: err (%v), read (%d), char (%q)", err, k, string(x[:]))}} // Edelweiss decode error + out = DelegatedRouting_PutIPNS_AsyncResult{Err: pd14.ErrProto{Cause: pd3.Errorf("missing new line after result: err (%v), read (%d), char (%q)", err, k, string(x[:]))}} // Edelweiss decode error } else { env := &AnonInductive5{} if err = env.Parse(n); err != nil { - out = DelegatedRouting_PutIPNS_AsyncResult{Err: pd12.ErrProto{Cause: err}} // schema decode error + out = DelegatedRouting_PutIPNS_AsyncResult{Err: pd14.ErrProto{Cause: err}} // schema decode error } else if env.Error != nil { - out = DelegatedRouting_PutIPNS_AsyncResult{Err: pd12.ErrService{Cause: pd10.New(string(env.Error.Code))}} // service-level error + out = DelegatedRouting_PutIPNS_AsyncResult{Err: pd14.ErrService{Cause: pd12.New(string(env.Error.Code))}} // service-level error } else if env.PutIPNS != nil { out = DelegatedRouting_PutIPNS_AsyncResult{Resp: env.PutIPNS} } else { @@ -1636,7 +1636,7 @@ func process_DelegatedRouting_PutIPNS_AsyncResult(ctx pd9.Context, ch chan<- Del } } -var logger_server_DelegatedRouting = pd14.Logger("service/server/delegatedrouting") +var logger_server_DelegatedRouting = pd13.Logger("service/server/delegatedrouting") type DelegatedRouting_Server interface { FindProviders(ctx pd9.Context, req *FindProvidersRequest) (<-chan *DelegatedRouting_FindProviders_AsyncResult, error) @@ -1653,7 +1653,7 @@ func DelegatedRouting_AsyncHandler(s DelegatedRouting_Server) pd4.HandlerFunc { writer.WriteHeader(400) return } - n, err := pd5.Decode(msg, pd8.Decode) + n, err := pd10.Decode(msg, pd7.Decode) if err != nil { logger_server_DelegatedRouting.Errorf("received request not decodeable (%v)", err) writer.WriteHeader(400) @@ -1684,17 +1684,20 @@ func DelegatedRouting_AsyncHandler(s DelegatedRouting_Server) pd4.HandlerFunc { for resp := range ch { var env *AnonInductive5 if resp.Err != nil { - env = &AnonInductive5{Error: &DelegatedRouting_Error{Code: pd1.String(resp.Err.Error())}} + env = &AnonInductive5{Error: &DelegatedRouting_Error{Code: pd2.String(resp.Err.Error())}} } else { env = &AnonInductive5{FindProviders: resp.Resp} } - var buf pd7.Buffer - if err = pd5.EncodeStreaming(&buf, env, pd8.Encode); err != nil { + var buf pd11.Buffer + if err = pd10.EncodeStreaming(&buf, env, pd7.Encode); err != nil { logger_server_DelegatedRouting.Errorf("cannot encode response (%v)", err) continue } buf.WriteByte("\n"[0]) writer.Write(buf.Bytes()) + if f, ok := writer.(pd4.Flusher); ok { + f.Flush() + } } case env.GetIPNS != nil: @@ -1708,17 +1711,20 @@ func DelegatedRouting_AsyncHandler(s DelegatedRouting_Server) pd4.HandlerFunc { for resp := range ch { var env *AnonInductive5 if resp.Err != nil { - env = &AnonInductive5{Error: &DelegatedRouting_Error{Code: pd1.String(resp.Err.Error())}} + env = &AnonInductive5{Error: &DelegatedRouting_Error{Code: pd2.String(resp.Err.Error())}} } else { env = &AnonInductive5{GetIPNS: resp.Resp} } - var buf pd7.Buffer - if err = pd5.EncodeStreaming(&buf, env, pd8.Encode); err != nil { + var buf pd11.Buffer + if err = pd10.EncodeStreaming(&buf, env, pd7.Encode); err != nil { logger_server_DelegatedRouting.Errorf("cannot encode response (%v)", err) continue } buf.WriteByte("\n"[0]) writer.Write(buf.Bytes()) + if f, ok := writer.(pd4.Flusher); ok { + f.Flush() + } } case env.PutIPNS != nil: @@ -1732,32 +1738,35 @@ func DelegatedRouting_AsyncHandler(s DelegatedRouting_Server) pd4.HandlerFunc { for resp := range ch { var env *AnonInductive5 if resp.Err != nil { - env = &AnonInductive5{Error: &DelegatedRouting_Error{Code: pd1.String(resp.Err.Error())}} + env = &AnonInductive5{Error: &DelegatedRouting_Error{Code: pd2.String(resp.Err.Error())}} } else { env = &AnonInductive5{PutIPNS: resp.Resp} } - var buf pd7.Buffer - if err = pd5.EncodeStreaming(&buf, env, pd8.Encode); err != nil { + var buf pd11.Buffer + if err = pd10.EncodeStreaming(&buf, env, pd7.Encode); err != nil { logger_server_DelegatedRouting.Errorf("cannot encode response (%v)", err) continue } buf.WriteByte("\n"[0]) writer.Write(buf.Bytes()) + if f, ok := writer.(pd4.Flusher); ok { + f.Flush() + } } case env.Identify != nil: var env *AnonInductive5 env = &AnonInductive5{ Identify: &DelegatedRouting_IdentifyResult{ - Methods: []pd1.String{ + Methods: []pd2.String{ "FindProviders", "GetIPNS", "PutIPNS", }, }, } - var buf pd7.Buffer - if err = pd5.EncodeStreaming(&buf, env, pd8.Encode); err != nil { + var buf pd11.Buffer + if err = pd10.EncodeStreaming(&buf, env, pd7.Encode); err != nil { logger_server_DelegatedRouting.Errorf("cannot encode identify response (%v)", err) writer.WriteHeader(500) return @@ -1778,16 +1787,16 @@ type FindProvidersRequest struct { Key LinkToAny } -func (x FindProvidersRequest) Node() pd2.Node { +func (x FindProvidersRequest) Node() pd1.Node { return x } -func (x *FindProvidersRequest) Parse(n pd2.Node) error { - if n.Kind() != pd2.Kind_Map { - return pd1.ErrNA +func (x *FindProvidersRequest) Parse(n pd1.Node) error { + if n.Kind() != pd1.Kind_Map { + return pd2.ErrNA } iter := n.MapIterator() - fieldMap := map[string]pd1.ParseFunc{ + fieldMap := map[string]pd2.ParseFunc{ "Key": x.Key.Parse, } for !iter.Done() { @@ -1813,7 +1822,7 @@ func (x *FindProvidersRequest) Parse(n pd2.Node) error { } } for _, fieldParse := range fieldMap { - if err := fieldParse(pd2.Null); err != nil { + if err := fieldParse(pd1.Null); err != nil { return err } } @@ -1825,74 +1834,74 @@ type FindProvidersRequest_MapIterator struct { s *FindProvidersRequest } -func (x *FindProvidersRequest_MapIterator) Next() (key pd2.Node, value pd2.Node, err error) { +func (x *FindProvidersRequest_MapIterator) Next() (key pd1.Node, value pd1.Node, err error) { x.i++ switch x.i { case 0: - return pd1.String("Key"), x.s.Key.Node(), nil + return pd2.String("Key"), x.s.Key.Node(), nil } - return nil, nil, pd1.ErrNA + return nil, nil, pd2.ErrNA } func (x *FindProvidersRequest_MapIterator) Done() bool { return x.i+1 >= 1 } -func (x FindProvidersRequest) Kind() pd2.Kind { - return pd2.Kind_Map +func (x FindProvidersRequest) Kind() pd1.Kind { + return pd1.Kind_Map } -func (x FindProvidersRequest) LookupByString(key string) (pd2.Node, error) { +func (x FindProvidersRequest) LookupByString(key string) (pd1.Node, error) { switch key { case "Key": return x.Key.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x FindProvidersRequest) LookupByNode(key pd2.Node) (pd2.Node, error) { +func (x FindProvidersRequest) LookupByNode(key pd1.Node) (pd1.Node, error) { switch key.Kind() { - case pd2.Kind_String: + case pd1.Kind_String: if s, err := key.AsString(); err != nil { return nil, err } else { return x.LookupByString(s) } - case pd2.Kind_Int: + case pd1.Kind_Int: if i, err := key.AsInt(); err != nil { return nil, err } else { return x.LookupByIndex(i) } } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x FindProvidersRequest) LookupByIndex(idx int64) (pd2.Node, error) { +func (x FindProvidersRequest) LookupByIndex(idx int64) (pd1.Node, error) { switch idx { case 0: return x.Key.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x FindProvidersRequest) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { +func (x FindProvidersRequest) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { switch seg.String() { case "0", "Key": return x.Key.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x FindProvidersRequest) MapIterator() pd2.MapIterator { +func (x FindProvidersRequest) MapIterator() pd1.MapIterator { return &FindProvidersRequest_MapIterator{-1, &x} } -func (x FindProvidersRequest) ListIterator() pd2.ListIterator { +func (x FindProvidersRequest) ListIterator() pd1.ListIterator { return nil } @@ -1909,30 +1918,30 @@ func (x FindProvidersRequest) IsNull() bool { } func (x FindProvidersRequest) AsBool() (bool, error) { - return false, pd1.ErrNA + return false, pd2.ErrNA } func (x FindProvidersRequest) AsInt() (int64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (x FindProvidersRequest) AsFloat() (float64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (x FindProvidersRequest) AsString() (string, error) { - return "", pd1.ErrNA + return "", pd2.ErrNA } func (x FindProvidersRequest) AsBytes() ([]byte, error) { - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x FindProvidersRequest) AsLink() (pd2.Link, error) { - return nil, pd1.ErrNA +func (x FindProvidersRequest) AsLink() (pd1.Link, error) { + return nil, pd2.ErrNA } -func (x FindProvidersRequest) Prototype() pd2.NodePrototype { +func (x FindProvidersRequest) Prototype() pd1.NodePrototype { return nil } @@ -1940,23 +1949,23 @@ func (x FindProvidersRequest) Prototype() pd2.NodePrototype { type ProvidersList []Provider -func (v ProvidersList) Node() pd2.Node { +func (v ProvidersList) Node() pd1.Node { return v } -func (v *ProvidersList) Parse(n pd2.Node) error { - if n.Kind() == pd2.Kind_Null { +func (v *ProvidersList) Parse(n pd1.Node) error { + if n.Kind() == pd1.Kind_Null { *v = nil return nil } - if n.Kind() != pd2.Kind_List { - return pd1.ErrNA + if n.Kind() != pd1.Kind_List { + return pd2.ErrNA } else { *v = make(ProvidersList, n.Length()) iter := n.ListIterator() for !iter.Done() { if i, n, err := iter.Next(); err != nil { - return pd1.ErrNA + return pd2.ErrNA } else if err = (*v)[i].Parse(n); err != nil { return err } @@ -1965,39 +1974,39 @@ func (v *ProvidersList) Parse(n pd2.Node) error { } } -func (ProvidersList) Kind() pd2.Kind { - return pd2.Kind_List +func (ProvidersList) Kind() pd1.Kind { + return pd1.Kind_List } -func (ProvidersList) LookupByString(string) (pd2.Node, error) { - return nil, pd1.ErrNA +func (ProvidersList) LookupByString(string) (pd1.Node, error) { + return nil, pd2.ErrNA } -func (ProvidersList) LookupByNode(key pd2.Node) (pd2.Node, error) { - return nil, pd1.ErrNA +func (ProvidersList) LookupByNode(key pd1.Node) (pd1.Node, error) { + return nil, pd2.ErrNA } -func (v ProvidersList) LookupByIndex(i int64) (pd2.Node, error) { +func (v ProvidersList) LookupByIndex(i int64) (pd1.Node, error) { if i < 0 || i >= v.Length() { - return nil, pd1.ErrBounds + return nil, pd2.ErrBounds } else { return v[i].Node(), nil } } -func (v ProvidersList) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { +func (v ProvidersList) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { if i, err := seg.Index(); err != nil { - return nil, pd1.ErrNA + return nil, pd2.ErrNA } else { return v.LookupByIndex(i) } } -func (ProvidersList) MapIterator() pd2.MapIterator { +func (ProvidersList) MapIterator() pd1.MapIterator { return nil } -func (v ProvidersList) ListIterator() pd2.ListIterator { +func (v ProvidersList) ListIterator() pd1.ListIterator { return &ProvidersList_ListIterator{v, 0} } @@ -2014,30 +2023,30 @@ func (ProvidersList) IsNull() bool { } func (v ProvidersList) AsBool() (bool, error) { - return false, pd1.ErrNA + return false, pd2.ErrNA } func (ProvidersList) AsInt() (int64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (ProvidersList) AsFloat() (float64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (ProvidersList) AsString() (string, error) { - return "", pd1.ErrNA + return "", pd2.ErrNA } func (ProvidersList) AsBytes() ([]byte, error) { - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (ProvidersList) AsLink() (pd2.Link, error) { - return nil, pd1.ErrNA +func (ProvidersList) AsLink() (pd1.Link, error) { + return nil, pd2.ErrNA } -func (ProvidersList) Prototype() pd2.NodePrototype { +func (ProvidersList) Prototype() pd1.NodePrototype { return nil // not needed } @@ -2046,9 +2055,9 @@ type ProvidersList_ListIterator struct { at int64 } -func (iter *ProvidersList_ListIterator) Next() (int64, pd2.Node, error) { +func (iter *ProvidersList_ListIterator) Next() (int64, pd1.Node, error) { if iter.Done() { - return -1, nil, pd1.ErrBounds + return -1, nil, pd2.ErrBounds } v := iter.list[iter.at] i := int64(iter.at) @@ -2066,16 +2075,16 @@ type FindProvidersResponse struct { Providers ProvidersList } -func (x FindProvidersResponse) Node() pd2.Node { +func (x FindProvidersResponse) Node() pd1.Node { return x } -func (x *FindProvidersResponse) Parse(n pd2.Node) error { - if n.Kind() != pd2.Kind_Map { - return pd1.ErrNA +func (x *FindProvidersResponse) Parse(n pd1.Node) error { + if n.Kind() != pd1.Kind_Map { + return pd2.ErrNA } iter := n.MapIterator() - fieldMap := map[string]pd1.ParseFunc{ + fieldMap := map[string]pd2.ParseFunc{ "Providers": x.Providers.Parse, } for !iter.Done() { @@ -2101,7 +2110,7 @@ func (x *FindProvidersResponse) Parse(n pd2.Node) error { } } for _, fieldParse := range fieldMap { - if err := fieldParse(pd2.Null); err != nil { + if err := fieldParse(pd1.Null); err != nil { return err } } @@ -2113,74 +2122,74 @@ type FindProvidersResponse_MapIterator struct { s *FindProvidersResponse } -func (x *FindProvidersResponse_MapIterator) Next() (key pd2.Node, value pd2.Node, err error) { +func (x *FindProvidersResponse_MapIterator) Next() (key pd1.Node, value pd1.Node, err error) { x.i++ switch x.i { case 0: - return pd1.String("Providers"), x.s.Providers.Node(), nil + return pd2.String("Providers"), x.s.Providers.Node(), nil } - return nil, nil, pd1.ErrNA + return nil, nil, pd2.ErrNA } func (x *FindProvidersResponse_MapIterator) Done() bool { return x.i+1 >= 1 } -func (x FindProvidersResponse) Kind() pd2.Kind { - return pd2.Kind_Map +func (x FindProvidersResponse) Kind() pd1.Kind { + return pd1.Kind_Map } -func (x FindProvidersResponse) LookupByString(key string) (pd2.Node, error) { +func (x FindProvidersResponse) LookupByString(key string) (pd1.Node, error) { switch key { case "Providers": return x.Providers.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x FindProvidersResponse) LookupByNode(key pd2.Node) (pd2.Node, error) { +func (x FindProvidersResponse) LookupByNode(key pd1.Node) (pd1.Node, error) { switch key.Kind() { - case pd2.Kind_String: + case pd1.Kind_String: if s, err := key.AsString(); err != nil { return nil, err } else { return x.LookupByString(s) } - case pd2.Kind_Int: + case pd1.Kind_Int: if i, err := key.AsInt(); err != nil { return nil, err } else { return x.LookupByIndex(i) } } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x FindProvidersResponse) LookupByIndex(idx int64) (pd2.Node, error) { +func (x FindProvidersResponse) LookupByIndex(idx int64) (pd1.Node, error) { switch idx { case 0: return x.Providers.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x FindProvidersResponse) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { +func (x FindProvidersResponse) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { switch seg.String() { case "0", "Providers": return x.Providers.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x FindProvidersResponse) MapIterator() pd2.MapIterator { +func (x FindProvidersResponse) MapIterator() pd1.MapIterator { return &FindProvidersResponse_MapIterator{-1, &x} } -func (x FindProvidersResponse) ListIterator() pd2.ListIterator { +func (x FindProvidersResponse) ListIterator() pd1.ListIterator { return nil } @@ -2197,49 +2206,49 @@ func (x FindProvidersResponse) IsNull() bool { } func (x FindProvidersResponse) AsBool() (bool, error) { - return false, pd1.ErrNA + return false, pd2.ErrNA } func (x FindProvidersResponse) AsInt() (int64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (x FindProvidersResponse) AsFloat() (float64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (x FindProvidersResponse) AsString() (string, error) { - return "", pd1.ErrNA + return "", pd2.ErrNA } func (x FindProvidersResponse) AsBytes() ([]byte, error) { - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x FindProvidersResponse) AsLink() (pd2.Link, error) { - return nil, pd1.ErrNA +func (x FindProvidersResponse) AsLink() (pd1.Link, error) { + return nil, pd2.ErrNA } -func (x FindProvidersResponse) Prototype() pd2.NodePrototype { +func (x FindProvidersResponse) Prototype() pd1.NodePrototype { return nil } // -- protocol type GetIPNSRequest -- type GetIPNSRequest struct { - ID pd1.Bytes + ID pd2.Bytes } -func (x GetIPNSRequest) Node() pd2.Node { +func (x GetIPNSRequest) Node() pd1.Node { return x } -func (x *GetIPNSRequest) Parse(n pd2.Node) error { - if n.Kind() != pd2.Kind_Map { - return pd1.ErrNA +func (x *GetIPNSRequest) Parse(n pd1.Node) error { + if n.Kind() != pd1.Kind_Map { + return pd2.ErrNA } iter := n.MapIterator() - fieldMap := map[string]pd1.ParseFunc{ + fieldMap := map[string]pd2.ParseFunc{ "ID": x.ID.Parse, } for !iter.Done() { @@ -2265,7 +2274,7 @@ func (x *GetIPNSRequest) Parse(n pd2.Node) error { } } for _, fieldParse := range fieldMap { - if err := fieldParse(pd2.Null); err != nil { + if err := fieldParse(pd1.Null); err != nil { return err } } @@ -2277,74 +2286,74 @@ type GetIPNSRequest_MapIterator struct { s *GetIPNSRequest } -func (x *GetIPNSRequest_MapIterator) Next() (key pd2.Node, value pd2.Node, err error) { +func (x *GetIPNSRequest_MapIterator) Next() (key pd1.Node, value pd1.Node, err error) { x.i++ switch x.i { case 0: - return pd1.String("ID"), x.s.ID.Node(), nil + return pd2.String("ID"), x.s.ID.Node(), nil } - return nil, nil, pd1.ErrNA + return nil, nil, pd2.ErrNA } func (x *GetIPNSRequest_MapIterator) Done() bool { return x.i+1 >= 1 } -func (x GetIPNSRequest) Kind() pd2.Kind { - return pd2.Kind_Map +func (x GetIPNSRequest) Kind() pd1.Kind { + return pd1.Kind_Map } -func (x GetIPNSRequest) LookupByString(key string) (pd2.Node, error) { +func (x GetIPNSRequest) LookupByString(key string) (pd1.Node, error) { switch key { case "ID": return x.ID.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x GetIPNSRequest) LookupByNode(key pd2.Node) (pd2.Node, error) { +func (x GetIPNSRequest) LookupByNode(key pd1.Node) (pd1.Node, error) { switch key.Kind() { - case pd2.Kind_String: + case pd1.Kind_String: if s, err := key.AsString(); err != nil { return nil, err } else { return x.LookupByString(s) } - case pd2.Kind_Int: + case pd1.Kind_Int: if i, err := key.AsInt(); err != nil { return nil, err } else { return x.LookupByIndex(i) } } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x GetIPNSRequest) LookupByIndex(idx int64) (pd2.Node, error) { +func (x GetIPNSRequest) LookupByIndex(idx int64) (pd1.Node, error) { switch idx { case 0: return x.ID.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x GetIPNSRequest) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { +func (x GetIPNSRequest) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { switch seg.String() { case "0", "ID": return x.ID.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x GetIPNSRequest) MapIterator() pd2.MapIterator { +func (x GetIPNSRequest) MapIterator() pd1.MapIterator { return &GetIPNSRequest_MapIterator{-1, &x} } -func (x GetIPNSRequest) ListIterator() pd2.ListIterator { +func (x GetIPNSRequest) ListIterator() pd1.ListIterator { return nil } @@ -2361,49 +2370,49 @@ func (x GetIPNSRequest) IsNull() bool { } func (x GetIPNSRequest) AsBool() (bool, error) { - return false, pd1.ErrNA + return false, pd2.ErrNA } func (x GetIPNSRequest) AsInt() (int64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (x GetIPNSRequest) AsFloat() (float64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (x GetIPNSRequest) AsString() (string, error) { - return "", pd1.ErrNA + return "", pd2.ErrNA } func (x GetIPNSRequest) AsBytes() ([]byte, error) { - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x GetIPNSRequest) AsLink() (pd2.Link, error) { - return nil, pd1.ErrNA +func (x GetIPNSRequest) AsLink() (pd1.Link, error) { + return nil, pd2.ErrNA } -func (x GetIPNSRequest) Prototype() pd2.NodePrototype { +func (x GetIPNSRequest) Prototype() pd1.NodePrototype { return nil } // -- protocol type GetIPNSResponse -- type GetIPNSResponse struct { - Record pd1.Bytes + Record pd2.Bytes } -func (x GetIPNSResponse) Node() pd2.Node { +func (x GetIPNSResponse) Node() pd1.Node { return x } -func (x *GetIPNSResponse) Parse(n pd2.Node) error { - if n.Kind() != pd2.Kind_Map { - return pd1.ErrNA +func (x *GetIPNSResponse) Parse(n pd1.Node) error { + if n.Kind() != pd1.Kind_Map { + return pd2.ErrNA } iter := n.MapIterator() - fieldMap := map[string]pd1.ParseFunc{ + fieldMap := map[string]pd2.ParseFunc{ "Record": x.Record.Parse, } for !iter.Done() { @@ -2429,7 +2438,7 @@ func (x *GetIPNSResponse) Parse(n pd2.Node) error { } } for _, fieldParse := range fieldMap { - if err := fieldParse(pd2.Null); err != nil { + if err := fieldParse(pd1.Null); err != nil { return err } } @@ -2441,74 +2450,74 @@ type GetIPNSResponse_MapIterator struct { s *GetIPNSResponse } -func (x *GetIPNSResponse_MapIterator) Next() (key pd2.Node, value pd2.Node, err error) { +func (x *GetIPNSResponse_MapIterator) Next() (key pd1.Node, value pd1.Node, err error) { x.i++ switch x.i { case 0: - return pd1.String("Record"), x.s.Record.Node(), nil + return pd2.String("Record"), x.s.Record.Node(), nil } - return nil, nil, pd1.ErrNA + return nil, nil, pd2.ErrNA } func (x *GetIPNSResponse_MapIterator) Done() bool { return x.i+1 >= 1 } -func (x GetIPNSResponse) Kind() pd2.Kind { - return pd2.Kind_Map +func (x GetIPNSResponse) Kind() pd1.Kind { + return pd1.Kind_Map } -func (x GetIPNSResponse) LookupByString(key string) (pd2.Node, error) { +func (x GetIPNSResponse) LookupByString(key string) (pd1.Node, error) { switch key { case "Record": return x.Record.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x GetIPNSResponse) LookupByNode(key pd2.Node) (pd2.Node, error) { +func (x GetIPNSResponse) LookupByNode(key pd1.Node) (pd1.Node, error) { switch key.Kind() { - case pd2.Kind_String: + case pd1.Kind_String: if s, err := key.AsString(); err != nil { return nil, err } else { return x.LookupByString(s) } - case pd2.Kind_Int: + case pd1.Kind_Int: if i, err := key.AsInt(); err != nil { return nil, err } else { return x.LookupByIndex(i) } } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x GetIPNSResponse) LookupByIndex(idx int64) (pd2.Node, error) { +func (x GetIPNSResponse) LookupByIndex(idx int64) (pd1.Node, error) { switch idx { case 0: return x.Record.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x GetIPNSResponse) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { +func (x GetIPNSResponse) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { switch seg.String() { case "0", "Record": return x.Record.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x GetIPNSResponse) MapIterator() pd2.MapIterator { +func (x GetIPNSResponse) MapIterator() pd1.MapIterator { return &GetIPNSResponse_MapIterator{-1, &x} } -func (x GetIPNSResponse) ListIterator() pd2.ListIterator { +func (x GetIPNSResponse) ListIterator() pd1.ListIterator { return nil } @@ -2525,50 +2534,50 @@ func (x GetIPNSResponse) IsNull() bool { } func (x GetIPNSResponse) AsBool() (bool, error) { - return false, pd1.ErrNA + return false, pd2.ErrNA } func (x GetIPNSResponse) AsInt() (int64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (x GetIPNSResponse) AsFloat() (float64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (x GetIPNSResponse) AsString() (string, error) { - return "", pd1.ErrNA + return "", pd2.ErrNA } func (x GetIPNSResponse) AsBytes() ([]byte, error) { - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x GetIPNSResponse) AsLink() (pd2.Link, error) { - return nil, pd1.ErrNA +func (x GetIPNSResponse) AsLink() (pd1.Link, error) { + return nil, pd2.ErrNA } -func (x GetIPNSResponse) Prototype() pd2.NodePrototype { +func (x GetIPNSResponse) Prototype() pd1.NodePrototype { return nil } // -- protocol type PutIPNSRequest -- type PutIPNSRequest struct { - ID pd1.Bytes - Record pd1.Bytes + ID pd2.Bytes + Record pd2.Bytes } -func (x PutIPNSRequest) Node() pd2.Node { +func (x PutIPNSRequest) Node() pd1.Node { return x } -func (x *PutIPNSRequest) Parse(n pd2.Node) error { - if n.Kind() != pd2.Kind_Map { - return pd1.ErrNA +func (x *PutIPNSRequest) Parse(n pd1.Node) error { + if n.Kind() != pd1.Kind_Map { + return pd2.ErrNA } iter := n.MapIterator() - fieldMap := map[string]pd1.ParseFunc{ + fieldMap := map[string]pd2.ParseFunc{ "ID": x.ID.Parse, "Record": x.Record.Parse, } @@ -2603,7 +2612,7 @@ func (x *PutIPNSRequest) Parse(n pd2.Node) error { } } for _, fieldParse := range fieldMap { - if err := fieldParse(pd2.Null); err != nil { + if err := fieldParse(pd1.Null); err != nil { return err } } @@ -2615,27 +2624,27 @@ type PutIPNSRequest_MapIterator struct { s *PutIPNSRequest } -func (x *PutIPNSRequest_MapIterator) Next() (key pd2.Node, value pd2.Node, err error) { +func (x *PutIPNSRequest_MapIterator) Next() (key pd1.Node, value pd1.Node, err error) { x.i++ switch x.i { case 0: - return pd1.String("ID"), x.s.ID.Node(), nil + return pd2.String("ID"), x.s.ID.Node(), nil case 1: - return pd1.String("Record"), x.s.Record.Node(), nil + return pd2.String("Record"), x.s.Record.Node(), nil } - return nil, nil, pd1.ErrNA + return nil, nil, pd2.ErrNA } func (x *PutIPNSRequest_MapIterator) Done() bool { return x.i+1 >= 2 } -func (x PutIPNSRequest) Kind() pd2.Kind { - return pd2.Kind_Map +func (x PutIPNSRequest) Kind() pd1.Kind { + return pd1.Kind_Map } -func (x PutIPNSRequest) LookupByString(key string) (pd2.Node, error) { +func (x PutIPNSRequest) LookupByString(key string) (pd1.Node, error) { switch key { case "ID": return x.ID.Node(), nil @@ -2643,28 +2652,28 @@ func (x PutIPNSRequest) LookupByString(key string) (pd2.Node, error) { return x.Record.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x PutIPNSRequest) LookupByNode(key pd2.Node) (pd2.Node, error) { +func (x PutIPNSRequest) LookupByNode(key pd1.Node) (pd1.Node, error) { switch key.Kind() { - case pd2.Kind_String: + case pd1.Kind_String: if s, err := key.AsString(); err != nil { return nil, err } else { return x.LookupByString(s) } - case pd2.Kind_Int: + case pd1.Kind_Int: if i, err := key.AsInt(); err != nil { return nil, err } else { return x.LookupByIndex(i) } } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x PutIPNSRequest) LookupByIndex(idx int64) (pd2.Node, error) { +func (x PutIPNSRequest) LookupByIndex(idx int64) (pd1.Node, error) { switch idx { case 0: return x.ID.Node(), nil @@ -2672,10 +2681,10 @@ func (x PutIPNSRequest) LookupByIndex(idx int64) (pd2.Node, error) { return x.Record.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x PutIPNSRequest) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { +func (x PutIPNSRequest) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { switch seg.String() { case "0", "ID": return x.ID.Node(), nil @@ -2683,14 +2692,14 @@ func (x PutIPNSRequest) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { return x.Record.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x PutIPNSRequest) MapIterator() pd2.MapIterator { +func (x PutIPNSRequest) MapIterator() pd1.MapIterator { return &PutIPNSRequest_MapIterator{-1, &x} } -func (x PutIPNSRequest) ListIterator() pd2.ListIterator { +func (x PutIPNSRequest) ListIterator() pd1.ListIterator { return nil } @@ -2707,30 +2716,30 @@ func (x PutIPNSRequest) IsNull() bool { } func (x PutIPNSRequest) AsBool() (bool, error) { - return false, pd1.ErrNA + return false, pd2.ErrNA } func (x PutIPNSRequest) AsInt() (int64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (x PutIPNSRequest) AsFloat() (float64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (x PutIPNSRequest) AsString() (string, error) { - return "", pd1.ErrNA + return "", pd2.ErrNA } func (x PutIPNSRequest) AsBytes() ([]byte, error) { - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x PutIPNSRequest) AsLink() (pd2.Link, error) { - return nil, pd1.ErrNA +func (x PutIPNSRequest) AsLink() (pd1.Link, error) { + return nil, pd2.ErrNA } -func (x PutIPNSRequest) Prototype() pd2.NodePrototype { +func (x PutIPNSRequest) Prototype() pd1.NodePrototype { return nil } @@ -2739,16 +2748,16 @@ func (x PutIPNSRequest) Prototype() pd2.NodePrototype { type PutIPNSResponse struct { } -func (x PutIPNSResponse) Node() pd2.Node { +func (x PutIPNSResponse) Node() pd1.Node { return x } -func (x *PutIPNSResponse) Parse(n pd2.Node) error { - if n.Kind() != pd2.Kind_Map { - return pd1.ErrNA +func (x *PutIPNSResponse) Parse(n pd1.Node) error { + if n.Kind() != pd1.Kind_Map { + return pd2.ErrNA } iter := n.MapIterator() - fieldMap := map[string]pd1.ParseFunc{} + fieldMap := map[string]pd2.ParseFunc{} for !iter.Done() { if kn, vn, err := iter.Next(); err != nil { return err @@ -2764,7 +2773,7 @@ func (x *PutIPNSResponse) Parse(n pd2.Node) error { } } for _, fieldParse := range fieldMap { - if err := fieldParse(pd2.Null); err != nil { + if err := fieldParse(pd1.Null); err != nil { return err } } @@ -2776,66 +2785,66 @@ type PutIPNSResponse_MapIterator struct { s *PutIPNSResponse } -func (x *PutIPNSResponse_MapIterator) Next() (key pd2.Node, value pd2.Node, err error) { +func (x *PutIPNSResponse_MapIterator) Next() (key pd1.Node, value pd1.Node, err error) { x.i++ switch x.i { } - return nil, nil, pd1.ErrNA + return nil, nil, pd2.ErrNA } func (x *PutIPNSResponse_MapIterator) Done() bool { return x.i+1 >= 0 } -func (x PutIPNSResponse) Kind() pd2.Kind { - return pd2.Kind_Map +func (x PutIPNSResponse) Kind() pd1.Kind { + return pd1.Kind_Map } -func (x PutIPNSResponse) LookupByString(key string) (pd2.Node, error) { +func (x PutIPNSResponse) LookupByString(key string) (pd1.Node, error) { switch key { } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x PutIPNSResponse) LookupByNode(key pd2.Node) (pd2.Node, error) { +func (x PutIPNSResponse) LookupByNode(key pd1.Node) (pd1.Node, error) { switch key.Kind() { - case pd2.Kind_String: + case pd1.Kind_String: if s, err := key.AsString(); err != nil { return nil, err } else { return x.LookupByString(s) } - case pd2.Kind_Int: + case pd1.Kind_Int: if i, err := key.AsInt(); err != nil { return nil, err } else { return x.LookupByIndex(i) } } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x PutIPNSResponse) LookupByIndex(idx int64) (pd2.Node, error) { +func (x PutIPNSResponse) LookupByIndex(idx int64) (pd1.Node, error) { switch idx { } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x PutIPNSResponse) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { +func (x PutIPNSResponse) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { switch seg.String() { } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x PutIPNSResponse) MapIterator() pd2.MapIterator { +func (x PutIPNSResponse) MapIterator() pd1.MapIterator { return &PutIPNSResponse_MapIterator{-1, &x} } -func (x PutIPNSResponse) ListIterator() pd2.ListIterator { +func (x PutIPNSResponse) ListIterator() pd1.ListIterator { return nil } @@ -2852,44 +2861,44 @@ func (x PutIPNSResponse) IsNull() bool { } func (x PutIPNSResponse) AsBool() (bool, error) { - return false, pd1.ErrNA + return false, pd2.ErrNA } func (x PutIPNSResponse) AsInt() (int64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (x PutIPNSResponse) AsFloat() (float64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (x PutIPNSResponse) AsString() (string, error) { - return "", pd1.ErrNA + return "", pd2.ErrNA } func (x PutIPNSResponse) AsBytes() ([]byte, error) { - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x PutIPNSResponse) AsLink() (pd2.Link, error) { - return nil, pd1.ErrNA +func (x PutIPNSResponse) AsLink() (pd1.Link, error) { + return nil, pd2.ErrNA } -func (x PutIPNSResponse) Prototype() pd2.NodePrototype { +func (x PutIPNSResponse) Prototype() pd1.NodePrototype { return nil } // -- protocol type LinkToAny -- -type LinkToAny pd16.Cid +type LinkToAny pd17.Cid -func (v *LinkToAny) Parse(n pd2.Node) error { - if n.Kind() != pd2.Kind_Link { - return pd1.ErrNA +func (v *LinkToAny) Parse(n pd1.Node) error { + if n.Kind() != pd1.Kind_Link { + return pd2.ErrNA } else { ipldLink, _ := n.AsLink() // TODO: Is there a more general way to convert ipld.Link interface into a concrete user object? - cidLink, ok := ipldLink.(pd17.Link) + cidLink, ok := ipldLink.(pd16.Link) if !ok { return pd3.Errorf("only cid links are supported") } else { @@ -2899,35 +2908,35 @@ func (v *LinkToAny) Parse(n pd2.Node) error { } } -func (v LinkToAny) Node() pd2.Node { +func (v LinkToAny) Node() pd1.Node { return v } -func (LinkToAny) Kind() pd2.Kind { - return pd2.Kind_Link +func (LinkToAny) Kind() pd1.Kind { + return pd1.Kind_Link } -func (LinkToAny) LookupByString(string) (pd2.Node, error) { - return nil, pd1.ErrNA +func (LinkToAny) LookupByString(string) (pd1.Node, error) { + return nil, pd2.ErrNA } -func (LinkToAny) LookupByNode(key pd2.Node) (pd2.Node, error) { - return nil, pd1.ErrNA +func (LinkToAny) LookupByNode(key pd1.Node) (pd1.Node, error) { + return nil, pd2.ErrNA } -func (LinkToAny) LookupByIndex(idx int64) (pd2.Node, error) { - return nil, pd1.ErrNA +func (LinkToAny) LookupByIndex(idx int64) (pd1.Node, error) { + return nil, pd2.ErrNA } -func (LinkToAny) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { - return nil, pd1.ErrNA +func (LinkToAny) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { + return nil, pd2.ErrNA } -func (LinkToAny) MapIterator() pd2.MapIterator { +func (LinkToAny) MapIterator() pd1.MapIterator { return nil } -func (LinkToAny) ListIterator() pd2.ListIterator { +func (LinkToAny) ListIterator() pd1.ListIterator { return nil } @@ -2944,30 +2953,30 @@ func (LinkToAny) IsNull() bool { } func (LinkToAny) AsBool() (bool, error) { - return false, pd1.ErrNA + return false, pd2.ErrNA } func (v LinkToAny) AsInt() (int64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (LinkToAny) AsFloat() (float64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (LinkToAny) AsString() (string, error) { - return "", pd1.ErrNA + return "", pd2.ErrNA } func (LinkToAny) AsBytes() ([]byte, error) { - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (v LinkToAny) AsLink() (pd2.Link, error) { - return pd17.Link{Cid: pd16.Cid(v)}, nil +func (v LinkToAny) AsLink() (pd1.Link, error) { + return pd16.Link{Cid: pd17.Cid(v)}, nil } -func (LinkToAny) Prototype() pd2.NodePrototype { +func (LinkToAny) Prototype() pd1.NodePrototype { return nil // not needed } @@ -2978,16 +2987,16 @@ type Provider struct { ProviderProto TransferProtocolList } -func (x Provider) Node() pd2.Node { +func (x Provider) Node() pd1.Node { return x } -func (x *Provider) Parse(n pd2.Node) error { - if n.Kind() != pd2.Kind_Map { - return pd1.ErrNA +func (x *Provider) Parse(n pd1.Node) error { + if n.Kind() != pd1.Kind_Map { + return pd2.ErrNA } iter := n.MapIterator() - fieldMap := map[string]pd1.ParseFunc{ + fieldMap := map[string]pd2.ParseFunc{ "Node": x.ProviderNode.Parse, "Proto": x.ProviderProto.Parse, } @@ -3022,7 +3031,7 @@ func (x *Provider) Parse(n pd2.Node) error { } } for _, fieldParse := range fieldMap { - if err := fieldParse(pd2.Null); err != nil { + if err := fieldParse(pd1.Null); err != nil { return err } } @@ -3034,27 +3043,27 @@ type Provider_MapIterator struct { s *Provider } -func (x *Provider_MapIterator) Next() (key pd2.Node, value pd2.Node, err error) { +func (x *Provider_MapIterator) Next() (key pd1.Node, value pd1.Node, err error) { x.i++ switch x.i { case 0: - return pd1.String("Node"), x.s.ProviderNode.Node(), nil + return pd2.String("Node"), x.s.ProviderNode.Node(), nil case 1: - return pd1.String("Proto"), x.s.ProviderProto.Node(), nil + return pd2.String("Proto"), x.s.ProviderProto.Node(), nil } - return nil, nil, pd1.ErrNA + return nil, nil, pd2.ErrNA } func (x *Provider_MapIterator) Done() bool { return x.i+1 >= 2 } -func (x Provider) Kind() pd2.Kind { - return pd2.Kind_Map +func (x Provider) Kind() pd1.Kind { + return pd1.Kind_Map } -func (x Provider) LookupByString(key string) (pd2.Node, error) { +func (x Provider) LookupByString(key string) (pd1.Node, error) { switch key { case "Node": return x.ProviderNode.Node(), nil @@ -3062,28 +3071,28 @@ func (x Provider) LookupByString(key string) (pd2.Node, error) { return x.ProviderProto.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x Provider) LookupByNode(key pd2.Node) (pd2.Node, error) { +func (x Provider) LookupByNode(key pd1.Node) (pd1.Node, error) { switch key.Kind() { - case pd2.Kind_String: + case pd1.Kind_String: if s, err := key.AsString(); err != nil { return nil, err } else { return x.LookupByString(s) } - case pd2.Kind_Int: + case pd1.Kind_Int: if i, err := key.AsInt(); err != nil { return nil, err } else { return x.LookupByIndex(i) } } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x Provider) LookupByIndex(idx int64) (pd2.Node, error) { +func (x Provider) LookupByIndex(idx int64) (pd1.Node, error) { switch idx { case 0: return x.ProviderNode.Node(), nil @@ -3091,10 +3100,10 @@ func (x Provider) LookupByIndex(idx int64) (pd2.Node, error) { return x.ProviderProto.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x Provider) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { +func (x Provider) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { switch seg.String() { case "0", "Node": return x.ProviderNode.Node(), nil @@ -3102,14 +3111,14 @@ func (x Provider) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { return x.ProviderProto.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x Provider) MapIterator() pd2.MapIterator { +func (x Provider) MapIterator() pd1.MapIterator { return &Provider_MapIterator{-1, &x} } -func (x Provider) ListIterator() pd2.ListIterator { +func (x Provider) ListIterator() pd1.ListIterator { return nil } @@ -3126,30 +3135,30 @@ func (x Provider) IsNull() bool { } func (x Provider) AsBool() (bool, error) { - return false, pd1.ErrNA + return false, pd2.ErrNA } func (x Provider) AsInt() (int64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (x Provider) AsFloat() (float64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (x Provider) AsString() (string, error) { - return "", pd1.ErrNA + return "", pd2.ErrNA } func (x Provider) AsBytes() ([]byte, error) { - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x Provider) AsLink() (pd2.Link, error) { - return nil, pd1.ErrNA +func (x Provider) AsLink() (pd1.Link, error) { + return nil, pd2.ErrNA } -func (x Provider) Prototype() pd2.NodePrototype { +func (x Provider) Prototype() pd1.NodePrototype { return nil } @@ -3157,23 +3166,23 @@ func (x Provider) Prototype() pd2.NodePrototype { type TransferProtocolList []TransferProtocol -func (v TransferProtocolList) Node() pd2.Node { +func (v TransferProtocolList) Node() pd1.Node { return v } -func (v *TransferProtocolList) Parse(n pd2.Node) error { - if n.Kind() == pd2.Kind_Null { +func (v *TransferProtocolList) Parse(n pd1.Node) error { + if n.Kind() == pd1.Kind_Null { *v = nil return nil } - if n.Kind() != pd2.Kind_List { - return pd1.ErrNA + if n.Kind() != pd1.Kind_List { + return pd2.ErrNA } else { *v = make(TransferProtocolList, n.Length()) iter := n.ListIterator() for !iter.Done() { if i, n, err := iter.Next(); err != nil { - return pd1.ErrNA + return pd2.ErrNA } else if err = (*v)[i].Parse(n); err != nil { return err } @@ -3182,39 +3191,39 @@ func (v *TransferProtocolList) Parse(n pd2.Node) error { } } -func (TransferProtocolList) Kind() pd2.Kind { - return pd2.Kind_List +func (TransferProtocolList) Kind() pd1.Kind { + return pd1.Kind_List } -func (TransferProtocolList) LookupByString(string) (pd2.Node, error) { - return nil, pd1.ErrNA +func (TransferProtocolList) LookupByString(string) (pd1.Node, error) { + return nil, pd2.ErrNA } -func (TransferProtocolList) LookupByNode(key pd2.Node) (pd2.Node, error) { - return nil, pd1.ErrNA +func (TransferProtocolList) LookupByNode(key pd1.Node) (pd1.Node, error) { + return nil, pd2.ErrNA } -func (v TransferProtocolList) LookupByIndex(i int64) (pd2.Node, error) { +func (v TransferProtocolList) LookupByIndex(i int64) (pd1.Node, error) { if i < 0 || i >= v.Length() { - return nil, pd1.ErrBounds + return nil, pd2.ErrBounds } else { return v[i].Node(), nil } } -func (v TransferProtocolList) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { +func (v TransferProtocolList) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { if i, err := seg.Index(); err != nil { - return nil, pd1.ErrNA + return nil, pd2.ErrNA } else { return v.LookupByIndex(i) } } -func (TransferProtocolList) MapIterator() pd2.MapIterator { +func (TransferProtocolList) MapIterator() pd1.MapIterator { return nil } -func (v TransferProtocolList) ListIterator() pd2.ListIterator { +func (v TransferProtocolList) ListIterator() pd1.ListIterator { return &TransferProtocolList_ListIterator{v, 0} } @@ -3231,30 +3240,30 @@ func (TransferProtocolList) IsNull() bool { } func (v TransferProtocolList) AsBool() (bool, error) { - return false, pd1.ErrNA + return false, pd2.ErrNA } func (TransferProtocolList) AsInt() (int64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (TransferProtocolList) AsFloat() (float64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (TransferProtocolList) AsString() (string, error) { - return "", pd1.ErrNA + return "", pd2.ErrNA } func (TransferProtocolList) AsBytes() ([]byte, error) { - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (TransferProtocolList) AsLink() (pd2.Link, error) { - return nil, pd1.ErrNA +func (TransferProtocolList) AsLink() (pd1.Link, error) { + return nil, pd2.ErrNA } -func (TransferProtocolList) Prototype() pd2.NodePrototype { +func (TransferProtocolList) Prototype() pd1.NodePrototype { return nil // not needed } @@ -3263,9 +3272,9 @@ type TransferProtocolList_ListIterator struct { at int64 } -func (iter *TransferProtocolList_ListIterator) Next() (int64, pd2.Node, error) { +func (iter *TransferProtocolList_ListIterator) Next() (int64, pd1.Node, error) { if iter.Done() { - return -1, nil, pd1.ErrBounds + return -1, nil, pd2.ErrBounds } v := iter.list[iter.at] i := int64(iter.at) @@ -3283,13 +3292,13 @@ type Node struct { Peer *Peer DefaultKey string - DefaultValue *pd1.Any + DefaultValue *pd2.Any } -func (x *Node) Parse(n pd2.Node) error { +func (x *Node) Parse(n pd1.Node) error { *x = Node{} - if n.Kind() != pd2.Kind_Map { - return pd1.ErrNA + if n.Kind() != pd1.Kind_Map { + return pd2.ErrNA } iter := n.MapIterator() kn, vn, err := iter.Next() @@ -3310,7 +3319,7 @@ func (x *Node) Parse(n pd2.Node) error { return nil default: - var y pd1.Any + var y pd2.Any if err := y.Parse(vn); err != nil { return err } @@ -3327,17 +3336,17 @@ type Node_MapIterator struct { s *Node } -func (x *Node_MapIterator) Next() (key pd2.Node, value pd2.Node, err error) { +func (x *Node_MapIterator) Next() (key pd1.Node, value pd1.Node, err error) { if x.done { - return nil, nil, pd1.ErrNA + return nil, nil, pd2.ErrNA } else { x.done = true switch { case x.s.Peer != nil: - return pd1.String("peer"), x.s.Peer.Node(), nil + return pd2.String("peer"), x.s.Peer.Node(), nil case x.s.DefaultValue != nil: - return pd1.String(x.s.DefaultKey), x.s.DefaultValue.Node(), nil + return pd2.String(x.s.DefaultKey), x.s.DefaultValue.Node(), nil default: return nil, nil, pd3.Errorf("no inductive cases are set") @@ -3349,15 +3358,15 @@ func (x *Node_MapIterator) Done() bool { return x.done } -func (x Node) Node() pd2.Node { +func (x Node) Node() pd1.Node { return x } -func (x Node) Kind() pd2.Kind { - return pd2.Kind_Map +func (x Node) Kind() pd1.Kind { + return pd1.Kind_Map } -func (x Node) LookupByString(key string) (pd2.Node, error) { +func (x Node) LookupByString(key string) (pd1.Node, error) { switch { case x.Peer != nil && key == "peer": return x.Peer.Node(), nil @@ -3366,12 +3375,12 @@ func (x Node) LookupByString(key string) (pd2.Node, error) { return x.DefaultValue.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x Node) LookupByNode(key pd2.Node) (pd2.Node, error) { - if key.Kind() != pd2.Kind_String { - return nil, pd1.ErrNA +func (x Node) LookupByNode(key pd1.Node) (pd1.Node, error) { + if key.Kind() != pd1.Kind_String { + return nil, pd2.ErrNA } if s, err := key.AsString(); err != nil { return nil, err @@ -3380,11 +3389,11 @@ func (x Node) LookupByNode(key pd2.Node) (pd2.Node, error) { } } -func (x Node) LookupByIndex(idx int64) (pd2.Node, error) { - return nil, pd1.ErrNA +func (x Node) LookupByIndex(idx int64) (pd1.Node, error) { + return nil, pd2.ErrNA } -func (x Node) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { +func (x Node) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { switch seg.String() { case "peer": return x.Peer.Node(), nil @@ -3393,14 +3402,14 @@ func (x Node) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { return x.DefaultValue.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x Node) MapIterator() pd2.MapIterator { +func (x Node) MapIterator() pd1.MapIterator { return &Node_MapIterator{false, &x} } -func (x Node) ListIterator() pd2.ListIterator { +func (x Node) ListIterator() pd1.ListIterator { return nil } @@ -3417,54 +3426,54 @@ func (x Node) IsNull() bool { } func (x Node) AsBool() (bool, error) { - return false, pd1.ErrNA + return false, pd2.ErrNA } func (x Node) AsInt() (int64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (x Node) AsFloat() (float64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (x Node) AsString() (string, error) { - return "", pd1.ErrNA + return "", pd2.ErrNA } func (x Node) AsBytes() ([]byte, error) { - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x Node) AsLink() (pd2.Link, error) { - return nil, pd1.ErrNA +func (x Node) AsLink() (pd1.Link, error) { + return nil, pd2.ErrNA } -func (x Node) Prototype() pd2.NodePrototype { +func (x Node) Prototype() pd1.NodePrototype { return nil } // -- protocol type AnonList18 -- -type AnonList18 []pd1.Bytes +type AnonList18 []pd2.Bytes -func (v AnonList18) Node() pd2.Node { +func (v AnonList18) Node() pd1.Node { return v } -func (v *AnonList18) Parse(n pd2.Node) error { - if n.Kind() == pd2.Kind_Null { +func (v *AnonList18) Parse(n pd1.Node) error { + if n.Kind() == pd1.Kind_Null { *v = nil return nil } - if n.Kind() != pd2.Kind_List { - return pd1.ErrNA + if n.Kind() != pd1.Kind_List { + return pd2.ErrNA } else { *v = make(AnonList18, n.Length()) iter := n.ListIterator() for !iter.Done() { if i, n, err := iter.Next(); err != nil { - return pd1.ErrNA + return pd2.ErrNA } else if err = (*v)[i].Parse(n); err != nil { return err } @@ -3473,39 +3482,39 @@ func (v *AnonList18) Parse(n pd2.Node) error { } } -func (AnonList18) Kind() pd2.Kind { - return pd2.Kind_List +func (AnonList18) Kind() pd1.Kind { + return pd1.Kind_List } -func (AnonList18) LookupByString(string) (pd2.Node, error) { - return nil, pd1.ErrNA +func (AnonList18) LookupByString(string) (pd1.Node, error) { + return nil, pd2.ErrNA } -func (AnonList18) LookupByNode(key pd2.Node) (pd2.Node, error) { - return nil, pd1.ErrNA +func (AnonList18) LookupByNode(key pd1.Node) (pd1.Node, error) { + return nil, pd2.ErrNA } -func (v AnonList18) LookupByIndex(i int64) (pd2.Node, error) { +func (v AnonList18) LookupByIndex(i int64) (pd1.Node, error) { if i < 0 || i >= v.Length() { - return nil, pd1.ErrBounds + return nil, pd2.ErrBounds } else { return v[i].Node(), nil } } -func (v AnonList18) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { +func (v AnonList18) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { if i, err := seg.Index(); err != nil { - return nil, pd1.ErrNA + return nil, pd2.ErrNA } else { return v.LookupByIndex(i) } } -func (AnonList18) MapIterator() pd2.MapIterator { +func (AnonList18) MapIterator() pd1.MapIterator { return nil } -func (v AnonList18) ListIterator() pd2.ListIterator { +func (v AnonList18) ListIterator() pd1.ListIterator { return &AnonList18_ListIterator{v, 0} } @@ -3522,30 +3531,30 @@ func (AnonList18) IsNull() bool { } func (v AnonList18) AsBool() (bool, error) { - return false, pd1.ErrNA + return false, pd2.ErrNA } func (AnonList18) AsInt() (int64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (AnonList18) AsFloat() (float64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (AnonList18) AsString() (string, error) { - return "", pd1.ErrNA + return "", pd2.ErrNA } func (AnonList18) AsBytes() ([]byte, error) { - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (AnonList18) AsLink() (pd2.Link, error) { - return nil, pd1.ErrNA +func (AnonList18) AsLink() (pd1.Link, error) { + return nil, pd2.ErrNA } -func (AnonList18) Prototype() pd2.NodePrototype { +func (AnonList18) Prototype() pd1.NodePrototype { return nil // not needed } @@ -3554,9 +3563,9 @@ type AnonList18_ListIterator struct { at int64 } -func (iter *AnonList18_ListIterator) Next() (int64, pd2.Node, error) { +func (iter *AnonList18_ListIterator) Next() (int64, pd1.Node, error) { if iter.Done() { - return -1, nil, pd1.ErrBounds + return -1, nil, pd2.ErrBounds } v := iter.list[iter.at] i := int64(iter.at) @@ -3571,20 +3580,20 @@ func (iter *AnonList18_ListIterator) Done() bool { // -- protocol type Peer -- type Peer struct { - ID pd1.Bytes + ID pd2.Bytes Multiaddresses AnonList18 } -func (x Peer) Node() pd2.Node { +func (x Peer) Node() pd1.Node { return x } -func (x *Peer) Parse(n pd2.Node) error { - if n.Kind() != pd2.Kind_Map { - return pd1.ErrNA +func (x *Peer) Parse(n pd1.Node) error { + if n.Kind() != pd1.Kind_Map { + return pd2.ErrNA } iter := n.MapIterator() - fieldMap := map[string]pd1.ParseFunc{ + fieldMap := map[string]pd2.ParseFunc{ "ID": x.ID.Parse, "Multiaddresses": x.Multiaddresses.Parse, } @@ -3619,7 +3628,7 @@ func (x *Peer) Parse(n pd2.Node) error { } } for _, fieldParse := range fieldMap { - if err := fieldParse(pd2.Null); err != nil { + if err := fieldParse(pd1.Null); err != nil { return err } } @@ -3631,27 +3640,27 @@ type Peer_MapIterator struct { s *Peer } -func (x *Peer_MapIterator) Next() (key pd2.Node, value pd2.Node, err error) { +func (x *Peer_MapIterator) Next() (key pd1.Node, value pd1.Node, err error) { x.i++ switch x.i { case 0: - return pd1.String("ID"), x.s.ID.Node(), nil + return pd2.String("ID"), x.s.ID.Node(), nil case 1: - return pd1.String("Multiaddresses"), x.s.Multiaddresses.Node(), nil + return pd2.String("Multiaddresses"), x.s.Multiaddresses.Node(), nil } - return nil, nil, pd1.ErrNA + return nil, nil, pd2.ErrNA } func (x *Peer_MapIterator) Done() bool { return x.i+1 >= 2 } -func (x Peer) Kind() pd2.Kind { - return pd2.Kind_Map +func (x Peer) Kind() pd1.Kind { + return pd1.Kind_Map } -func (x Peer) LookupByString(key string) (pd2.Node, error) { +func (x Peer) LookupByString(key string) (pd1.Node, error) { switch key { case "ID": return x.ID.Node(), nil @@ -3659,28 +3668,28 @@ func (x Peer) LookupByString(key string) (pd2.Node, error) { return x.Multiaddresses.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x Peer) LookupByNode(key pd2.Node) (pd2.Node, error) { +func (x Peer) LookupByNode(key pd1.Node) (pd1.Node, error) { switch key.Kind() { - case pd2.Kind_String: + case pd1.Kind_String: if s, err := key.AsString(); err != nil { return nil, err } else { return x.LookupByString(s) } - case pd2.Kind_Int: + case pd1.Kind_Int: if i, err := key.AsInt(); err != nil { return nil, err } else { return x.LookupByIndex(i) } } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x Peer) LookupByIndex(idx int64) (pd2.Node, error) { +func (x Peer) LookupByIndex(idx int64) (pd1.Node, error) { switch idx { case 0: return x.ID.Node(), nil @@ -3688,10 +3697,10 @@ func (x Peer) LookupByIndex(idx int64) (pd2.Node, error) { return x.Multiaddresses.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x Peer) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { +func (x Peer) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { switch seg.String() { case "0", "ID": return x.ID.Node(), nil @@ -3699,14 +3708,14 @@ func (x Peer) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { return x.Multiaddresses.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x Peer) MapIterator() pd2.MapIterator { +func (x Peer) MapIterator() pd1.MapIterator { return &Peer_MapIterator{-1, &x} } -func (x Peer) ListIterator() pd2.ListIterator { +func (x Peer) ListIterator() pd1.ListIterator { return nil } @@ -3723,30 +3732,30 @@ func (x Peer) IsNull() bool { } func (x Peer) AsBool() (bool, error) { - return false, pd1.ErrNA + return false, pd2.ErrNA } func (x Peer) AsInt() (int64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (x Peer) AsFloat() (float64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (x Peer) AsString() (string, error) { - return "", pd1.ErrNA + return "", pd2.ErrNA } func (x Peer) AsBytes() ([]byte, error) { - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x Peer) AsLink() (pd2.Link, error) { - return nil, pd1.ErrNA +func (x Peer) AsLink() (pd1.Link, error) { + return nil, pd2.ErrNA } -func (x Peer) Prototype() pd2.NodePrototype { +func (x Peer) Prototype() pd1.NodePrototype { return nil } @@ -3757,13 +3766,13 @@ type TransferProtocol struct { GraphSyncFILv1 *GraphSyncFILv1Protocol DefaultKey string - DefaultValue *pd1.Any + DefaultValue *pd2.Any } -func (x *TransferProtocol) Parse(n pd2.Node) error { +func (x *TransferProtocol) Parse(n pd1.Node) error { *x = TransferProtocol{} - if n.Kind() != pd2.Kind_Map { - return pd1.ErrNA + if n.Kind() != pd1.Kind_Map { + return pd2.ErrNA } iter := n.MapIterator() kn, vn, err := iter.Next() @@ -3791,7 +3800,7 @@ func (x *TransferProtocol) Parse(n pd2.Node) error { return nil default: - var y pd1.Any + var y pd2.Any if err := y.Parse(vn); err != nil { return err } @@ -3808,19 +3817,19 @@ type TransferProtocol_MapIterator struct { s *TransferProtocol } -func (x *TransferProtocol_MapIterator) Next() (key pd2.Node, value pd2.Node, err error) { +func (x *TransferProtocol_MapIterator) Next() (key pd1.Node, value pd1.Node, err error) { if x.done { - return nil, nil, pd1.ErrNA + return nil, nil, pd2.ErrNA } else { x.done = true switch { case x.s.Bitswap != nil: - return pd1.String("2304"), x.s.Bitswap.Node(), nil + return pd2.String("2304"), x.s.Bitswap.Node(), nil case x.s.GraphSyncFILv1 != nil: - return pd1.String("2320"), x.s.GraphSyncFILv1.Node(), nil + return pd2.String("2320"), x.s.GraphSyncFILv1.Node(), nil case x.s.DefaultValue != nil: - return pd1.String(x.s.DefaultKey), x.s.DefaultValue.Node(), nil + return pd2.String(x.s.DefaultKey), x.s.DefaultValue.Node(), nil default: return nil, nil, pd3.Errorf("no inductive cases are set") @@ -3832,15 +3841,15 @@ func (x *TransferProtocol_MapIterator) Done() bool { return x.done } -func (x TransferProtocol) Node() pd2.Node { +func (x TransferProtocol) Node() pd1.Node { return x } -func (x TransferProtocol) Kind() pd2.Kind { - return pd2.Kind_Map +func (x TransferProtocol) Kind() pd1.Kind { + return pd1.Kind_Map } -func (x TransferProtocol) LookupByString(key string) (pd2.Node, error) { +func (x TransferProtocol) LookupByString(key string) (pd1.Node, error) { switch { case x.Bitswap != nil && key == "2304": return x.Bitswap.Node(), nil @@ -3851,12 +3860,12 @@ func (x TransferProtocol) LookupByString(key string) (pd2.Node, error) { return x.DefaultValue.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x TransferProtocol) LookupByNode(key pd2.Node) (pd2.Node, error) { - if key.Kind() != pd2.Kind_String { - return nil, pd1.ErrNA +func (x TransferProtocol) LookupByNode(key pd1.Node) (pd1.Node, error) { + if key.Kind() != pd1.Kind_String { + return nil, pd2.ErrNA } if s, err := key.AsString(); err != nil { return nil, err @@ -3865,11 +3874,11 @@ func (x TransferProtocol) LookupByNode(key pd2.Node) (pd2.Node, error) { } } -func (x TransferProtocol) LookupByIndex(idx int64) (pd2.Node, error) { - return nil, pd1.ErrNA +func (x TransferProtocol) LookupByIndex(idx int64) (pd1.Node, error) { + return nil, pd2.ErrNA } -func (x TransferProtocol) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { +func (x TransferProtocol) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { switch seg.String() { case "2304": return x.Bitswap.Node(), nil @@ -3880,14 +3889,14 @@ func (x TransferProtocol) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) return x.DefaultValue.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x TransferProtocol) MapIterator() pd2.MapIterator { +func (x TransferProtocol) MapIterator() pd1.MapIterator { return &TransferProtocol_MapIterator{false, &x} } -func (x TransferProtocol) ListIterator() pd2.ListIterator { +func (x TransferProtocol) ListIterator() pd1.ListIterator { return nil } @@ -3904,30 +3913,30 @@ func (x TransferProtocol) IsNull() bool { } func (x TransferProtocol) AsBool() (bool, error) { - return false, pd1.ErrNA + return false, pd2.ErrNA } func (x TransferProtocol) AsInt() (int64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (x TransferProtocol) AsFloat() (float64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (x TransferProtocol) AsString() (string, error) { - return "", pd1.ErrNA + return "", pd2.ErrNA } func (x TransferProtocol) AsBytes() ([]byte, error) { - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x TransferProtocol) AsLink() (pd2.Link, error) { - return nil, pd1.ErrNA +func (x TransferProtocol) AsLink() (pd1.Link, error) { + return nil, pd2.ErrNA } -func (x TransferProtocol) Prototype() pd2.NodePrototype { +func (x TransferProtocol) Prototype() pd1.NodePrototype { return nil } @@ -3936,16 +3945,16 @@ func (x TransferProtocol) Prototype() pd2.NodePrototype { type BitswapProtocol struct { } -func (x BitswapProtocol) Node() pd2.Node { +func (x BitswapProtocol) Node() pd1.Node { return x } -func (x *BitswapProtocol) Parse(n pd2.Node) error { - if n.Kind() != pd2.Kind_Map { - return pd1.ErrNA +func (x *BitswapProtocol) Parse(n pd1.Node) error { + if n.Kind() != pd1.Kind_Map { + return pd2.ErrNA } iter := n.MapIterator() - fieldMap := map[string]pd1.ParseFunc{} + fieldMap := map[string]pd2.ParseFunc{} for !iter.Done() { if kn, vn, err := iter.Next(); err != nil { return err @@ -3961,7 +3970,7 @@ func (x *BitswapProtocol) Parse(n pd2.Node) error { } } for _, fieldParse := range fieldMap { - if err := fieldParse(pd2.Null); err != nil { + if err := fieldParse(pd1.Null); err != nil { return err } } @@ -3973,66 +3982,66 @@ type BitswapProtocol_MapIterator struct { s *BitswapProtocol } -func (x *BitswapProtocol_MapIterator) Next() (key pd2.Node, value pd2.Node, err error) { +func (x *BitswapProtocol_MapIterator) Next() (key pd1.Node, value pd1.Node, err error) { x.i++ switch x.i { } - return nil, nil, pd1.ErrNA + return nil, nil, pd2.ErrNA } func (x *BitswapProtocol_MapIterator) Done() bool { return x.i+1 >= 0 } -func (x BitswapProtocol) Kind() pd2.Kind { - return pd2.Kind_Map +func (x BitswapProtocol) Kind() pd1.Kind { + return pd1.Kind_Map } -func (x BitswapProtocol) LookupByString(key string) (pd2.Node, error) { +func (x BitswapProtocol) LookupByString(key string) (pd1.Node, error) { switch key { } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x BitswapProtocol) LookupByNode(key pd2.Node) (pd2.Node, error) { +func (x BitswapProtocol) LookupByNode(key pd1.Node) (pd1.Node, error) { switch key.Kind() { - case pd2.Kind_String: + case pd1.Kind_String: if s, err := key.AsString(); err != nil { return nil, err } else { return x.LookupByString(s) } - case pd2.Kind_Int: + case pd1.Kind_Int: if i, err := key.AsInt(); err != nil { return nil, err } else { return x.LookupByIndex(i) } } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x BitswapProtocol) LookupByIndex(idx int64) (pd2.Node, error) { +func (x BitswapProtocol) LookupByIndex(idx int64) (pd1.Node, error) { switch idx { } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x BitswapProtocol) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { +func (x BitswapProtocol) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { switch seg.String() { } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x BitswapProtocol) MapIterator() pd2.MapIterator { +func (x BitswapProtocol) MapIterator() pd1.MapIterator { return &BitswapProtocol_MapIterator{-1, &x} } -func (x BitswapProtocol) ListIterator() pd2.ListIterator { +func (x BitswapProtocol) ListIterator() pd1.ListIterator { return nil } @@ -4049,30 +4058,30 @@ func (x BitswapProtocol) IsNull() bool { } func (x BitswapProtocol) AsBool() (bool, error) { - return false, pd1.ErrNA + return false, pd2.ErrNA } func (x BitswapProtocol) AsInt() (int64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (x BitswapProtocol) AsFloat() (float64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (x BitswapProtocol) AsString() (string, error) { - return "", pd1.ErrNA + return "", pd2.ErrNA } func (x BitswapProtocol) AsBytes() ([]byte, error) { - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x BitswapProtocol) AsLink() (pd2.Link, error) { - return nil, pd1.ErrNA +func (x BitswapProtocol) AsLink() (pd1.Link, error) { + return nil, pd2.ErrNA } -func (x BitswapProtocol) Prototype() pd2.NodePrototype { +func (x BitswapProtocol) Prototype() pd1.NodePrototype { return nil } @@ -4080,20 +4089,20 @@ func (x BitswapProtocol) Prototype() pd2.NodePrototype { type GraphSyncFILv1Protocol struct { PieceCID LinkToAny - VerifiedDeal pd1.Bool - FastRetrieval pd1.Bool + VerifiedDeal pd2.Bool + FastRetrieval pd2.Bool } -func (x GraphSyncFILv1Protocol) Node() pd2.Node { +func (x GraphSyncFILv1Protocol) Node() pd1.Node { return x } -func (x *GraphSyncFILv1Protocol) Parse(n pd2.Node) error { - if n.Kind() != pd2.Kind_Map { - return pd1.ErrNA +func (x *GraphSyncFILv1Protocol) Parse(n pd1.Node) error { + if n.Kind() != pd1.Kind_Map { + return pd2.ErrNA } iter := n.MapIterator() - fieldMap := map[string]pd1.ParseFunc{ + fieldMap := map[string]pd2.ParseFunc{ "PieceCID": x.PieceCID.Parse, "VerifiedDeal": x.VerifiedDeal.Parse, "FastRetrieval": x.FastRetrieval.Parse, @@ -4137,7 +4146,7 @@ func (x *GraphSyncFILv1Protocol) Parse(n pd2.Node) error { } } for _, fieldParse := range fieldMap { - if err := fieldParse(pd2.Null); err != nil { + if err := fieldParse(pd1.Null); err != nil { return err } } @@ -4149,29 +4158,29 @@ type GraphSyncFILv1Protocol_MapIterator struct { s *GraphSyncFILv1Protocol } -func (x *GraphSyncFILv1Protocol_MapIterator) Next() (key pd2.Node, value pd2.Node, err error) { +func (x *GraphSyncFILv1Protocol_MapIterator) Next() (key pd1.Node, value pd1.Node, err error) { x.i++ switch x.i { case 0: - return pd1.String("PieceCID"), x.s.PieceCID.Node(), nil + return pd2.String("PieceCID"), x.s.PieceCID.Node(), nil case 1: - return pd1.String("VerifiedDeal"), x.s.VerifiedDeal.Node(), nil + return pd2.String("VerifiedDeal"), x.s.VerifiedDeal.Node(), nil case 2: - return pd1.String("FastRetrieval"), x.s.FastRetrieval.Node(), nil + return pd2.String("FastRetrieval"), x.s.FastRetrieval.Node(), nil } - return nil, nil, pd1.ErrNA + return nil, nil, pd2.ErrNA } func (x *GraphSyncFILv1Protocol_MapIterator) Done() bool { return x.i+1 >= 3 } -func (x GraphSyncFILv1Protocol) Kind() pd2.Kind { - return pd2.Kind_Map +func (x GraphSyncFILv1Protocol) Kind() pd1.Kind { + return pd1.Kind_Map } -func (x GraphSyncFILv1Protocol) LookupByString(key string) (pd2.Node, error) { +func (x GraphSyncFILv1Protocol) LookupByString(key string) (pd1.Node, error) { switch key { case "PieceCID": return x.PieceCID.Node(), nil @@ -4181,28 +4190,28 @@ func (x GraphSyncFILv1Protocol) LookupByString(key string) (pd2.Node, error) { return x.FastRetrieval.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x GraphSyncFILv1Protocol) LookupByNode(key pd2.Node) (pd2.Node, error) { +func (x GraphSyncFILv1Protocol) LookupByNode(key pd1.Node) (pd1.Node, error) { switch key.Kind() { - case pd2.Kind_String: + case pd1.Kind_String: if s, err := key.AsString(); err != nil { return nil, err } else { return x.LookupByString(s) } - case pd2.Kind_Int: + case pd1.Kind_Int: if i, err := key.AsInt(); err != nil { return nil, err } else { return x.LookupByIndex(i) } } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x GraphSyncFILv1Protocol) LookupByIndex(idx int64) (pd2.Node, error) { +func (x GraphSyncFILv1Protocol) LookupByIndex(idx int64) (pd1.Node, error) { switch idx { case 0: return x.PieceCID.Node(), nil @@ -4212,10 +4221,10 @@ func (x GraphSyncFILv1Protocol) LookupByIndex(idx int64) (pd2.Node, error) { return x.FastRetrieval.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x GraphSyncFILv1Protocol) LookupBySegment(seg pd2.PathSegment) (pd2.Node, error) { +func (x GraphSyncFILv1Protocol) LookupBySegment(seg pd1.PathSegment) (pd1.Node, error) { switch seg.String() { case "0", "PieceCID": return x.PieceCID.Node(), nil @@ -4225,14 +4234,14 @@ func (x GraphSyncFILv1Protocol) LookupBySegment(seg pd2.PathSegment) (pd2.Node, return x.FastRetrieval.Node(), nil } - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x GraphSyncFILv1Protocol) MapIterator() pd2.MapIterator { +func (x GraphSyncFILv1Protocol) MapIterator() pd1.MapIterator { return &GraphSyncFILv1Protocol_MapIterator{-1, &x} } -func (x GraphSyncFILv1Protocol) ListIterator() pd2.ListIterator { +func (x GraphSyncFILv1Protocol) ListIterator() pd1.ListIterator { return nil } @@ -4249,29 +4258,29 @@ func (x GraphSyncFILv1Protocol) IsNull() bool { } func (x GraphSyncFILv1Protocol) AsBool() (bool, error) { - return false, pd1.ErrNA + return false, pd2.ErrNA } func (x GraphSyncFILv1Protocol) AsInt() (int64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (x GraphSyncFILv1Protocol) AsFloat() (float64, error) { - return 0, pd1.ErrNA + return 0, pd2.ErrNA } func (x GraphSyncFILv1Protocol) AsString() (string, error) { - return "", pd1.ErrNA + return "", pd2.ErrNA } func (x GraphSyncFILv1Protocol) AsBytes() ([]byte, error) { - return nil, pd1.ErrNA + return nil, pd2.ErrNA } -func (x GraphSyncFILv1Protocol) AsLink() (pd2.Link, error) { - return nil, pd1.ErrNA +func (x GraphSyncFILv1Protocol) AsLink() (pd1.Link, error) { + return nil, pd2.ErrNA } -func (x GraphSyncFILv1Protocol) Prototype() pd2.NodePrototype { +func (x GraphSyncFILv1Protocol) Prototype() pd1.NodePrototype { return nil } diff --git a/go.mod b/go.mod index de4e57d..60bb771 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/ipfs/go-cid v0.2.0 github.com/ipfs/go-ipns v0.1.2 github.com/ipfs/go-log v1.0.5 - github.com/ipld/edelweiss v0.1.3-0.20220610182123-8f900960562b + github.com/ipld/edelweiss v0.1.3-0.20220613204122-55af0600c7ba github.com/ipld/go-ipld-prime v0.16.1-0.20220607160121-f0c1fdf6c6ad github.com/libp2p/go-libp2p-core v0.16.1 github.com/libp2p/go-libp2p-record v0.1.3 diff --git a/go.sum b/go.sum index ab788ed..099e151 100644 --- a/go.sum +++ b/go.sum @@ -96,8 +96,8 @@ github.com/ipfs/go-log v1.0.5/go.mod h1:j0b8ZoR+7+R99LD9jZ6+AJsrzkPbSXbZfGakb5JP github.com/ipfs/go-log/v2 v2.0.5/go.mod h1:eZs4Xt4ZUJQFM3DlanGhy7TkwwawCZcSByscwkWG+dw= github.com/ipfs/go-log/v2 v2.1.3 h1:1iS3IU7aXRlbgUpN8yTTpJ53NXYjAe37vcI5+5nYrzk= github.com/ipfs/go-log/v2 v2.1.3/go.mod h1:/8d0SH3Su5Ooc31QlL1WysJhvyOTDCjcCZ9Axpmri6g= -github.com/ipld/edelweiss v0.1.3-0.20220610182123-8f900960562b h1:BBXLY3jgC3wR1XjUseYzwRfDylAABR6D6t/cQcaHCjM= -github.com/ipld/edelweiss v0.1.3-0.20220610182123-8f900960562b/go.mod h1:egFT0Za/aOmwj2YeUlJwoi/C4ULZoBiFhXouVIGuoqM= +github.com/ipld/edelweiss v0.1.3-0.20220613204122-55af0600c7ba h1:n1g05KbY72/3VBrlumhBUsz93XQwyEOnWP1d0+v2Fhs= +github.com/ipld/edelweiss v0.1.3-0.20220613204122-55af0600c7ba/go.mod h1:egFT0Za/aOmwj2YeUlJwoi/C4ULZoBiFhXouVIGuoqM= github.com/ipld/go-ipld-prime v0.9.0/go.mod h1:KvBLMr4PX1gWptgkzRjVZCrLmSGcZCb/jioOQwCqZN8= github.com/ipld/go-ipld-prime v0.16.1-0.20220607160121-f0c1fdf6c6ad h1:Ucb+0lclJXzmCFX8Fqawl9AqNlcHWhktuPxOi4zL1ic= github.com/ipld/go-ipld-prime v0.16.1-0.20220607160121-f0c1fdf6c6ad/go.mod h1:IInaTjkNLKAZoliYXvjlB3CFQa7IPReVwxOb0oke/RA= From f19c40434696629f5469034779ab45169f533253 Mon Sep 17 00:00:00 2001 From: Petar Maymounkov Date: Fri, 17 Jun 2022 11:46:55 -0700 Subject: [PATCH 5/5] bump to edelweiss v0.1.3 --- gen/proto/proto_edelweiss.go | 232 +++++++++++++++++------------------ go.mod | 6 +- go.sum | 11 +- 3 files changed, 125 insertions(+), 124 deletions(-) diff --git a/gen/proto/proto_edelweiss.go b/gen/proto/proto_edelweiss.go index b118c58..5bf9fb3 100644 --- a/gen/proto/proto_edelweiss.go +++ b/gen/proto/proto_edelweiss.go @@ -3,24 +3,24 @@ package proto import ( - pd11 "bytes" - pd9 "context" - pd12 "errors" + pd10 "bytes" + pd8 "context" + pd7 "errors" pd3 "fmt" - pd8 "io" + pd11 "io" pd15 "io/ioutil" - pd4 "net/http" - pd5 "net/url" - pd6 "sync" + pd5 "net/http" + pd12 "net/url" + pd14 "sync" - pd17 "github.com/ipfs/go-cid" - pd13 "github.com/ipfs/go-log" - pd14 "github.com/ipld/edelweiss/services" + pd16 "github.com/ipfs/go-cid" + pd4 "github.com/ipfs/go-log" + pd13 "github.com/ipld/edelweiss/services" pd2 "github.com/ipld/edelweiss/values" - pd10 "github.com/ipld/go-ipld-prime" - pd7 "github.com/ipld/go-ipld-prime/codec/dagjson" + pd9 "github.com/ipld/go-ipld-prime" + pd6 "github.com/ipld/go-ipld-prime/codec/dagjson" pd1 "github.com/ipld/go-ipld-prime/datamodel" - pd16 "github.com/ipld/go-ipld-prime/linking/cid" + pd17 "github.com/ipld/go-ipld-prime/linking/cid" ) // -- protocol type DelegatedRouting_IdentifyArg -- @@ -1014,24 +1014,24 @@ func (x AnonInductive5) Prototype() pd1.NodePrototype { return nil } -var logger_client_DelegatedRouting = pd13.Logger("service/client/delegatedrouting") +var logger_client_DelegatedRouting = pd4.Logger("service/client/delegatedrouting") type DelegatedRouting_Client interface { - Identify(ctx pd9.Context, req *DelegatedRouting_IdentifyArg) ([]*DelegatedRouting_IdentifyResult, error) + Identify(ctx pd8.Context, req *DelegatedRouting_IdentifyArg) ([]*DelegatedRouting_IdentifyResult, error) - FindProviders(ctx pd9.Context, req *FindProvidersRequest) ([]*FindProvidersResponse, error) + FindProviders(ctx pd8.Context, req *FindProvidersRequest) ([]*FindProvidersResponse, error) - GetIPNS(ctx pd9.Context, req *GetIPNSRequest) ([]*GetIPNSResponse, error) + GetIPNS(ctx pd8.Context, req *GetIPNSRequest) ([]*GetIPNSResponse, error) - PutIPNS(ctx pd9.Context, req *PutIPNSRequest) ([]*PutIPNSResponse, error) + PutIPNS(ctx pd8.Context, req *PutIPNSRequest) ([]*PutIPNSResponse, error) - Identify_Async(ctx pd9.Context, req *DelegatedRouting_IdentifyArg) (<-chan DelegatedRouting_Identify_AsyncResult, error) + Identify_Async(ctx pd8.Context, req *DelegatedRouting_IdentifyArg) (<-chan DelegatedRouting_Identify_AsyncResult, error) - FindProviders_Async(ctx pd9.Context, req *FindProvidersRequest) (<-chan DelegatedRouting_FindProviders_AsyncResult, error) + FindProviders_Async(ctx pd8.Context, req *FindProvidersRequest) (<-chan DelegatedRouting_FindProviders_AsyncResult, error) - GetIPNS_Async(ctx pd9.Context, req *GetIPNSRequest) (<-chan DelegatedRouting_GetIPNS_AsyncResult, error) + GetIPNS_Async(ctx pd8.Context, req *GetIPNSRequest) (<-chan DelegatedRouting_GetIPNS_AsyncResult, error) - PutIPNS_Async(ctx pd9.Context, req *PutIPNSRequest) (<-chan DelegatedRouting_PutIPNS_AsyncResult, error) + PutIPNS_Async(ctx pd8.Context, req *PutIPNSRequest) (<-chan DelegatedRouting_PutIPNS_AsyncResult, error) } type DelegatedRouting_Identify_AsyncResult struct { @@ -1057,13 +1057,13 @@ type DelegatedRouting_PutIPNS_AsyncResult struct { type DelegatedRouting_ClientOption func(*client_DelegatedRouting) error type client_DelegatedRouting struct { - httpClient *pd4.Client - endpoint *pd5.URL - ulk pd6.Mutex + httpClient *pd5.Client + endpoint *pd12.URL + ulk pd14.Mutex unsupported map[string]bool // cache of methods not supported by server } -func DelegatedRouting_Client_WithHTTPClient(hc *pd4.Client) DelegatedRouting_ClientOption { +func DelegatedRouting_Client_WithHTTPClient(hc *pd5.Client) DelegatedRouting_ClientOption { return func(c *client_DelegatedRouting) error { c.httpClient = hc return nil @@ -1071,11 +1071,11 @@ func DelegatedRouting_Client_WithHTTPClient(hc *pd4.Client) DelegatedRouting_Cli } func New_DelegatedRouting_Client(endpoint string, opts ...DelegatedRouting_ClientOption) (*client_DelegatedRouting, error) { - u, err := pd5.Parse(endpoint) + u, err := pd12.Parse(endpoint) if err != nil { return nil, err } - c := &client_DelegatedRouting{endpoint: u, httpClient: pd4.DefaultClient, unsupported: make(map[string]bool)} + c := &client_DelegatedRouting{endpoint: u, httpClient: pd5.DefaultClient, unsupported: make(map[string]bool)} for _, o := range opts { if err := o(c); err != nil { return nil, err @@ -1084,8 +1084,8 @@ func New_DelegatedRouting_Client(endpoint string, opts ...DelegatedRouting_Clien return c, nil } -func (c *client_DelegatedRouting) Identify(ctx pd9.Context, req *DelegatedRouting_IdentifyArg) ([]*DelegatedRouting_IdentifyResult, error) { - ctx, cancel := pd9.WithCancel(ctx) +func (c *client_DelegatedRouting) Identify(ctx pd8.Context, req *DelegatedRouting_IdentifyArg) ([]*DelegatedRouting_IdentifyResult, error) { + ctx, cancel := pd8.WithCancel(ctx) defer cancel() ch, err := c.Identify_Async(ctx, req) if err != nil { @@ -1113,27 +1113,27 @@ func (c *client_DelegatedRouting) Identify(ctx pd9.Context, req *DelegatedRoutin } } -func (c *client_DelegatedRouting) Identify_Async(ctx pd9.Context, req *DelegatedRouting_IdentifyArg) (<-chan DelegatedRouting_Identify_AsyncResult, error) { +func (c *client_DelegatedRouting) Identify_Async(ctx pd8.Context, req *DelegatedRouting_IdentifyArg) (<-chan DelegatedRouting_Identify_AsyncResult, error) { // check if we have memoized that this method is not supported by the server c.ulk.Lock() notSupported := c.unsupported["Identify"] c.ulk.Unlock() if notSupported { - return nil, pd14.ErrSchema + return nil, pd13.ErrSchema } envelope := &AnonInductive4{ Identify: req, } - buf, err := pd10.Encode(envelope, pd7.Encode) + buf, err := pd9.Encode(envelope, pd6.Encode) if err != nil { return nil, pd3.Errorf("unexpected serialization error (%v)", err) } // encode request in URL u := *c.endpoint - httpReq, err := pd4.NewRequestWithContext(ctx, "POST", u.String(), pd11.NewReader(buf)) + httpReq, err := pd5.NewRequestWithContext(ctx, "POST", u.String(), pd10.NewReader(buf)) if err != nil { return nil, err } @@ -1155,7 +1155,7 @@ func (c *client_DelegatedRouting) Identify_Async(ctx pd9.Context, req *Delegated c.ulk.Lock() c.unsupported["Identify"] = true c.ulk.Unlock() - return nil, pd14.ErrSchema + return nil, pd13.ErrSchema } // HTTP codes other than 200 correspond to service implementation rejecting the call when it is received // for reasons unrelated to protocol schema @@ -1163,7 +1163,7 @@ func (c *client_DelegatedRouting) Identify_Async(ctx pd9.Context, req *Delegated resp.Body.Close() if resp.Header != nil { if errValues, ok := resp.Header["Error"]; ok && len(errValues) == 1 { - err = pd14.ErrService{Cause: pd3.Errorf("%s", errValues[0])} + err = pd13.ErrService{Cause: pd3.Errorf("%s", errValues[0])} } else { err = pd3.Errorf("service rejected the call, no cause provided") } @@ -1178,10 +1178,10 @@ func (c *client_DelegatedRouting) Identify_Async(ctx pd9.Context, req *Delegated return ch, nil } -func process_DelegatedRouting_Identify_AsyncResult(ctx pd9.Context, ch chan<- DelegatedRouting_Identify_AsyncResult, r pd8.ReadCloser) { +func process_DelegatedRouting_Identify_AsyncResult(ctx pd8.Context, ch chan<- DelegatedRouting_Identify_AsyncResult, r pd11.ReadCloser) { defer close(ch) defer r.Close() - opt := pd7.DecodeOptions{ + opt := pd6.DecodeOptions{ ParseLinks: true, ParseBytes: true, DontParseBeyondEnd: true, @@ -1189,23 +1189,23 @@ func process_DelegatedRouting_Identify_AsyncResult(ctx pd9.Context, ch chan<- De for { var out DelegatedRouting_Identify_AsyncResult - n, err := pd10.DecodeStreaming(r, opt.Decode) - if pd12.Is(err, pd8.EOF) || pd12.Is(err, pd8.ErrUnexpectedEOF) { + n, err := pd9.DecodeStreaming(r, opt.Decode) + if pd7.Is(err, pd11.EOF) || pd7.Is(err, pd11.ErrUnexpectedEOF) { return } if err != nil { - out = DelegatedRouting_Identify_AsyncResult{Err: pd14.ErrProto{Cause: err}} // IPLD decode error + out = DelegatedRouting_Identify_AsyncResult{Err: pd13.ErrProto{Cause: err}} // IPLD decode error } else { var x [1]byte if k, err := r.Read(x[:]); k != 1 || x[0] != '\n' { - out = DelegatedRouting_Identify_AsyncResult{Err: pd14.ErrProto{Cause: pd3.Errorf("missing new line after result: err (%v), read (%d), char (%q)", err, k, string(x[:]))}} // Edelweiss decode error + out = DelegatedRouting_Identify_AsyncResult{Err: pd13.ErrProto{Cause: pd3.Errorf("missing new line after result: err (%v), read (%d), char (%q)", err, k, string(x[:]))}} // Edelweiss decode error } else { env := &AnonInductive5{} if err = env.Parse(n); err != nil { - out = DelegatedRouting_Identify_AsyncResult{Err: pd14.ErrProto{Cause: err}} // schema decode error + out = DelegatedRouting_Identify_AsyncResult{Err: pd13.ErrProto{Cause: err}} // schema decode error } else if env.Error != nil { - out = DelegatedRouting_Identify_AsyncResult{Err: pd14.ErrService{Cause: pd12.New(string(env.Error.Code))}} // service-level error + out = DelegatedRouting_Identify_AsyncResult{Err: pd13.ErrService{Cause: pd7.New(string(env.Error.Code))}} // service-level error } else if env.Identify != nil { out = DelegatedRouting_Identify_AsyncResult{Resp: env.Identify} } else { @@ -1222,8 +1222,8 @@ func process_DelegatedRouting_Identify_AsyncResult(ctx pd9.Context, ch chan<- De } } -func (c *client_DelegatedRouting) FindProviders(ctx pd9.Context, req *FindProvidersRequest) ([]*FindProvidersResponse, error) { - ctx, cancel := pd9.WithCancel(ctx) +func (c *client_DelegatedRouting) FindProviders(ctx pd8.Context, req *FindProvidersRequest) ([]*FindProvidersResponse, error) { + ctx, cancel := pd8.WithCancel(ctx) defer cancel() ch, err := c.FindProviders_Async(ctx, req) if err != nil { @@ -1251,27 +1251,27 @@ func (c *client_DelegatedRouting) FindProviders(ctx pd9.Context, req *FindProvid } } -func (c *client_DelegatedRouting) FindProviders_Async(ctx pd9.Context, req *FindProvidersRequest) (<-chan DelegatedRouting_FindProviders_AsyncResult, error) { +func (c *client_DelegatedRouting) FindProviders_Async(ctx pd8.Context, req *FindProvidersRequest) (<-chan DelegatedRouting_FindProviders_AsyncResult, error) { // check if we have memoized that this method is not supported by the server c.ulk.Lock() notSupported := c.unsupported["FindProviders"] c.ulk.Unlock() if notSupported { - return nil, pd14.ErrSchema + return nil, pd13.ErrSchema } envelope := &AnonInductive4{ FindProviders: req, } - buf, err := pd10.Encode(envelope, pd7.Encode) + buf, err := pd9.Encode(envelope, pd6.Encode) if err != nil { return nil, pd3.Errorf("unexpected serialization error (%v)", err) } // encode request in URL u := *c.endpoint - httpReq, err := pd4.NewRequestWithContext(ctx, "POST", u.String(), pd11.NewReader(buf)) + httpReq, err := pd5.NewRequestWithContext(ctx, "POST", u.String(), pd10.NewReader(buf)) if err != nil { return nil, err } @@ -1293,7 +1293,7 @@ func (c *client_DelegatedRouting) FindProviders_Async(ctx pd9.Context, req *Find c.ulk.Lock() c.unsupported["FindProviders"] = true c.ulk.Unlock() - return nil, pd14.ErrSchema + return nil, pd13.ErrSchema } // HTTP codes other than 200 correspond to service implementation rejecting the call when it is received // for reasons unrelated to protocol schema @@ -1301,7 +1301,7 @@ func (c *client_DelegatedRouting) FindProviders_Async(ctx pd9.Context, req *Find resp.Body.Close() if resp.Header != nil { if errValues, ok := resp.Header["Error"]; ok && len(errValues) == 1 { - err = pd14.ErrService{Cause: pd3.Errorf("%s", errValues[0])} + err = pd13.ErrService{Cause: pd3.Errorf("%s", errValues[0])} } else { err = pd3.Errorf("service rejected the call, no cause provided") } @@ -1316,10 +1316,10 @@ func (c *client_DelegatedRouting) FindProviders_Async(ctx pd9.Context, req *Find return ch, nil } -func process_DelegatedRouting_FindProviders_AsyncResult(ctx pd9.Context, ch chan<- DelegatedRouting_FindProviders_AsyncResult, r pd8.ReadCloser) { +func process_DelegatedRouting_FindProviders_AsyncResult(ctx pd8.Context, ch chan<- DelegatedRouting_FindProviders_AsyncResult, r pd11.ReadCloser) { defer close(ch) defer r.Close() - opt := pd7.DecodeOptions{ + opt := pd6.DecodeOptions{ ParseLinks: true, ParseBytes: true, DontParseBeyondEnd: true, @@ -1327,23 +1327,23 @@ func process_DelegatedRouting_FindProviders_AsyncResult(ctx pd9.Context, ch chan for { var out DelegatedRouting_FindProviders_AsyncResult - n, err := pd10.DecodeStreaming(r, opt.Decode) - if pd12.Is(err, pd8.EOF) || pd12.Is(err, pd8.ErrUnexpectedEOF) { + n, err := pd9.DecodeStreaming(r, opt.Decode) + if pd7.Is(err, pd11.EOF) || pd7.Is(err, pd11.ErrUnexpectedEOF) { return } if err != nil { - out = DelegatedRouting_FindProviders_AsyncResult{Err: pd14.ErrProto{Cause: err}} // IPLD decode error + out = DelegatedRouting_FindProviders_AsyncResult{Err: pd13.ErrProto{Cause: err}} // IPLD decode error } else { var x [1]byte if k, err := r.Read(x[:]); k != 1 || x[0] != '\n' { - out = DelegatedRouting_FindProviders_AsyncResult{Err: pd14.ErrProto{Cause: pd3.Errorf("missing new line after result: err (%v), read (%d), char (%q)", err, k, string(x[:]))}} // Edelweiss decode error + out = DelegatedRouting_FindProviders_AsyncResult{Err: pd13.ErrProto{Cause: pd3.Errorf("missing new line after result: err (%v), read (%d), char (%q)", err, k, string(x[:]))}} // Edelweiss decode error } else { env := &AnonInductive5{} if err = env.Parse(n); err != nil { - out = DelegatedRouting_FindProviders_AsyncResult{Err: pd14.ErrProto{Cause: err}} // schema decode error + out = DelegatedRouting_FindProviders_AsyncResult{Err: pd13.ErrProto{Cause: err}} // schema decode error } else if env.Error != nil { - out = DelegatedRouting_FindProviders_AsyncResult{Err: pd14.ErrService{Cause: pd12.New(string(env.Error.Code))}} // service-level error + out = DelegatedRouting_FindProviders_AsyncResult{Err: pd13.ErrService{Cause: pd7.New(string(env.Error.Code))}} // service-level error } else if env.FindProviders != nil { out = DelegatedRouting_FindProviders_AsyncResult{Resp: env.FindProviders} } else { @@ -1360,8 +1360,8 @@ func process_DelegatedRouting_FindProviders_AsyncResult(ctx pd9.Context, ch chan } } -func (c *client_DelegatedRouting) GetIPNS(ctx pd9.Context, req *GetIPNSRequest) ([]*GetIPNSResponse, error) { - ctx, cancel := pd9.WithCancel(ctx) +func (c *client_DelegatedRouting) GetIPNS(ctx pd8.Context, req *GetIPNSRequest) ([]*GetIPNSResponse, error) { + ctx, cancel := pd8.WithCancel(ctx) defer cancel() ch, err := c.GetIPNS_Async(ctx, req) if err != nil { @@ -1389,27 +1389,27 @@ func (c *client_DelegatedRouting) GetIPNS(ctx pd9.Context, req *GetIPNSRequest) } } -func (c *client_DelegatedRouting) GetIPNS_Async(ctx pd9.Context, req *GetIPNSRequest) (<-chan DelegatedRouting_GetIPNS_AsyncResult, error) { +func (c *client_DelegatedRouting) GetIPNS_Async(ctx pd8.Context, req *GetIPNSRequest) (<-chan DelegatedRouting_GetIPNS_AsyncResult, error) { // check if we have memoized that this method is not supported by the server c.ulk.Lock() notSupported := c.unsupported["GetIPNS"] c.ulk.Unlock() if notSupported { - return nil, pd14.ErrSchema + return nil, pd13.ErrSchema } envelope := &AnonInductive4{ GetIPNS: req, } - buf, err := pd10.Encode(envelope, pd7.Encode) + buf, err := pd9.Encode(envelope, pd6.Encode) if err != nil { return nil, pd3.Errorf("unexpected serialization error (%v)", err) } // encode request in URL u := *c.endpoint - httpReq, err := pd4.NewRequestWithContext(ctx, "POST", u.String(), pd11.NewReader(buf)) + httpReq, err := pd5.NewRequestWithContext(ctx, "POST", u.String(), pd10.NewReader(buf)) if err != nil { return nil, err } @@ -1431,7 +1431,7 @@ func (c *client_DelegatedRouting) GetIPNS_Async(ctx pd9.Context, req *GetIPNSReq c.ulk.Lock() c.unsupported["GetIPNS"] = true c.ulk.Unlock() - return nil, pd14.ErrSchema + return nil, pd13.ErrSchema } // HTTP codes other than 200 correspond to service implementation rejecting the call when it is received // for reasons unrelated to protocol schema @@ -1439,7 +1439,7 @@ func (c *client_DelegatedRouting) GetIPNS_Async(ctx pd9.Context, req *GetIPNSReq resp.Body.Close() if resp.Header != nil { if errValues, ok := resp.Header["Error"]; ok && len(errValues) == 1 { - err = pd14.ErrService{Cause: pd3.Errorf("%s", errValues[0])} + err = pd13.ErrService{Cause: pd3.Errorf("%s", errValues[0])} } else { err = pd3.Errorf("service rejected the call, no cause provided") } @@ -1454,10 +1454,10 @@ func (c *client_DelegatedRouting) GetIPNS_Async(ctx pd9.Context, req *GetIPNSReq return ch, nil } -func process_DelegatedRouting_GetIPNS_AsyncResult(ctx pd9.Context, ch chan<- DelegatedRouting_GetIPNS_AsyncResult, r pd8.ReadCloser) { +func process_DelegatedRouting_GetIPNS_AsyncResult(ctx pd8.Context, ch chan<- DelegatedRouting_GetIPNS_AsyncResult, r pd11.ReadCloser) { defer close(ch) defer r.Close() - opt := pd7.DecodeOptions{ + opt := pd6.DecodeOptions{ ParseLinks: true, ParseBytes: true, DontParseBeyondEnd: true, @@ -1465,23 +1465,23 @@ func process_DelegatedRouting_GetIPNS_AsyncResult(ctx pd9.Context, ch chan<- Del for { var out DelegatedRouting_GetIPNS_AsyncResult - n, err := pd10.DecodeStreaming(r, opt.Decode) - if pd12.Is(err, pd8.EOF) || pd12.Is(err, pd8.ErrUnexpectedEOF) { + n, err := pd9.DecodeStreaming(r, opt.Decode) + if pd7.Is(err, pd11.EOF) || pd7.Is(err, pd11.ErrUnexpectedEOF) { return } if err != nil { - out = DelegatedRouting_GetIPNS_AsyncResult{Err: pd14.ErrProto{Cause: err}} // IPLD decode error + out = DelegatedRouting_GetIPNS_AsyncResult{Err: pd13.ErrProto{Cause: err}} // IPLD decode error } else { var x [1]byte if k, err := r.Read(x[:]); k != 1 || x[0] != '\n' { - out = DelegatedRouting_GetIPNS_AsyncResult{Err: pd14.ErrProto{Cause: pd3.Errorf("missing new line after result: err (%v), read (%d), char (%q)", err, k, string(x[:]))}} // Edelweiss decode error + out = DelegatedRouting_GetIPNS_AsyncResult{Err: pd13.ErrProto{Cause: pd3.Errorf("missing new line after result: err (%v), read (%d), char (%q)", err, k, string(x[:]))}} // Edelweiss decode error } else { env := &AnonInductive5{} if err = env.Parse(n); err != nil { - out = DelegatedRouting_GetIPNS_AsyncResult{Err: pd14.ErrProto{Cause: err}} // schema decode error + out = DelegatedRouting_GetIPNS_AsyncResult{Err: pd13.ErrProto{Cause: err}} // schema decode error } else if env.Error != nil { - out = DelegatedRouting_GetIPNS_AsyncResult{Err: pd14.ErrService{Cause: pd12.New(string(env.Error.Code))}} // service-level error + out = DelegatedRouting_GetIPNS_AsyncResult{Err: pd13.ErrService{Cause: pd7.New(string(env.Error.Code))}} // service-level error } else if env.GetIPNS != nil { out = DelegatedRouting_GetIPNS_AsyncResult{Resp: env.GetIPNS} } else { @@ -1498,8 +1498,8 @@ func process_DelegatedRouting_GetIPNS_AsyncResult(ctx pd9.Context, ch chan<- Del } } -func (c *client_DelegatedRouting) PutIPNS(ctx pd9.Context, req *PutIPNSRequest) ([]*PutIPNSResponse, error) { - ctx, cancel := pd9.WithCancel(ctx) +func (c *client_DelegatedRouting) PutIPNS(ctx pd8.Context, req *PutIPNSRequest) ([]*PutIPNSResponse, error) { + ctx, cancel := pd8.WithCancel(ctx) defer cancel() ch, err := c.PutIPNS_Async(ctx, req) if err != nil { @@ -1527,27 +1527,27 @@ func (c *client_DelegatedRouting) PutIPNS(ctx pd9.Context, req *PutIPNSRequest) } } -func (c *client_DelegatedRouting) PutIPNS_Async(ctx pd9.Context, req *PutIPNSRequest) (<-chan DelegatedRouting_PutIPNS_AsyncResult, error) { +func (c *client_DelegatedRouting) PutIPNS_Async(ctx pd8.Context, req *PutIPNSRequest) (<-chan DelegatedRouting_PutIPNS_AsyncResult, error) { // check if we have memoized that this method is not supported by the server c.ulk.Lock() notSupported := c.unsupported["PutIPNS"] c.ulk.Unlock() if notSupported { - return nil, pd14.ErrSchema + return nil, pd13.ErrSchema } envelope := &AnonInductive4{ PutIPNS: req, } - buf, err := pd10.Encode(envelope, pd7.Encode) + buf, err := pd9.Encode(envelope, pd6.Encode) if err != nil { return nil, pd3.Errorf("unexpected serialization error (%v)", err) } // encode request in URL u := *c.endpoint - httpReq, err := pd4.NewRequestWithContext(ctx, "POST", u.String(), pd11.NewReader(buf)) + httpReq, err := pd5.NewRequestWithContext(ctx, "POST", u.String(), pd10.NewReader(buf)) if err != nil { return nil, err } @@ -1569,7 +1569,7 @@ func (c *client_DelegatedRouting) PutIPNS_Async(ctx pd9.Context, req *PutIPNSReq c.ulk.Lock() c.unsupported["PutIPNS"] = true c.ulk.Unlock() - return nil, pd14.ErrSchema + return nil, pd13.ErrSchema } // HTTP codes other than 200 correspond to service implementation rejecting the call when it is received // for reasons unrelated to protocol schema @@ -1577,7 +1577,7 @@ func (c *client_DelegatedRouting) PutIPNS_Async(ctx pd9.Context, req *PutIPNSReq resp.Body.Close() if resp.Header != nil { if errValues, ok := resp.Header["Error"]; ok && len(errValues) == 1 { - err = pd14.ErrService{Cause: pd3.Errorf("%s", errValues[0])} + err = pd13.ErrService{Cause: pd3.Errorf("%s", errValues[0])} } else { err = pd3.Errorf("service rejected the call, no cause provided") } @@ -1592,10 +1592,10 @@ func (c *client_DelegatedRouting) PutIPNS_Async(ctx pd9.Context, req *PutIPNSReq return ch, nil } -func process_DelegatedRouting_PutIPNS_AsyncResult(ctx pd9.Context, ch chan<- DelegatedRouting_PutIPNS_AsyncResult, r pd8.ReadCloser) { +func process_DelegatedRouting_PutIPNS_AsyncResult(ctx pd8.Context, ch chan<- DelegatedRouting_PutIPNS_AsyncResult, r pd11.ReadCloser) { defer close(ch) defer r.Close() - opt := pd7.DecodeOptions{ + opt := pd6.DecodeOptions{ ParseLinks: true, ParseBytes: true, DontParseBeyondEnd: true, @@ -1603,23 +1603,23 @@ func process_DelegatedRouting_PutIPNS_AsyncResult(ctx pd9.Context, ch chan<- Del for { var out DelegatedRouting_PutIPNS_AsyncResult - n, err := pd10.DecodeStreaming(r, opt.Decode) - if pd12.Is(err, pd8.EOF) || pd12.Is(err, pd8.ErrUnexpectedEOF) { + n, err := pd9.DecodeStreaming(r, opt.Decode) + if pd7.Is(err, pd11.EOF) || pd7.Is(err, pd11.ErrUnexpectedEOF) { return } if err != nil { - out = DelegatedRouting_PutIPNS_AsyncResult{Err: pd14.ErrProto{Cause: err}} // IPLD decode error + out = DelegatedRouting_PutIPNS_AsyncResult{Err: pd13.ErrProto{Cause: err}} // IPLD decode error } else { var x [1]byte if k, err := r.Read(x[:]); k != 1 || x[0] != '\n' { - out = DelegatedRouting_PutIPNS_AsyncResult{Err: pd14.ErrProto{Cause: pd3.Errorf("missing new line after result: err (%v), read (%d), char (%q)", err, k, string(x[:]))}} // Edelweiss decode error + out = DelegatedRouting_PutIPNS_AsyncResult{Err: pd13.ErrProto{Cause: pd3.Errorf("missing new line after result: err (%v), read (%d), char (%q)", err, k, string(x[:]))}} // Edelweiss decode error } else { env := &AnonInductive5{} if err = env.Parse(n); err != nil { - out = DelegatedRouting_PutIPNS_AsyncResult{Err: pd14.ErrProto{Cause: err}} // schema decode error + out = DelegatedRouting_PutIPNS_AsyncResult{Err: pd13.ErrProto{Cause: err}} // schema decode error } else if env.Error != nil { - out = DelegatedRouting_PutIPNS_AsyncResult{Err: pd14.ErrService{Cause: pd12.New(string(env.Error.Code))}} // service-level error + out = DelegatedRouting_PutIPNS_AsyncResult{Err: pd13.ErrService{Cause: pd7.New(string(env.Error.Code))}} // service-level error } else if env.PutIPNS != nil { out = DelegatedRouting_PutIPNS_AsyncResult{Resp: env.PutIPNS} } else { @@ -1636,16 +1636,16 @@ func process_DelegatedRouting_PutIPNS_AsyncResult(ctx pd9.Context, ch chan<- Del } } -var logger_server_DelegatedRouting = pd13.Logger("service/server/delegatedrouting") +var logger_server_DelegatedRouting = pd4.Logger("service/server/delegatedrouting") type DelegatedRouting_Server interface { - FindProviders(ctx pd9.Context, req *FindProvidersRequest) (<-chan *DelegatedRouting_FindProviders_AsyncResult, error) - GetIPNS(ctx pd9.Context, req *GetIPNSRequest) (<-chan *DelegatedRouting_GetIPNS_AsyncResult, error) - PutIPNS(ctx pd9.Context, req *PutIPNSRequest) (<-chan *DelegatedRouting_PutIPNS_AsyncResult, error) + FindProviders(ctx pd8.Context, req *FindProvidersRequest) (<-chan *DelegatedRouting_FindProviders_AsyncResult, error) + GetIPNS(ctx pd8.Context, req *GetIPNSRequest) (<-chan *DelegatedRouting_GetIPNS_AsyncResult, error) + PutIPNS(ctx pd8.Context, req *PutIPNSRequest) (<-chan *DelegatedRouting_PutIPNS_AsyncResult, error) } -func DelegatedRouting_AsyncHandler(s DelegatedRouting_Server) pd4.HandlerFunc { - return func(writer pd4.ResponseWriter, request *pd4.Request) { +func DelegatedRouting_AsyncHandler(s DelegatedRouting_Server) pd5.HandlerFunc { + return func(writer pd5.ResponseWriter, request *pd5.Request) { // parse request msg, err := pd15.ReadAll(request.Body) if err != nil { @@ -1653,7 +1653,7 @@ func DelegatedRouting_AsyncHandler(s DelegatedRouting_Server) pd4.HandlerFunc { writer.WriteHeader(400) return } - n, err := pd10.Decode(msg, pd7.Decode) + n, err := pd9.Decode(msg, pd6.Decode) if err != nil { logger_server_DelegatedRouting.Errorf("received request not decodeable (%v)", err) writer.WriteHeader(400) @@ -1674,7 +1674,7 @@ func DelegatedRouting_AsyncHandler(s DelegatedRouting_Server) pd4.HandlerFunc { switch { case env.FindProviders != nil: - ch, err := s.FindProviders(pd9.Background(), env.FindProviders) + ch, err := s.FindProviders(pd8.Background(), env.FindProviders) if err != nil { logger_server_DelegatedRouting.Errorf("service rejected request (%v)", err) writer.Header()["Error"] = []string{err.Error()} @@ -1688,20 +1688,20 @@ func DelegatedRouting_AsyncHandler(s DelegatedRouting_Server) pd4.HandlerFunc { } else { env = &AnonInductive5{FindProviders: resp.Resp} } - var buf pd11.Buffer - if err = pd10.EncodeStreaming(&buf, env, pd7.Encode); err != nil { + var buf pd10.Buffer + if err = pd9.EncodeStreaming(&buf, env, pd6.Encode); err != nil { logger_server_DelegatedRouting.Errorf("cannot encode response (%v)", err) continue } buf.WriteByte("\n"[0]) writer.Write(buf.Bytes()) - if f, ok := writer.(pd4.Flusher); ok { + if f, ok := writer.(pd5.Flusher); ok { f.Flush() } } case env.GetIPNS != nil: - ch, err := s.GetIPNS(pd9.Background(), env.GetIPNS) + ch, err := s.GetIPNS(pd8.Background(), env.GetIPNS) if err != nil { logger_server_DelegatedRouting.Errorf("service rejected request (%v)", err) writer.Header()["Error"] = []string{err.Error()} @@ -1715,20 +1715,20 @@ func DelegatedRouting_AsyncHandler(s DelegatedRouting_Server) pd4.HandlerFunc { } else { env = &AnonInductive5{GetIPNS: resp.Resp} } - var buf pd11.Buffer - if err = pd10.EncodeStreaming(&buf, env, pd7.Encode); err != nil { + var buf pd10.Buffer + if err = pd9.EncodeStreaming(&buf, env, pd6.Encode); err != nil { logger_server_DelegatedRouting.Errorf("cannot encode response (%v)", err) continue } buf.WriteByte("\n"[0]) writer.Write(buf.Bytes()) - if f, ok := writer.(pd4.Flusher); ok { + if f, ok := writer.(pd5.Flusher); ok { f.Flush() } } case env.PutIPNS != nil: - ch, err := s.PutIPNS(pd9.Background(), env.PutIPNS) + ch, err := s.PutIPNS(pd8.Background(), env.PutIPNS) if err != nil { logger_server_DelegatedRouting.Errorf("service rejected request (%v)", err) writer.Header()["Error"] = []string{err.Error()} @@ -1742,14 +1742,14 @@ func DelegatedRouting_AsyncHandler(s DelegatedRouting_Server) pd4.HandlerFunc { } else { env = &AnonInductive5{PutIPNS: resp.Resp} } - var buf pd11.Buffer - if err = pd10.EncodeStreaming(&buf, env, pd7.Encode); err != nil { + var buf pd10.Buffer + if err = pd9.EncodeStreaming(&buf, env, pd6.Encode); err != nil { logger_server_DelegatedRouting.Errorf("cannot encode response (%v)", err) continue } buf.WriteByte("\n"[0]) writer.Write(buf.Bytes()) - if f, ok := writer.(pd4.Flusher); ok { + if f, ok := writer.(pd5.Flusher); ok { f.Flush() } } @@ -1765,8 +1765,8 @@ func DelegatedRouting_AsyncHandler(s DelegatedRouting_Server) pd4.HandlerFunc { }, }, } - var buf pd11.Buffer - if err = pd10.EncodeStreaming(&buf, env, pd7.Encode); err != nil { + var buf pd10.Buffer + if err = pd9.EncodeStreaming(&buf, env, pd6.Encode); err != nil { logger_server_DelegatedRouting.Errorf("cannot encode identify response (%v)", err) writer.WriteHeader(500) return @@ -2890,7 +2890,7 @@ func (x PutIPNSResponse) Prototype() pd1.NodePrototype { // -- protocol type LinkToAny -- -type LinkToAny pd17.Cid +type LinkToAny pd16.Cid func (v *LinkToAny) Parse(n pd1.Node) error { if n.Kind() != pd1.Kind_Link { @@ -2898,7 +2898,7 @@ func (v *LinkToAny) Parse(n pd1.Node) error { } else { ipldLink, _ := n.AsLink() // TODO: Is there a more general way to convert ipld.Link interface into a concrete user object? - cidLink, ok := ipldLink.(pd16.Link) + cidLink, ok := ipldLink.(pd17.Link) if !ok { return pd3.Errorf("only cid links are supported") } else { @@ -2973,7 +2973,7 @@ func (LinkToAny) AsBytes() ([]byte, error) { } func (v LinkToAny) AsLink() (pd1.Link, error) { - return pd16.Link{Cid: pd17.Cid(v)}, nil + return pd17.Link{Cid: pd16.Cid(v)}, nil } func (LinkToAny) Prototype() pd1.NodePrototype { diff --git a/go.mod b/go.mod index 60bb771..cf30bf0 100644 --- a/go.mod +++ b/go.mod @@ -6,8 +6,8 @@ require ( github.com/ipfs/go-cid v0.2.0 github.com/ipfs/go-ipns v0.1.2 github.com/ipfs/go-log v1.0.5 - github.com/ipld/edelweiss v0.1.3-0.20220613204122-55af0600c7ba - github.com/ipld/go-ipld-prime v0.16.1-0.20220607160121-f0c1fdf6c6ad + github.com/ipld/edelweiss v0.1.3 + github.com/ipld/go-ipld-prime v0.17.0 github.com/libp2p/go-libp2p-core v0.16.1 github.com/libp2p/go-libp2p-record v0.1.3 github.com/multiformats/go-multiaddr v0.5.0 @@ -31,7 +31,7 @@ require ( github.com/multiformats/go-base32 v0.0.3 // indirect github.com/multiformats/go-base36 v0.1.0 // indirect github.com/multiformats/go-multibase v0.0.3 // indirect - github.com/multiformats/go-multicodec v0.4.1 // indirect + github.com/multiformats/go-multicodec v0.5.0 // indirect github.com/multiformats/go-varint v0.0.6 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/pkg/errors v0.8.1 // indirect diff --git a/go.sum b/go.sum index 099e151..d7ca56c 100644 --- a/go.sum +++ b/go.sum @@ -96,11 +96,11 @@ github.com/ipfs/go-log v1.0.5/go.mod h1:j0b8ZoR+7+R99LD9jZ6+AJsrzkPbSXbZfGakb5JP github.com/ipfs/go-log/v2 v2.0.5/go.mod h1:eZs4Xt4ZUJQFM3DlanGhy7TkwwawCZcSByscwkWG+dw= github.com/ipfs/go-log/v2 v2.1.3 h1:1iS3IU7aXRlbgUpN8yTTpJ53NXYjAe37vcI5+5nYrzk= github.com/ipfs/go-log/v2 v2.1.3/go.mod h1:/8d0SH3Su5Ooc31QlL1WysJhvyOTDCjcCZ9Axpmri6g= -github.com/ipld/edelweiss v0.1.3-0.20220613204122-55af0600c7ba h1:n1g05KbY72/3VBrlumhBUsz93XQwyEOnWP1d0+v2Fhs= -github.com/ipld/edelweiss v0.1.3-0.20220613204122-55af0600c7ba/go.mod h1:egFT0Za/aOmwj2YeUlJwoi/C4ULZoBiFhXouVIGuoqM= +github.com/ipld/edelweiss v0.1.3 h1:zYCt68xkE0vTupkFBgGu1x/B2w+Hl1SgwR1MsvsjBrU= +github.com/ipld/edelweiss v0.1.3/go.mod h1:JX1MR06BPcTOF+5xCYDLnylYkXS15iUN0/RXVSiUIQs= github.com/ipld/go-ipld-prime v0.9.0/go.mod h1:KvBLMr4PX1gWptgkzRjVZCrLmSGcZCb/jioOQwCqZN8= -github.com/ipld/go-ipld-prime v0.16.1-0.20220607160121-f0c1fdf6c6ad h1:Ucb+0lclJXzmCFX8Fqawl9AqNlcHWhktuPxOi4zL1ic= -github.com/ipld/go-ipld-prime v0.16.1-0.20220607160121-f0c1fdf6c6ad/go.mod h1:IInaTjkNLKAZoliYXvjlB3CFQa7IPReVwxOb0oke/RA= +github.com/ipld/go-ipld-prime v0.17.0 h1:+U2peiA3aQsE7mrXjD2nYZaZrCcakoz2Wge8K42Ld8g= +github.com/ipld/go-ipld-prime v0.17.0/go.mod h1:aYcKm5TIvGfY8P3QBKz/2gKcLxzJ1zDaD+o0bOowhgs= github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= github.com/jbenet/goprocess v0.1.3/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= @@ -189,8 +189,9 @@ github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/g github.com/multiformats/go-multibase v0.0.3 h1:l/B6bJDQjvQ5G52jw4QGSYeOTZoAwIO77RblWplfIqk= github.com/multiformats/go-multibase v0.0.3/go.mod h1:5+1R4eQrT3PkYZ24C3W2Ue2tPwIdYQD509ZjSb5y9Oc= github.com/multiformats/go-multicodec v0.2.0/go.mod h1:/y4YVwkfMyry5kFbMTbLJKErhycTIftytRV+llXdyS4= -github.com/multiformats/go-multicodec v0.4.1 h1:BSJbf+zpghcZMZrwTYBGwy0CPcVZGWiC72Cp8bBd4R4= github.com/multiformats/go-multicodec v0.4.1/go.mod h1:1Hj/eHRaVWSXiSNNfcEPcwZleTmdNP81xlxDLnWU9GQ= +github.com/multiformats/go-multicodec v0.5.0 h1:EgU6cBe/D7WRwQb1KmnBvU7lrcFGMggZVTPtOW9dDHs= +github.com/multiformats/go-multicodec v0.5.0/go.mod h1:DiY2HFaEp5EhEXb/iYzVAunmyX/aSFMxq2KMKfWEues= github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= 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=