func (cli *grpcClient) AppendTxAsync(tx []byte) *ReqRes { req := types.ToRequestAppendTx(tx) res, err := cli.client.AppendTx(context.Background(), req.GetAppendTx(), grpc.FailFast(true)) if err != nil { cli.StopForError(err) } return cli.finishAsyncCall(req, &types.Response{&types.Response_AppendTx{res}}) }
func (cli *socketClient) AppendTxSync(tx []byte) (res types.Result) { reqres := cli.queueRequest(types.ToRequestAppendTx(tx)) cli.FlushSync() if err := cli.Error(); err != nil { return types.ErrInternalError.SetLog(err.Error()) } resp := reqres.Response.GetAppendTx() return types.Result{Code: resp.Code, Data: resp.Data, Log: resp.Log} }
func (app *localClient) AppendTxAsync(tx []byte) *ReqRes { app.mtx.Lock() res := app.Application.AppendTx(tx) app.mtx.Unlock() return app.callback( types.ToRequestAppendTx(tx), types.ToResponseAppendTx(res.Code, res.Data, res.Log), ) }
func (cli *socketClient) AppendTxAsync(tx []byte) *ReqRes { return cli.queueRequest(types.ToRequestAppendTx(tx)) }