Skip to content

Commit

Permalink
go/registry/api: Remove GetNodeList method
Browse files Browse the repository at this point in the history
  • Loading branch information
ptrus committed Jul 1, 2020
1 parent d3fba70 commit 1aabc70
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 44 deletions.
4 changes: 4 additions & 0 deletions .changelog/3067.breaking.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
go/registry/api: Remove `GetNodeList` method

The `GetNodeList` method was unused and is therefore removed. Any code using
this method can be migrated to use `GetNodes` instead.
4 changes: 0 additions & 4 deletions go/consensus/tendermint/registry/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,6 @@ func (tb *tendermintBackend) WatchRuntimes(ctx context.Context) (<-chan *api.Run
return typedCh, sub, nil
}

func (tb *tendermintBackend) GetNodeList(ctx context.Context, height int64) (*api.NodeList, error) {
return tb.getNodeList(ctx, height)
}

func (tb *tendermintBackend) Cleanup() {
}

Expand Down
3 changes: 0 additions & 3 deletions go/registry/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,6 @@ type Backend interface {
// block height.
GetRuntimes(context.Context, int64) ([]*Runtime, error)

// GetNodeList returns the NodeList at the specified block height.
GetNodeList(context.Context, int64) (*NodeList, error)

// WatchRuntimes returns a stream of Runtime. Upon subscription,
// all runtimes will be sent immediately.
WatchRuntimes(context.Context) (<-chan *Runtime, pubsub.ClosableSubscription, error)
Expand Down
37 changes: 0 additions & 37 deletions go/registry/api/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ var (
methodGetRuntime = serviceName.NewMethod("GetRuntime", NamespaceQuery{})
// methodGetRuntimes is the GetRuntimes method.
methodGetRuntimes = serviceName.NewMethod("GetRuntimes", int64(0))
// methodGetNodeList is the GetNodeList method.
methodGetNodeList = serviceName.NewMethod("GetNodeList", int64(0))
// methodStateToGenesis is the StateToGenesis method.
methodStateToGenesis = serviceName.NewMethod("StateToGenesis", int64(0))
// methodGetEvents is the GetEvents method.
Expand Down Expand Up @@ -78,10 +76,6 @@ var (
MethodName: methodGetRuntimes.ShortName(),
Handler: handlerGetRuntimes,
},
{
MethodName: methodGetNodeList.ShortName(),
Handler: handlerGetNodeList,
},
{
MethodName: methodStateToGenesis.ShortName(),
Handler: handlerStateToGenesis,
Expand Down Expand Up @@ -277,29 +271,6 @@ func handlerGetRuntimes( // nolint: golint
return interceptor(ctx, height, info, handler)
}

func handlerGetNodeList( // nolint: golint
srv interface{},
ctx context.Context,
dec func(interface{}) error,
interceptor grpc.UnaryServerInterceptor,
) (interface{}, error) {
var height int64
if err := dec(&height); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(Backend).GetNodeList(ctx, height)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: methodGetNodeList.FullName(),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(Backend).GetNodeList(ctx, req.(int64))
}
return interceptor(ctx, height, info, handler)
}

func handlerStateToGenesis( // nolint: golint
srv interface{},
ctx context.Context,
Expand Down Expand Up @@ -628,14 +599,6 @@ func (c *registryClient) GetRuntimes(ctx context.Context, height int64) ([]*Runt
return rsp, nil
}

func (c *registryClient) GetNodeList(ctx context.Context, height int64) (*NodeList, error) {
var rsp NodeList
if err := c.conn.Invoke(ctx, methodGetNodeList.FullName(), height, &rsp); err != nil {
return nil, err
}
return &rsp, nil
}

func (c *registryClient) WatchRuntimes(ctx context.Context) (<-chan *Runtime, pubsub.ClosableSubscription, error) {
ctx, sub := pubsub.NewContextSubscription(ctx)

Expand Down

0 comments on commit 1aabc70

Please sign in to comment.