mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-26 03:01:42 +00:00
Make fields in ResponseInfo be flat
This commit is contained in:
@ -25,7 +25,7 @@ type Client interface {
|
||||
|
||||
FlushSync() error
|
||||
EchoSync(msg string) (res types.Result)
|
||||
InfoSync() (types.Result, *types.TMSPInfo, *types.LastBlockInfo, *types.ConfigInfo)
|
||||
InfoSync() (resInfo types.ResponseInfo, err error)
|
||||
SetOptionSync(key string, value string) (res types.Result)
|
||||
AppendTxSync(tx []byte) (res types.Result)
|
||||
CheckTxSync(tx []byte) (res types.Result)
|
||||
|
@ -262,13 +262,16 @@ func (cli *grpcClient) FlushSync() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (cli *grpcClient) InfoSync() (types.Result, *types.TMSPInfo, *types.LastBlockInfo, *types.ConfigInfo) {
|
||||
func (cli *grpcClient) InfoSync() (resInfo types.ResponseInfo, err error) {
|
||||
reqres := cli.InfoAsync()
|
||||
if res := cli.checkErrGetResult(); res.IsErr() {
|
||||
return res, nil, nil, nil
|
||||
if err = cli.Error(); err != nil {
|
||||
return resInfo, err
|
||||
}
|
||||
if resInfo_ := reqres.Response.GetInfo(); resInfo_ != nil {
|
||||
return *resInfo_, nil
|
||||
} else {
|
||||
return resInfo, nil
|
||||
}
|
||||
resp := reqres.Response.GetInfo()
|
||||
return types.NewResultOK([]byte(resp.Info), LOG), resp.TmspInfo, resp.LastBlock, resp.Config
|
||||
}
|
||||
|
||||
func (cli *grpcClient) SetOptionSync(key string, value string) (res types.Result) {
|
||||
|
@ -51,11 +51,11 @@ func (app *localClient) EchoAsync(msg string) *ReqRes {
|
||||
|
||||
func (app *localClient) InfoAsync() *ReqRes {
|
||||
app.mtx.Lock()
|
||||
info, tmspInfo, blockInfo, configInfo := app.Application.Info()
|
||||
resInfo := app.Application.Info()
|
||||
app.mtx.Unlock()
|
||||
return app.callback(
|
||||
types.ToRequestInfo(),
|
||||
types.ToResponseInfo(info, tmspInfo, blockInfo, configInfo),
|
||||
types.ToResponseInfo(resInfo),
|
||||
)
|
||||
}
|
||||
|
||||
@ -157,11 +157,11 @@ func (app *localClient) EchoSync(msg string) (res types.Result) {
|
||||
return types.OK.SetData([]byte(msg))
|
||||
}
|
||||
|
||||
func (app *localClient) InfoSync() (types.Result, *types.TMSPInfo, *types.LastBlockInfo, *types.ConfigInfo) {
|
||||
func (app *localClient) InfoSync() (resInfo types.ResponseInfo, err error) {
|
||||
app.mtx.Lock()
|
||||
defer app.mtx.Unlock()
|
||||
info, tmspInfo, blockInfo, configInfo := app.Application.Info()
|
||||
return types.OK.SetData([]byte(info)), tmspInfo, blockInfo, configInfo
|
||||
resInfo = app.Application.Info()
|
||||
return resInfo, nil
|
||||
}
|
||||
|
||||
func (app *localClient) SetOptionSync(key string, value string) (res types.Result) {
|
||||
|
@ -292,14 +292,17 @@ func (cli *socketClient) FlushSync() error {
|
||||
return cli.Error()
|
||||
}
|
||||
|
||||
func (cli *socketClient) InfoSync() (types.Result, *types.TMSPInfo, *types.LastBlockInfo, *types.ConfigInfo) {
|
||||
func (cli *socketClient) InfoSync() (resInfo types.ResponseInfo, err error) {
|
||||
reqres := cli.queueRequest(types.ToRequestInfo())
|
||||
cli.FlushSync()
|
||||
if err := cli.Error(); err != nil {
|
||||
return types.ErrInternalError.SetLog(err.Error()), nil, nil, nil
|
||||
return resInfo, err
|
||||
}
|
||||
if resInfo_ := reqres.Response.GetInfo(); resInfo_ != nil {
|
||||
return *resInfo_, nil
|
||||
} else {
|
||||
return resInfo, nil
|
||||
}
|
||||
resp := reqres.Response.GetInfo()
|
||||
return types.Result{Code: OK, Data: []byte(resp.Info), Log: LOG}, resp.TmspInfo, resp.LastBlock, resp.Config
|
||||
}
|
||||
|
||||
func (cli *socketClient) SetOptionSync(key string, value string) (res types.Result) {
|
||||
|
Reference in New Issue
Block a user