Skip to content

Commit

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

* chore: remove abci flush() and make it buildable

* fix: broken tests

* chore: recover import order
# Conflicts:
#	abci/client/grpc_client_test.go
#	abci/types/types.pb.go
#	abci/types/types.proto
#	abci/types/typespb_test.go
#	proxy/app_conn.go
#	state/execution.go

* chore: remove `Flush` from `types.proto`
  • Loading branch information
jinsan-line authored Apr 16, 2021
1 parent 636b019 commit 89413eb
Show file tree
Hide file tree
Showing 15 changed files with 243 additions and 775 deletions.
2 changes: 0 additions & 2 deletions abci/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ type Client interface {
SetResponseCallback(Callback)
Error() error

FlushAsync() *ReqRes
EchoAsync(msg string) *ReqRes
InfoAsync(types.RequestInfo) *ReqRes
SetOptionAsync(types.RequestSetOption) *ReqRes
Expand All @@ -44,7 +43,6 @@ type Client interface {
LoadSnapshotChunkAsync(types.RequestLoadSnapshotChunk) *ReqRes
ApplySnapshotChunkAsync(types.RequestApplySnapshotChunk) *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 @@ -176,15 +176,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
2 changes: 0 additions & 2 deletions abci/client/grpc_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ func TestProperSyncCalls(t *testing.T) {
go func() {
// This is BeginBlockSync unrolled....
reqres := c.BeginBlockAsync(types.RequestBeginBlock{})
err := c.FlushSync()
require.NoError(t, err)
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 @@ -43,11 +43,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/line/ostracon/abci/types"
tmnet "github.com/line/ostracon/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 @@ -120,10 +120,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 @@ -185,12 +179,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 89413eb

Please sign in to comment.