From 285516a94ebe4c4f1116c01ecd2c73e106e832fd Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Fri, 30 Jun 2023 16:07:57 +0300 Subject: [PATCH] [#45] api-go: Add PutSingle RPC call Signed-off-by: Dmitrii Stepanov --- rpc/object.go | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/rpc/object.go b/rpc/object.go index 1cac1c7..1eca922 100644 --- a/rpc/object.go +++ b/rpc/object.go @@ -10,13 +10,14 @@ import ( const serviceObject = serviceNamePrefix + "object.ObjectService" const ( - rpcObjectPut = "Put" - rpcObjectGet = "Get" - rpcObjectSearch = "Search" - rpcObjectRange = "GetRange" - rpcObjectHash = "GetRangeHash" - rpcObjectHead = "Head" - rpcObjectDelete = "Delete" + rpcObjectPut = "Put" + rpcObjectGet = "Get" + rpcObjectSearch = "Search" + rpcObjectRange = "GetRange" + rpcObjectHash = "GetRangeHash" + rpcObjectHead = "Head" + rpcObjectDelete = "Delete" + rpcObjectPutSingle = "PutSingle" ) // PutRequestWriter is an object.PutRequest @@ -188,3 +189,19 @@ func HashObjectRange( return resp, nil } + +// PutSingleObject executes ObjectService.PutSingle RPC. +func PutSingleObject( + cli *client.Client, + req *object.PutSingleRequest, + opts ...client.CallOption, +) (*object.PutSingleResponse, error) { + resp := new(object.PutSingleResponse) + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceObject, rpcObjectPutSingle), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +}