Skip to content

Commit

Permalink
refactor: rename Find/ProvideIPNS to Get/PutIPNS
Browse files Browse the repository at this point in the history
  • Loading branch information
hacdias committed Aug 25, 2023
1 parent 2a0d04e commit 9a9ac52
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions core/corehttp/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions core/corehttp/routing.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/kubo-as-a-library/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/kubo-as-a-library/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
4 changes: 2 additions & 2 deletions test/cli/content_routing_http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
8 changes: 4 additions & 4 deletions test/cli/delegated_routing_v1_http_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion test/dependencies/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/dependencies/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down

0 comments on commit 9a9ac52

Please sign in to comment.