From 9a9ac52b31b0722a30514c408b9640e45efb9919 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Fri, 25 Aug 2023 13:33:04 +0200 Subject: [PATCH] refactor: rename Find/ProvideIPNS to Get/PutIPNS --- core/corehttp/gateway.go | 4 ++-- core/corehttp/routing.go | 4 ++-- docs/examples/kubo-as-a-library/go.mod | 2 +- docs/examples/kubo-as-a-library/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- test/cli/content_routing_http_test.go | 4 ++-- test/cli/delegated_routing_v1_http_server_test.go | 8 ++++---- test/dependencies/go.mod | 2 +- test/dependencies/go.sum | 4 ++-- 10 files changed, 19 insertions(+), 19 deletions(-) diff --git a/core/corehttp/gateway.go b/core/corehttp/gateway.go index a02d7846da9c..6af18ece7ce8 100644 --- a/core/corehttp/gateway.go +++ b/core/corehttp/gateway.go @@ -164,8 +164,8 @@ func (o *offlineGatewayErrWrapper) IsCached(ctx context.Context, path path.Path) return o.gwimpl.IsCached(ctx, path) } -func (o *offlineGatewayErrWrapper) FindIPNS(ctx context.Context, c cid.Cid) ([]byte, error) { - rec, err := o.gwimpl.FindIPNS(ctx, c) +func (o *offlineGatewayErrWrapper) GetIPNS(ctx context.Context, c cid.Cid) ([]byte, error) { + rec, err := o.gwimpl.GetIPNS(ctx, c) err = offlineErrWrap(err) return rec, err } diff --git a/core/corehttp/routing.go b/core/corehttp/routing.go index e5b1edeb0e7a..885352db8d7d 100644 --- a/core/corehttp/routing.go +++ b/core/corehttp/routing.go @@ -63,7 +63,7 @@ func (r *contentRouter) FindPeers(ctx context.Context, pid peer.ID, limit int) ( return iter.ToResultIter[types.Record](iter.FromSlice[types.Record]([]types.Record{rec})), nil } -func (r *contentRouter) FindIPNS(ctx context.Context, name ipns.Name) (*ipns.Record, error) { +func (r *contentRouter) GetIPNS(ctx context.Context, name ipns.Name) (*ipns.Record, error) { ctx, cancel := context.WithCancel(ctx) defer cancel() @@ -75,7 +75,7 @@ func (r *contentRouter) FindIPNS(ctx context.Context, name ipns.Name) (*ipns.Rec return ipns.UnmarshalRecord(raw) } -func (r *contentRouter) ProvideIPNS(ctx context.Context, name ipns.Name, record *ipns.Record) error { +func (r *contentRouter) PutIPNS(ctx context.Context, name ipns.Name, record *ipns.Record) error { ctx, cancel := context.WithCancel(ctx) defer cancel() diff --git a/docs/examples/kubo-as-a-library/go.mod b/docs/examples/kubo-as-a-library/go.mod index 9c4fa7512bf6..a666bcb16199 100644 --- a/docs/examples/kubo-as-a-library/go.mod +++ b/docs/examples/kubo-as-a-library/go.mod @@ -7,7 +7,7 @@ go 1.20 replace github.com/ipfs/kubo => ./../../.. require ( - github.com/ipfs/boxo v0.12.1-0.20230825084715-e1cce6e07aff + github.com/ipfs/boxo v0.12.1-0.20230825113055-ff60307d90ca github.com/ipfs/kubo v0.0.0-00010101000000-000000000000 github.com/libp2p/go-libp2p v0.30.0 github.com/multiformats/go-multiaddr v0.11.0 diff --git a/docs/examples/kubo-as-a-library/go.sum b/docs/examples/kubo-as-a-library/go.sum index 79a83b6177b3..74df94093885 100644 --- a/docs/examples/kubo-as-a-library/go.sum +++ b/docs/examples/kubo-as-a-library/go.sum @@ -300,8 +300,8 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1: github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/ipfs/bbloom v0.0.4 h1:Gi+8EGJ2y5qiD5FbsbpX/TMNcJw8gSqr7eyjHa4Fhvs= github.com/ipfs/bbloom v0.0.4/go.mod h1:cS9YprKXpoZ9lT0n/Mw/a6/aFV6DTjTLYHeA+gyqMG0= -github.com/ipfs/boxo v0.12.1-0.20230825084715-e1cce6e07aff h1:IpyDgsSCTbMcEqKVsbE8S73lV2e9V2J/Tr82zpYb/mg= -github.com/ipfs/boxo v0.12.1-0.20230825084715-e1cce6e07aff/go.mod h1:btrtHy0lmO1ODMECbbEY1pxNtrLilvKSYLoGQt1yYCk= +github.com/ipfs/boxo v0.12.1-0.20230825113055-ff60307d90ca h1:hdD9urdszUptnqofUVCbPHf++cIQc4vQHCbxNitWkIA= +github.com/ipfs/boxo v0.12.1-0.20230825113055-ff60307d90ca/go.mod h1:btrtHy0lmO1ODMECbbEY1pxNtrLilvKSYLoGQt1yYCk= github.com/ipfs/go-bitfield v1.1.0 h1:fh7FIo8bSwaJEh6DdTWbCeZ1eqOaOkKFI74SCnsWbGA= github.com/ipfs/go-bitfield v1.1.0/go.mod h1:paqf1wjq/D2BBmzfTVFlJQ9IlFOZpg422HL0HqsGWHU= github.com/ipfs/go-block-format v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY= diff --git a/go.mod b/go.mod index 3614721f425b..0804aec764dd 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/fsnotify/fsnotify v1.6.0 github.com/google/uuid v1.3.0 github.com/hashicorp/go-multierror v1.1.1 - github.com/ipfs/boxo v0.12.1-0.20230825084715-e1cce6e07aff + github.com/ipfs/boxo v0.12.1-0.20230825113055-ff60307d90ca github.com/ipfs/go-block-format v0.1.2 github.com/ipfs/go-cid v0.4.1 github.com/ipfs/go-cidutil v0.1.0 diff --git a/go.sum b/go.sum index 1563457d2eb2..03b802f7ab03 100644 --- a/go.sum +++ b/go.sum @@ -335,8 +335,8 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1: github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/ipfs/bbloom v0.0.4 h1:Gi+8EGJ2y5qiD5FbsbpX/TMNcJw8gSqr7eyjHa4Fhvs= github.com/ipfs/bbloom v0.0.4/go.mod h1:cS9YprKXpoZ9lT0n/Mw/a6/aFV6DTjTLYHeA+gyqMG0= -github.com/ipfs/boxo v0.12.1-0.20230825084715-e1cce6e07aff h1:IpyDgsSCTbMcEqKVsbE8S73lV2e9V2J/Tr82zpYb/mg= -github.com/ipfs/boxo v0.12.1-0.20230825084715-e1cce6e07aff/go.mod h1:btrtHy0lmO1ODMECbbEY1pxNtrLilvKSYLoGQt1yYCk= +github.com/ipfs/boxo v0.12.1-0.20230825113055-ff60307d90ca h1:hdD9urdszUptnqofUVCbPHf++cIQc4vQHCbxNitWkIA= +github.com/ipfs/boxo v0.12.1-0.20230825113055-ff60307d90ca/go.mod h1:btrtHy0lmO1ODMECbbEY1pxNtrLilvKSYLoGQt1yYCk= github.com/ipfs/go-bitfield v1.1.0 h1:fh7FIo8bSwaJEh6DdTWbCeZ1eqOaOkKFI74SCnsWbGA= github.com/ipfs/go-bitfield v1.1.0/go.mod h1:paqf1wjq/D2BBmzfTVFlJQ9IlFOZpg422HL0HqsGWHU= github.com/ipfs/go-bitswap v0.11.0 h1:j1WVvhDX1yhG32NTC9xfxnqycqYIlhzEzLXG/cU1HyQ= diff --git a/test/cli/content_routing_http_test.go b/test/cli/content_routing_http_test.go index e89df43c935c..652c8ac59eb0 100644 --- a/test/cli/content_routing_http_test.go +++ b/test/cli/content_routing_http_test.go @@ -50,11 +50,11 @@ func (r *fakeHTTPContentRouter) FindPeers(ctx context.Context, pid peer.ID, limi return iter.FromSlice([]iter.Result[types.Record]{}), nil } -func (r *fakeHTTPContentRouter) FindIPNS(ctx context.Context, name ipns.Name) (*ipns.Record, error) { +func (r *fakeHTTPContentRouter) GetIPNS(ctx context.Context, name ipns.Name) (*ipns.Record, error) { return nil, routing.ErrNotSupported } -func (r *fakeHTTPContentRouter) ProvideIPNS(ctx context.Context, name ipns.Name, rec *ipns.Record) error { +func (r *fakeHTTPContentRouter) PutIPNS(ctx context.Context, name ipns.Name, rec *ipns.Record) error { return routing.ErrNotSupported } diff --git a/test/cli/delegated_routing_v1_http_server_test.go b/test/cli/delegated_routing_v1_http_server_test.go index 98d64829860f..58035da59c2c 100644 --- a/test/cli/delegated_routing_v1_http_server_test.go +++ b/test/cli/delegated_routing_v1_http_server_test.go @@ -91,7 +91,7 @@ func TestRoutingV1Server(t *testing.T) { c, err := client.New(nodes[1].GatewayURL()) assert.NoError(t, err) - record, err := c.FindIPNS(context.Background(), ipns.NameFromPeer(nodes[0].PeerID())) + record, err := c.GetIPNS(context.Background(), ipns.NameFromPeer(nodes[0].PeerID())) assert.NoError(t, err) value, err := record.Value() @@ -108,7 +108,7 @@ func TestRoutingV1Server(t *testing.T) { nodes[0].IPFS("name", "publish", "--allow-offline", cidStr) c, err := client.New(nodes[0].GatewayURL()) assert.NoError(t, err) - record, err := c.FindIPNS(context.Background(), ipns.NameFromPeer(nodes[0].PeerID())) + record, err := c.GetIPNS(context.Background(), ipns.NameFromPeer(nodes[0].PeerID())) assert.NoError(t, err) value, err := record.Value() assert.NoError(t, err) @@ -125,11 +125,11 @@ func TestRoutingV1Server(t *testing.T) { // Put IPNS record in lonely node. It should be accepted as it is a valid record. c, err = client.New(node.GatewayURL()) assert.NoError(t, err) - err = c.ProvideIPNS(context.Background(), ipns.NameFromPeer(nodes[0].PeerID()), record) + err = c.PutIPNS(context.Background(), ipns.NameFromPeer(nodes[0].PeerID()), record) assert.NoError(t, err) // Get the record from lonely node and double check. - record, err = c.FindIPNS(context.Background(), ipns.NameFromPeer(nodes[0].PeerID())) + record, err = c.GetIPNS(context.Background(), ipns.NameFromPeer(nodes[0].PeerID())) assert.NoError(t, err) value, err = record.Value() assert.NoError(t, err) diff --git a/test/dependencies/go.mod b/test/dependencies/go.mod index 48be332f8749..1c6cb3588a19 100644 --- a/test/dependencies/go.mod +++ b/test/dependencies/go.mod @@ -7,7 +7,7 @@ replace github.com/ipfs/kubo => ../../ require ( github.com/Kubuxu/gocovmerge v0.0.0-20161216165753-7ecaa51963cd github.com/golangci/golangci-lint v1.54.1 - github.com/ipfs/boxo v0.12.1-0.20230825084715-e1cce6e07aff + github.com/ipfs/boxo v0.12.1-0.20230825113055-ff60307d90ca github.com/ipfs/go-cid v0.4.1 github.com/ipfs/go-cidutil v0.1.0 github.com/ipfs/go-datastore v0.6.0 diff --git a/test/dependencies/go.sum b/test/dependencies/go.sum index c0f31d3d65ec..8abf29f4f1f6 100644 --- a/test/dependencies/go.sum +++ b/test/dependencies/go.sum @@ -396,8 +396,8 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2 github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/ipfs/bbloom v0.0.4 h1:Gi+8EGJ2y5qiD5FbsbpX/TMNcJw8gSqr7eyjHa4Fhvs= github.com/ipfs/bbloom v0.0.4/go.mod h1:cS9YprKXpoZ9lT0n/Mw/a6/aFV6DTjTLYHeA+gyqMG0= -github.com/ipfs/boxo v0.12.1-0.20230825084715-e1cce6e07aff h1:IpyDgsSCTbMcEqKVsbE8S73lV2e9V2J/Tr82zpYb/mg= -github.com/ipfs/boxo v0.12.1-0.20230825084715-e1cce6e07aff/go.mod h1:btrtHy0lmO1ODMECbbEY1pxNtrLilvKSYLoGQt1yYCk= +github.com/ipfs/boxo v0.12.1-0.20230825113055-ff60307d90ca h1:hdD9urdszUptnqofUVCbPHf++cIQc4vQHCbxNitWkIA= +github.com/ipfs/boxo v0.12.1-0.20230825113055-ff60307d90ca/go.mod h1:btrtHy0lmO1ODMECbbEY1pxNtrLilvKSYLoGQt1yYCk= github.com/ipfs/go-bitfield v1.1.0 h1:fh7FIo8bSwaJEh6DdTWbCeZ1eqOaOkKFI74SCnsWbGA= github.com/ipfs/go-bitfield v1.1.0/go.mod h1:paqf1wjq/D2BBmzfTVFlJQ9IlFOZpg422HL0HqsGWHU= github.com/ipfs/go-block-format v0.1.2 h1:GAjkfhVx1f4YTODS6Esrj1wt2HhrtwTnhEr+DyPUaJo=