diff --git a/core/coreapi/routing.go b/core/coreapi/routing.go index 518249fad2b0..fe273158e1eb 100644 --- a/core/coreapi/routing.go +++ b/core/coreapi/routing.go @@ -24,8 +24,8 @@ import ( type RoutingAPI CoreAPI -func (r *RoutingAPI) Get(ctx context.Context, key string) ([]byte, error) { - if !r.nd.IsOnline { +func (api *RoutingAPI) Get(ctx context.Context, key string) ([]byte, error) { + if !api.nd.IsOnline { return nil, coreiface.ErrOffline } @@ -34,16 +34,16 @@ func (r *RoutingAPI) Get(ctx context.Context, key string) ([]byte, error) { return nil, err } - return r.routing.GetValue(ctx, dhtKey) + return api.routing.GetValue(ctx, dhtKey) } -func (r *RoutingAPI) Put(ctx context.Context, key string, value []byte, opts ...caopts.RoutingPutOption) error { +func (api *RoutingAPI) Put(ctx context.Context, key string, value []byte, opts ...caopts.RoutingPutOption) error { options, err := caopts.RoutingPutOptions(opts...) if err != nil { return err } - err = r.checkOnline(options.AllowOffline) + err = api.checkOnline(options.AllowOffline) if err != nil { return err } @@ -53,7 +53,7 @@ func (r *RoutingAPI) Put(ctx context.Context, key string, value []byte, opts ... return err } - return r.routing.PutValue(ctx, dhtKey, value) + return api.routing.PutValue(ctx, dhtKey, value) } func normalizeKey(s string) (string, error) {