use batchElem from rpc client

This commit is contained in:
Taka Goto
2019-01-21 14:52:37 -06:00
parent 54d771cb06
commit 3595771825
6 changed files with 30 additions and 16 deletions
+16 -2
View File
@@ -10,6 +10,13 @@ type RpcClient struct {
ipcPath string
}
type BatchElem struct {
Method string
Args []interface{}
Result interface{}
Error error
}
func NewRpcClient(client *rpc.Client, ipcPath string) RpcClient {
return RpcClient{
client: client,
@@ -36,6 +43,13 @@ func (client RpcClient) SupportedModules() (map[string]string, error) {
return client.client.SupportedModules()
}
func (client RpcClient) BatchCall(batch []rpc.BatchElem) error {
return client.client.BatchCall(batch)
func (client RpcClient) BatchCall(batch []BatchElem) error {
var rpcBatch []rpc.BatchElem
for index, batchElem := range batch {
rpcBatch[index].Result = batchElem.Result
rpcBatch[index].Method = batchElem.Method
rpcBatch[index].Args = batchElem.Args
rpcBatch[index].Error = batchElem.Error
}
return client.client.BatchCall(rpcBatch)
}