Skip to content

Commit

Permalink
chore: remove abci flush() (#156)
Browse files Browse the repository at this point in the history
* chore: remove abci flush() and make it buildable

* fix: broken tests

* chore: recover import order
  • Loading branch information
jinsan-line authored Dec 30, 2020
1 parent cec6efd commit becc4f6
Show file tree
Hide file tree
Showing 16 changed files with 205 additions and 1,141 deletions.
2 changes: 0 additions & 2 deletions abci/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ type Client interface {
SetResponseCallback(Callback)
Error() error

FlushAsync() *ReqRes
EchoAsync(msg string) *ReqRes
InfoAsync(types.RequestInfo) *ReqRes
SetOptionAsync(types.RequestSetOption) *ReqRes
Expand All @@ -36,7 +35,6 @@ type Client interface {
BeginBlockAsync(types.RequestBeginBlock) *ReqRes
EndBlockAsync(types.RequestEndBlock) *ReqRes

FlushSync() error
EchoSync(msg string) (*types.ResponseEcho, error)
InfoSync(types.RequestInfo) (*types.ResponseInfo, error)
SetOptionSync(types.RequestSetOption) (*types.ResponseSetOption, error)
Expand Down
9 changes: 0 additions & 9 deletions abci/client/grpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,6 @@ func (cli *grpcClient) EchoAsync(msg string) *ReqRes {
return cli.finishAsyncCall(req, &types.Response{Value: &types.Response_Echo{Echo: res}})
}

func (cli *grpcClient) FlushAsync() *ReqRes {
req := types.ToRequestFlush()
res, err := cli.client.Flush(context.Background(), req.GetFlush(), grpc.WaitForReady(true))
if err != nil {
cli.StopForError(err)
}
return cli.finishAsyncCall(req, &types.Response{Value: &types.Response_Flush{Flush: res}})
}

func (cli *grpcClient) InfoAsync(params types.RequestInfo) *ReqRes {
req := types.ToRequestInfo(params)
res, err := cli.client.Info(context.Background(), req.GetInfo(), grpc.WaitForReady(true))
Expand Down
1 change: 0 additions & 1 deletion abci/client/grpc_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ func TestProperSyncCalls(t *testing.T) {
go func() {
// This is BeginBlockSync unrolled....
reqres := c.BeginBlockAsync(types.RequestBeginBlock{})
c.FlushSync()
res := reqres.Response.GetBeginBlock()
require.NotNil(t, res)
resp <- c.Error()
Expand Down
5 changes: 0 additions & 5 deletions abci/client/local_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ func (app *localClient) Error() error {
return nil
}

func (app *localClient) FlushAsync() *ReqRes {
// Do nothing
return newLocalReqRes(types.ToRequestFlush(), nil)
}

func (app *localClient) EchoAsync(msg string) *ReqRes {
app.mtx.Lock()
defer app.mtx.Unlock()
Expand Down
8 changes: 0 additions & 8 deletions abci/tests/benchmarks/simple/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"
"io"
"log"
"reflect"

"github.com/tendermint/tendermint/abci/types"
tmnet "github.com/tendermint/tendermint/libs/net"
Expand Down Expand Up @@ -41,10 +40,6 @@ func makeRequest(conn io.ReadWriter, req *types.Request) (*types.Response, error
if err != nil {
return nil, err
}
err = types.WriteMessage(types.ToRequestFlush(), bufWriter)
if err != nil {
return nil, err
}
err = bufWriter.Flush()
if err != nil {
return nil, err
Expand All @@ -61,9 +56,6 @@ func makeRequest(conn io.ReadWriter, req *types.Request) (*types.Response, error
if err != nil {
return nil, err
}
if _, ok := resFlush.Value.(*types.Response_Flush); !ok {
return nil, fmt.Errorf("expected flush response but got something else: %v", reflect.TypeOf(resFlush))
}

return res, nil
}
4 changes: 0 additions & 4 deletions abci/types/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@ func (app *GRPCApplication) Echo(ctx context.Context, req *RequestEcho) (*Respon
return &ResponseEcho{Message: req.Message}, nil
}

func (app *GRPCApplication) Flush(ctx context.Context, req *RequestFlush) (*ResponseFlush, error) {
return &ResponseFlush{}, nil
}

func (app *GRPCApplication) Info(ctx context.Context, req *RequestInfo) (*ResponseInfo, error) {
res := app.app.Info(*req)
return &res, nil
Expand Down
12 changes: 0 additions & 12 deletions abci/types/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,6 @@ func ToRequestEcho(message string) *Request {
}
}

func ToRequestFlush() *Request {
return &Request{
Value: &Request_Flush{&RequestFlush{}},
}
}

func ToRequestInfo(req RequestInfo) *Request {
return &Request{
Value: &Request_Info{&req},
Expand Down Expand Up @@ -149,12 +143,6 @@ func ToResponseEcho(message string) *Response {
}
}

func ToResponseFlush() *Response {
return &Response{
Value: &Response_Flush{&ResponseFlush{}},
}
}

func ToResponseInfo(res ResponseInfo) *Response {
return &Response{
Value: &Response_Info{&res},
Expand Down
Loading

0 comments on commit becc4f6

Please sign in to comment.