diff --git a/object/convert.go b/object/convert.go index 63f8defa..07bf89ce 100644 --- a/object/convert.go +++ b/object/convert.go @@ -2114,3 +2114,58 @@ func (r *PutSingleRequest) FromGRPCMessage(m grpc.Message) error { return r.RequestHeaders.FromMessage(v) } + +func (r *PutSingleResponseBody) ToGRPCMessage() grpc.Message { + var b *object.PutSingleResponse_Body + if r != nil { + b = new(object.PutSingleResponse_Body) + } + return b +} + +func (r *PutSingleResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.PutSingleResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + return nil +} + +func (r *PutSingleResponse) ToGRPCMessage() grpc.Message { + var m *object.PutSingleResponse + + if r != nil { + m = new(object.PutSingleResponse) + + m.SetBody(r.body.ToGRPCMessage().(*object.PutSingleResponse_Body)) + r.ResponseHeaders.ToMessage(m) + } + + return m +} + +func (r *PutSingleResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.PutSingleResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(PutSingleResponseBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.ResponseHeaders.FromMessage(v) +} diff --git a/object/grpc/service.go b/object/grpc/service.go index 7e870a19..27645dd3 100644 --- a/object/grpc/service.go +++ b/object/grpc/service.go @@ -520,3 +520,18 @@ func (m *PutSingleRequest) SetMetaHeader(v *session.RequestMetaHeader) { func (m *PutSingleRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { m.VerifyHeader = v } + +// SetBody sets body of the response. +func (m *PutSingleResponse) SetBody(b *PutSingleResponse_Body) { + m.Body = b +} + +// SetMetaHeader sets meta header of the response. +func (m *PutSingleResponse) SetMetaHeader(v *session.ResponseMetaHeader) { + m.MetaHeader = v +} + +// SetVerifyHeader sets verification header of the response. +func (m *PutSingleResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { + m.VerifyHeader = v +} diff --git a/object/marshal.go b/object/marshal.go index f210f448..fe0e232a 100644 --- a/object/marshal.go +++ b/object/marshal.go @@ -1098,3 +1098,23 @@ func (r *PutSingleRequestBody) StableSize() int { func (r *PutSingleRequestBody) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(object.PutSingleRequest_Body)) } + +func (r *PutSingleResponseBody) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + return buf +} + +func (r *PutSingleResponseBody) StableSize() int { + return 0 +} + +func (r *PutSingleResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.PutSingleResponse_Body)) +} diff --git a/object/message_test.go b/object/message_test.go index ecf0425e..a111c608 100644 --- a/object/message_test.go +++ b/object/message_test.go @@ -52,5 +52,6 @@ func TestMessageConvert(t *testing.T) { func(empty bool) message.Message { return objecttest.GenerateGetRangeHashResponse(empty) }, func(empty bool) message.Message { return objecttest.GenerateLock(empty) }, func(empty bool) message.Message { return objecttest.GeneratePutSingleRequest(empty) }, + func(empty bool) message.Message { return objecttest.GeneratePutSingleResponse(empty) }, ) } diff --git a/object/test/generate.go b/object/test/generate.go index 4f163d29..fca772c9 100644 --- a/object/test/generate.go +++ b/object/test/generate.go @@ -632,3 +632,13 @@ func GeneratePutSingleRequestBody(empty bool) *object.PutSingleRequestBody { } return b } + +func GeneratePutSingleResponse(empty bool) *object.PutSingleResponse { + m := new(object.PutSingleResponse) + if !empty { + m.SetBody(new(object.PutSingleResponseBody)) + } + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + return m +} diff --git a/object/types.go b/object/types.go index 625c1ce6..d22b428f 100644 --- a/object/types.go +++ b/object/types.go @@ -312,6 +312,15 @@ type PutSingleRequest struct { session.RequestHeaders } +type PutSingleResponseBody struct { +} + +type PutSingleResponse struct { + body *PutSingleResponseBody + + session.ResponseHeaders +} + const ( TypeRegular Type = iota TypeTombstone @@ -1450,3 +1459,15 @@ func (b *PutSingleRequestBody) GetCopiesNumber() []uint32 { func (b *PutSingleRequestBody) SetCopiesNumber(v []uint32) { b.copyNum = v } + +func (r *PutSingleResponse) GetBody() *PutSingleResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *PutSingleResponse) SetBody(v *PutSingleResponseBody) { + r.body = v +} diff --git a/signature/body.go b/signature/body.go index 68c361d6..b7bb6b43 100644 --- a/signature/body.go +++ b/signature/body.go @@ -89,6 +89,8 @@ func serviceMessageBody(req any) stableMarshaler { return v.GetBody() case *object.PutSingleRequest: return v.GetBody() + case *object.PutSingleResponse: + return v.GetBody() /* Netmap */ case *netmap.LocalNodeInfoRequest: