From 1aabc700538d5ec8e269ff94f1dfe37ab9672b8c Mon Sep 17 00:00:00 2001 From: ptrus Date: Tue, 30 Jun 2020 12:34:43 +0200 Subject: [PATCH] go/registry/api: Remove `GetNodeList` method --- .changelog/3067.breaking.md | 4 +++ go/consensus/tendermint/registry/registry.go | 4 --- go/registry/api/api.go | 3 -- go/registry/api/grpc.go | 37 -------------------- 4 files changed, 4 insertions(+), 44 deletions(-) create mode 100644 .changelog/3067.breaking.md diff --git a/.changelog/3067.breaking.md b/.changelog/3067.breaking.md new file mode 100644 index 00000000000..fb8afee24ba --- /dev/null +++ b/.changelog/3067.breaking.md @@ -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. diff --git a/go/consensus/tendermint/registry/registry.go b/go/consensus/tendermint/registry/registry.go index 82c8673ab4d..1674e5019f9 100644 --- a/go/consensus/tendermint/registry/registry.go +++ b/go/consensus/tendermint/registry/registry.go @@ -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() { } diff --git a/go/registry/api/api.go b/go/registry/api/api.go index 0721fc57392..faf8fe1793e 100644 --- a/go/registry/api/api.go +++ b/go/registry/api/api.go @@ -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) diff --git a/go/registry/api/grpc.go b/go/registry/api/grpc.go index e739917d068..b6e1a26e6b7 100644 --- a/go/registry/api/grpc.go +++ b/go/registry/api/grpc.go @@ -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. @@ -78,10 +76,6 @@ var ( MethodName: methodGetRuntimes.ShortName(), Handler: handlerGetRuntimes, }, - { - MethodName: methodGetNodeList.ShortName(), - Handler: handlerGetNodeList, - }, { MethodName: methodStateToGenesis.ShortName(), Handler: handlerStateToGenesis, @@ -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, @@ -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)