2020-08-17 12:08:00 +00:00
|
|
|
package container
|
|
|
|
|
|
|
|
import (
|
2020-08-17 16:00:10 +00:00
|
|
|
"github.com/nspcc-dev/neofs-api-go/v2/acl"
|
2020-08-17 12:08:00 +00:00
|
|
|
container "github.com/nspcc-dev/neofs-api-go/v2/container/grpc"
|
|
|
|
"github.com/nspcc-dev/neofs-api-go/v2/netmap"
|
|
|
|
"github.com/nspcc-dev/neofs-api-go/v2/refs"
|
2020-08-17 16:00:10 +00:00
|
|
|
refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc"
|
2020-08-20 10:41:55 +00:00
|
|
|
"github.com/nspcc-dev/neofs-api-go/v2/session"
|
2020-08-17 12:08:00 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func AttributeToGRPCMessage(a *Attribute) *container.Container_Attribute {
|
|
|
|
if a == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
m := new(container.Container_Attribute)
|
|
|
|
|
|
|
|
m.SetKey(a.GetKey())
|
|
|
|
m.SetValue(a.GetValue())
|
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func AttributeFromGRPCMessage(m *container.Container_Attribute) *Attribute {
|
|
|
|
if m == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
a := new(Attribute)
|
|
|
|
|
|
|
|
a.SetKey(m.GetKey())
|
|
|
|
a.SetValue(m.GetValue())
|
|
|
|
|
|
|
|
return a
|
|
|
|
}
|
|
|
|
|
|
|
|
func ContainerToGRPCMessage(c *Container) *container.Container {
|
|
|
|
if c == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
m := new(container.Container)
|
|
|
|
|
|
|
|
m.SetVersion(
|
2020-08-20 09:43:47 +00:00
|
|
|
refs.VersionToGRPCMessage(c.GetVersion()),
|
2020-08-17 12:08:00 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
m.SetOwnerId(
|
|
|
|
refs.OwnerIDToGRPCMessage(c.GetOwnerID()),
|
|
|
|
)
|
|
|
|
|
|
|
|
m.SetNonce(c.GetNonce())
|
|
|
|
|
|
|
|
m.SetBasicAcl(c.GetBasicACL())
|
|
|
|
|
|
|
|
m.SetPlacementPolicy(
|
|
|
|
netmap.PlacementPolicyToGRPCMessage(c.GetPlacementPolicy()),
|
|
|
|
)
|
|
|
|
|
|
|
|
attr := c.GetAttributes()
|
|
|
|
attrMsg := make([]*container.Container_Attribute, 0, len(attr))
|
|
|
|
|
|
|
|
for i := range attr {
|
|
|
|
attrMsg = append(attrMsg, AttributeToGRPCMessage(attr[i]))
|
|
|
|
}
|
|
|
|
|
|
|
|
m.SetAttributes(attrMsg)
|
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func ContainerFromGRPCMessage(m *container.Container) *Container {
|
|
|
|
if m == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
c := new(Container)
|
|
|
|
|
|
|
|
c.SetVersion(
|
2020-08-20 09:43:47 +00:00
|
|
|
refs.VersionFromGRPCMessage(m.GetVersion()),
|
2020-08-17 12:08:00 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
c.SetOwnerID(
|
|
|
|
refs.OwnerIDFromGRPCMessage(m.GetOwnerId()),
|
|
|
|
)
|
|
|
|
|
|
|
|
c.SetNonce(m.GetNonce())
|
|
|
|
|
|
|
|
c.SetBasicACL(m.GetBasicAcl())
|
|
|
|
|
|
|
|
c.SetPlacementPolicy(
|
|
|
|
netmap.PlacementPolicyFromGRPCMessage(m.GetPlacementPolicy()),
|
|
|
|
)
|
|
|
|
|
|
|
|
attrMsg := m.GetAttributes()
|
|
|
|
attr := make([]*Attribute, 0, len(attrMsg))
|
|
|
|
|
|
|
|
for i := range attrMsg {
|
|
|
|
attr = append(attr, AttributeFromGRPCMessage(attrMsg[i]))
|
|
|
|
}
|
|
|
|
|
|
|
|
c.SetAttributes(attr)
|
|
|
|
|
|
|
|
return c
|
|
|
|
}
|
2020-08-17 16:00:10 +00:00
|
|
|
|
|
|
|
func PutRequestBodyToGRPCMessage(r *PutRequestBody) *container.PutRequest_Body {
|
|
|
|
if r == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
m := new(container.PutRequest_Body)
|
|
|
|
|
|
|
|
m.SetContainer(
|
|
|
|
ContainerToGRPCMessage(r.GetContainer()),
|
|
|
|
)
|
|
|
|
|
2020-08-18 12:48:39 +00:00
|
|
|
m.SetSignature(
|
2020-08-20 09:43:47 +00:00
|
|
|
refs.SignatureToGRPCMessage(r.GetSignature()),
|
2020-08-18 12:48:39 +00:00
|
|
|
)
|
2020-08-17 16:00:10 +00:00
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func PutRequestBodyFromGRPCMessage(m *container.PutRequest_Body) *PutRequestBody {
|
|
|
|
if m == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
r := new(PutRequestBody)
|
|
|
|
|
|
|
|
r.SetContainer(
|
|
|
|
ContainerFromGRPCMessage(m.GetContainer()),
|
|
|
|
)
|
|
|
|
|
2020-08-18 12:48:39 +00:00
|
|
|
r.SetSignature(
|
2020-08-20 09:43:47 +00:00
|
|
|
refs.SignatureFromGRPCMessage(m.GetSignature()),
|
2020-08-18 12:48:39 +00:00
|
|
|
)
|
2020-08-17 16:00:10 +00:00
|
|
|
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
func PutRequestToGRPCMessage(r *PutRequest) *container.PutRequest {
|
|
|
|
if r == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
m := new(container.PutRequest)
|
|
|
|
|
|
|
|
m.SetBody(
|
|
|
|
PutRequestBodyToGRPCMessage(r.GetBody()),
|
|
|
|
)
|
|
|
|
|
2020-08-20 10:41:55 +00:00
|
|
|
session.RequestHeadersToGRPC(r, m)
|
2020-08-17 16:00:10 +00:00
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func PutRequestFromGRPCMessage(m *container.PutRequest) *PutRequest {
|
|
|
|
if m == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
r := new(PutRequest)
|
|
|
|
|
|
|
|
r.SetBody(
|
|
|
|
PutRequestBodyFromGRPCMessage(m.GetBody()),
|
|
|
|
)
|
|
|
|
|
2020-08-20 10:41:55 +00:00
|
|
|
session.RequestHeadersFromGRPC(m, r)
|
2020-08-17 16:00:10 +00:00
|
|
|
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
func PutResponseBodyToGRPCMessage(r *PutResponseBody) *container.PutResponse_Body {
|
|
|
|
if r == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
m := new(container.PutResponse_Body)
|
|
|
|
|
|
|
|
m.SetContainerId(
|
|
|
|
refs.ContainerIDToGRPCMessage(r.GetContainerID()),
|
|
|
|
)
|
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func PutResponseBodyFromGRPCMessage(m *container.PutResponse_Body) *PutResponseBody {
|
|
|
|
if m == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
r := new(PutResponseBody)
|
|
|
|
|
|
|
|
r.SetContainerID(
|
|
|
|
refs.ContainerIDFromGRPCMessage(m.GetContainerId()),
|
|
|
|
)
|
|
|
|
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
func PutResponseToGRPCMessage(r *PutResponse) *container.PutResponse {
|
|
|
|
if r == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
m := new(container.PutResponse)
|
|
|
|
|
|
|
|
m.SetBody(
|
|
|
|
PutResponseBodyToGRPCMessage(r.GetBody()),
|
|
|
|
)
|
|
|
|
|
2020-08-20 10:41:55 +00:00
|
|
|
session.ResponseHeadersToGRPC(r, m)
|
2020-08-17 16:00:10 +00:00
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func PutResponseFromGRPCMessage(m *container.PutResponse) *PutResponse {
|
|
|
|
if m == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
r := new(PutResponse)
|
|
|
|
|
|
|
|
r.SetBody(
|
|
|
|
PutResponseBodyFromGRPCMessage(m.GetBody()),
|
|
|
|
)
|
|
|
|
|
2020-08-20 10:41:55 +00:00
|
|
|
session.ResponseHeadersFromGRPC(m, r)
|
2020-08-17 16:00:10 +00:00
|
|
|
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
func GetRequestBodyToGRPCMessage(r *GetRequestBody) *container.GetRequest_Body {
|
|
|
|
if r == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
m := new(container.GetRequest_Body)
|
|
|
|
|
|
|
|
m.SetContainerId(
|
|
|
|
refs.ContainerIDToGRPCMessage(r.GetContainerID()),
|
|
|
|
)
|
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func GetRequestBodyFromGRPCMessage(m *container.GetRequest_Body) *GetRequestBody {
|
|
|
|
if m == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
r := new(GetRequestBody)
|
|
|
|
|
|
|
|
r.SetContainerID(
|
|
|
|
refs.ContainerIDFromGRPCMessage(m.GetContainerId()),
|
|
|
|
)
|
|
|
|
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
func GetRequestToGRPCMessage(r *GetRequest) *container.GetRequest {
|
|
|
|
if r == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
m := new(container.GetRequest)
|
|
|
|
|
|
|
|
m.SetBody(
|
|
|
|
GetRequestBodyToGRPCMessage(r.GetBody()),
|
|
|
|
)
|
|
|
|
|
2020-08-20 10:41:55 +00:00
|
|
|
session.RequestHeadersToGRPC(r, m)
|
2020-08-17 16:00:10 +00:00
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func GetRequestFromGRPCMessage(m *container.GetRequest) *GetRequest {
|
|
|
|
if m == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
r := new(GetRequest)
|
|
|
|
|
|
|
|
r.SetBody(
|
|
|
|
GetRequestBodyFromGRPCMessage(m.GetBody()),
|
|
|
|
)
|
|
|
|
|
2020-08-20 10:41:55 +00:00
|
|
|
session.RequestHeadersFromGRPC(m, r)
|
2020-08-17 16:00:10 +00:00
|
|
|
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
func GetResponseBodyToGRPCMessage(r *GetResponseBody) *container.GetResponse_Body {
|
|
|
|
if r == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
m := new(container.GetResponse_Body)
|
|
|
|
|
|
|
|
m.SetContainer(
|
|
|
|
ContainerToGRPCMessage(r.GetContainer()),
|
|
|
|
)
|
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func GetResponseBodyFromGRPCMessage(m *container.GetResponse_Body) *GetResponseBody {
|
|
|
|
if m == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
r := new(GetResponseBody)
|
|
|
|
|
|
|
|
r.SetContainer(
|
|
|
|
ContainerFromGRPCMessage(m.GetContainer()),
|
|
|
|
)
|
|
|
|
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
func GetResponseToGRPCMessage(r *GetResponse) *container.GetResponse {
|
|
|
|
if r == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
m := new(container.GetResponse)
|
|
|
|
|
|
|
|
m.SetBody(
|
|
|
|
GetResponseBodyToGRPCMessage(r.GetBody()),
|
|
|
|
)
|
|
|
|
|
2020-08-20 10:41:55 +00:00
|
|
|
session.ResponseHeadersToGRPC(r, m)
|
2020-08-17 16:00:10 +00:00
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func GetResponseFromGRPCMessage(m *container.GetResponse) *GetResponse {
|
|
|
|
if m == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
r := new(GetResponse)
|
|
|
|
|
|
|
|
r.SetBody(
|
|
|
|
GetResponseBodyFromGRPCMessage(m.GetBody()),
|
|
|
|
)
|
|
|
|
|
2020-08-20 10:41:55 +00:00
|
|
|
session.ResponseHeadersFromGRPC(m, r)
|
2020-08-17 16:00:10 +00:00
|
|
|
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
func DeleteRequestBodyToGRPCMessage(r *DeleteRequestBody) *container.DeleteRequest_Body {
|
|
|
|
if r == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
m := new(container.DeleteRequest_Body)
|
|
|
|
|
|
|
|
m.SetContainerId(
|
|
|
|
refs.ContainerIDToGRPCMessage(r.GetContainerID()),
|
|
|
|
)
|
|
|
|
|
2020-08-18 12:48:39 +00:00
|
|
|
m.SetSignature(
|
2020-08-20 09:43:47 +00:00
|
|
|
refs.SignatureToGRPCMessage(r.GetSignature()),
|
2020-08-18 12:48:39 +00:00
|
|
|
)
|
2020-08-17 16:00:10 +00:00
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func DeleteRequestBodyFromGRPCMessage(m *container.DeleteRequest_Body) *DeleteRequestBody {
|
|
|
|
if m == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
r := new(DeleteRequestBody)
|
|
|
|
|
|
|
|
r.SetContainerID(
|
|
|
|
refs.ContainerIDFromGRPCMessage(m.GetContainerId()),
|
|
|
|
)
|
|
|
|
|
2020-08-18 12:48:39 +00:00
|
|
|
r.SetSignature(
|
2020-08-20 09:43:47 +00:00
|
|
|
refs.SignatureFromGRPCMessage(m.GetSignature()),
|
2020-08-18 12:48:39 +00:00
|
|
|
)
|
2020-08-17 16:00:10 +00:00
|
|
|
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
func DeleteRequestToGRPCMessage(r *DeleteRequest) *container.DeleteRequest {
|
|
|
|
if r == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
m := new(container.DeleteRequest)
|
|
|
|
|
|
|
|
m.SetBody(
|
|
|
|
DeleteRequestBodyToGRPCMessage(r.GetBody()),
|
|
|
|
)
|
|
|
|
|
2020-08-20 10:41:55 +00:00
|
|
|
session.RequestHeadersToGRPC(r, m)
|
2020-08-17 16:00:10 +00:00
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func DeleteRequestFromGRPCMessage(m *container.DeleteRequest) *DeleteRequest {
|
|
|
|
if m == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
r := new(DeleteRequest)
|
|
|
|
|
|
|
|
r.SetBody(
|
|
|
|
DeleteRequestBodyFromGRPCMessage(m.GetBody()),
|
|
|
|
)
|
|
|
|
|
2020-08-20 10:41:55 +00:00
|
|
|
session.RequestHeadersFromGRPC(m, r)
|
2020-08-17 16:00:10 +00:00
|
|
|
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
func DeleteResponseBodyToGRPCMessage(r *DeleteResponseBody) *container.DeleteResponse_Body {
|
|
|
|
if r == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
m := new(container.DeleteResponse_Body)
|
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func DeleteResponseBodyFromGRPCMessage(m *container.DeleteResponse_Body) *DeleteResponseBody {
|
|
|
|
if m == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
r := new(DeleteResponseBody)
|
|
|
|
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
func DeleteResponseToGRPCMessage(r *DeleteResponse) *container.DeleteResponse {
|
|
|
|
if r == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
m := new(container.DeleteResponse)
|
|
|
|
|
|
|
|
m.SetBody(
|
|
|
|
DeleteResponseBodyToGRPCMessage(r.GetBody()),
|
|
|
|
)
|
|
|
|
|
2020-08-20 10:41:55 +00:00
|
|
|
session.ResponseHeadersToGRPC(r, m)
|
2020-08-17 16:00:10 +00:00
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func DeleteResponseFromGRPCMessage(m *container.DeleteResponse) *DeleteResponse {
|
|
|
|
if m == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
r := new(DeleteResponse)
|
|
|
|
|
|
|
|
r.SetBody(
|
|
|
|
DeleteResponseBodyFromGRPCMessage(m.GetBody()),
|
|
|
|
)
|
|
|
|
|
2020-08-20 10:41:55 +00:00
|
|
|
session.ResponseHeadersFromGRPC(m, r)
|
2020-08-17 16:00:10 +00:00
|
|
|
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
func ListRequestBodyToGRPCMessage(r *ListRequestBody) *container.ListRequest_Body {
|
|
|
|
if r == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
m := new(container.ListRequest_Body)
|
|
|
|
|
|
|
|
m.SetOwnerId(
|
|
|
|
refs.OwnerIDToGRPCMessage(r.GetOwnerID()),
|
|
|
|
)
|
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func ListRequestBodyFromGRPCMessage(m *container.ListRequest_Body) *ListRequestBody {
|
|
|
|
if m == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
r := new(ListRequestBody)
|
|
|
|
|
|
|
|
r.SetOwnerID(
|
|
|
|
refs.OwnerIDFromGRPCMessage(m.GetOwnerId()),
|
|
|
|
)
|
|
|
|
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
func ListRequestToGRPCMessage(r *ListRequest) *container.ListRequest {
|
|
|
|
if r == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
m := new(container.ListRequest)
|
|
|
|
|
|
|
|
m.SetBody(
|
|
|
|
ListRequestBodyToGRPCMessage(r.GetBody()),
|
|
|
|
)
|
|
|
|
|
2020-08-20 10:41:55 +00:00
|
|
|
session.RequestHeadersToGRPC(r, m)
|
2020-08-17 16:00:10 +00:00
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func ListRequestFromGRPCMessage(m *container.ListRequest) *ListRequest {
|
|
|
|
if m == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
r := new(ListRequest)
|
|
|
|
|
|
|
|
r.SetBody(
|
|
|
|
ListRequestBodyFromGRPCMessage(m.GetBody()),
|
|
|
|
)
|
|
|
|
|
2020-08-20 10:41:55 +00:00
|
|
|
session.RequestHeadersFromGRPC(m, r)
|
2020-08-17 16:00:10 +00:00
|
|
|
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
func ListResponseBodyToGRPCMessage(r *ListResponseBody) *container.ListResponse_Body {
|
|
|
|
if r == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
m := new(container.ListResponse_Body)
|
|
|
|
|
|
|
|
cids := r.GetContainerIDs()
|
|
|
|
cidMsg := make([]*refsGRPC.ContainerID, 0, len(cids))
|
|
|
|
|
|
|
|
for i := range cids {
|
|
|
|
cidMsg = append(cidMsg, refs.ContainerIDToGRPCMessage(cids[i]))
|
|
|
|
}
|
|
|
|
|
|
|
|
m.SetContainerIds(cidMsg)
|
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func ListResponseBodyFromGRPCMessage(m *container.ListResponse_Body) *ListResponseBody {
|
|
|
|
if m == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
r := new(ListResponseBody)
|
|
|
|
|
|
|
|
cidMsg := m.GetContainerIds()
|
|
|
|
cids := make([]*refs.ContainerID, 0, len(cidMsg))
|
|
|
|
|
|
|
|
for i := range cidMsg {
|
|
|
|
cids = append(cids, refs.ContainerIDFromGRPCMessage(cidMsg[i]))
|
|
|
|
}
|
|
|
|
|
|
|
|
r.SetContainerIDs(cids)
|
|
|
|
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
func ListResponseToGRPCMessage(r *ListResponse) *container.ListResponse {
|
|
|
|
if r == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
m := new(container.ListResponse)
|
|
|
|
|
|
|
|
m.SetBody(
|
|
|
|
ListResponseBodyToGRPCMessage(r.GetBody()),
|
|
|
|
)
|
|
|
|
|
2020-08-20 10:41:55 +00:00
|
|
|
session.ResponseHeadersToGRPC(r, m)
|
2020-08-17 16:00:10 +00:00
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func ListResponseFromGRPCMessage(m *container.ListResponse) *ListResponse {
|
|
|
|
if m == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
r := new(ListResponse)
|
|
|
|
|
|
|
|
r.SetBody(
|
|
|
|
ListResponseBodyFromGRPCMessage(m.GetBody()),
|
|
|
|
)
|
|
|
|
|
2020-08-20 10:41:55 +00:00
|
|
|
session.ResponseHeadersFromGRPC(m, r)
|
2020-08-17 16:00:10 +00:00
|
|
|
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
func SetExtendedACLRequestBodyToGRPCMessage(r *SetExtendedACLRequestBody) *container.SetExtendedACLRequest_Body {
|
|
|
|
if r == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
m := new(container.SetExtendedACLRequest_Body)
|
|
|
|
|
|
|
|
m.SetEacl(
|
|
|
|
acl.TableToGRPCMessage(r.GetEACL()),
|
|
|
|
)
|
|
|
|
|
2020-08-18 12:48:39 +00:00
|
|
|
m.SetSignature(
|
2020-08-20 09:43:47 +00:00
|
|
|
refs.SignatureToGRPCMessage(r.GetSignature()))
|
2020-08-17 16:00:10 +00:00
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func SetExtendedACLRequestBodyFromGRPCMessage(m *container.SetExtendedACLRequest_Body) *SetExtendedACLRequestBody {
|
|
|
|
if m == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
r := new(SetExtendedACLRequestBody)
|
|
|
|
|
|
|
|
r.SetEACL(
|
|
|
|
acl.TableFromGRPCMessage(m.GetEacl()),
|
|
|
|
)
|
|
|
|
|
2020-08-18 12:48:39 +00:00
|
|
|
r.SetSignature(
|
2020-08-20 09:43:47 +00:00
|
|
|
refs.SignatureFromGRPCMessage(m.GetSignature()),
|
2020-08-18 12:48:39 +00:00
|
|
|
)
|
|
|
|
|
2020-08-17 16:00:10 +00:00
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
func SetExtendedACLRequestToGRPCMessage(r *SetExtendedACLRequest) *container.SetExtendedACLRequest {
|
|
|
|
if r == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
m := new(container.SetExtendedACLRequest)
|
|
|
|
|
|
|
|
m.SetBody(
|
|
|
|
SetExtendedACLRequestBodyToGRPCMessage(r.GetBody()),
|
|
|
|
)
|
|
|
|
|
2020-08-20 10:41:55 +00:00
|
|
|
session.RequestHeadersToGRPC(r, m)
|
2020-08-17 16:00:10 +00:00
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func SetExtendedACLRequestFromGRPCMessage(m *container.SetExtendedACLRequest) *SetExtendedACLRequest {
|
|
|
|
if m == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
r := new(SetExtendedACLRequest)
|
|
|
|
|
|
|
|
r.SetBody(
|
|
|
|
SetExtendedACLRequestBodyFromGRPCMessage(m.GetBody()),
|
|
|
|
)
|
|
|
|
|
2020-08-20 10:41:55 +00:00
|
|
|
session.RequestHeadersFromGRPC(m, r)
|
2020-08-17 16:00:10 +00:00
|
|
|
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
func SetExtendedACLResponseBodyToGRPCMessage(r *SetExtendedACLResponseBody) *container.SetExtendedACLResponse_Body {
|
|
|
|
if r == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
m := new(container.SetExtendedACLResponse_Body)
|
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func SetExtendedACLResponseBodyFromGRPCMessage(m *container.SetExtendedACLResponse_Body) *SetExtendedACLResponseBody {
|
|
|
|
if m == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
r := new(SetExtendedACLResponseBody)
|
|
|
|
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
func SetExtendedACLResponseToGRPCMessage(r *SetExtendedACLResponse) *container.SetExtendedACLResponse {
|
|
|
|
if r == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
m := new(container.SetExtendedACLResponse)
|
|
|
|
|
|
|
|
m.SetBody(
|
|
|
|
SetExtendedACLResponseBodyToGRPCMessage(r.GetBody()),
|
|
|
|
)
|
|
|
|
|
2020-08-20 10:41:55 +00:00
|
|
|
session.ResponseHeadersToGRPC(r, m)
|
2020-08-17 16:00:10 +00:00
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func SetExtendedACLResponseFromGRPCMessage(m *container.SetExtendedACLResponse) *SetExtendedACLResponse {
|
|
|
|
if m == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
r := new(SetExtendedACLResponse)
|
|
|
|
|
|
|
|
r.SetBody(
|
|
|
|
SetExtendedACLResponseBodyFromGRPCMessage(m.GetBody()),
|
|
|
|
)
|
|
|
|
|
2020-08-20 10:41:55 +00:00
|
|
|
session.ResponseHeadersFromGRPC(m, r)
|
2020-08-17 16:00:10 +00:00
|
|
|
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
func GetExtendedACLRequestBodyToGRPCMessage(r *GetExtendedACLRequestBody) *container.GetExtendedACLRequest_Body {
|
|
|
|
if r == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
m := new(container.GetExtendedACLRequest_Body)
|
|
|
|
|
|
|
|
m.SetContainerId(
|
|
|
|
refs.ContainerIDToGRPCMessage(r.GetContainerID()),
|
|
|
|
)
|
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func GetExtendedACLRequestBodyFromGRPCMessage(m *container.GetExtendedACLRequest_Body) *GetExtendedACLRequestBody {
|
|
|
|
if m == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
r := new(GetExtendedACLRequestBody)
|
|
|
|
|
|
|
|
r.SetContainerID(
|
|
|
|
refs.ContainerIDFromGRPCMessage(m.GetContainerId()),
|
|
|
|
)
|
|
|
|
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
func GetExtendedACLRequestToGRPCMessage(r *GetExtendedACLRequest) *container.GetExtendedACLRequest {
|
|
|
|
if r == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
m := new(container.GetExtendedACLRequest)
|
|
|
|
|
|
|
|
m.SetBody(
|
|
|
|
GetExtendedACLRequestBodyToGRPCMessage(r.GetBody()),
|
|
|
|
)
|
|
|
|
|
2020-08-20 10:41:55 +00:00
|
|
|
session.RequestHeadersToGRPC(r, m)
|
2020-08-17 16:00:10 +00:00
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func GetExtendedACLRequestFromGRPCMessage(m *container.GetExtendedACLRequest) *GetExtendedACLRequest {
|
|
|
|
if m == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
r := new(GetExtendedACLRequest)
|
|
|
|
|
|
|
|
r.SetBody(
|
|
|
|
GetExtendedACLRequestBodyFromGRPCMessage(m.GetBody()),
|
|
|
|
)
|
|
|
|
|
2020-08-20 10:41:55 +00:00
|
|
|
session.RequestHeadersFromGRPC(m, r)
|
2020-08-17 16:00:10 +00:00
|
|
|
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
func GetExtendedACLResponseBodyToGRPCMessage(r *GetExtendedACLResponseBody) *container.GetExtendedACLResponse_Body {
|
|
|
|
if r == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
m := new(container.GetExtendedACLResponse_Body)
|
|
|
|
|
|
|
|
m.SetEacl(
|
|
|
|
acl.TableToGRPCMessage(r.GetEACL()),
|
|
|
|
)
|
|
|
|
|
2020-08-18 12:48:39 +00:00
|
|
|
m.SetSignature(
|
2020-08-20 09:43:47 +00:00
|
|
|
refs.SignatureToGRPCMessage(r.GetSignature()),
|
2020-08-18 12:48:39 +00:00
|
|
|
)
|
2020-08-17 16:00:10 +00:00
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func GetExtendedACLResponseBodyFromGRPCMessage(m *container.GetExtendedACLResponse_Body) *GetExtendedACLResponseBody {
|
|
|
|
if m == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
r := new(GetExtendedACLResponseBody)
|
|
|
|
|
|
|
|
r.SetEACL(
|
|
|
|
acl.TableFromGRPCMessage(m.GetEacl()),
|
|
|
|
)
|
|
|
|
|
2020-08-18 12:48:39 +00:00
|
|
|
r.SetSignature(
|
2020-08-20 09:43:47 +00:00
|
|
|
refs.SignatureFromGRPCMessage(m.GetSignature()),
|
2020-08-18 12:48:39 +00:00
|
|
|
)
|
2020-08-17 16:00:10 +00:00
|
|
|
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
func GetExtendedACLResponseToGRPCMessage(r *GetExtendedACLResponse) *container.GetExtendedACLResponse {
|
|
|
|
if r == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
m := new(container.GetExtendedACLResponse)
|
|
|
|
|
|
|
|
m.SetBody(
|
|
|
|
GetExtendedACLResponseBodyToGRPCMessage(r.GetBody()),
|
|
|
|
)
|
|
|
|
|
2020-08-20 10:41:55 +00:00
|
|
|
session.ResponseHeadersToGRPC(r, m)
|
2020-08-17 16:00:10 +00:00
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func GetExtendedACLResponseFromGRPCMessage(m *container.GetExtendedACLResponse) *GetExtendedACLResponse {
|
|
|
|
if m == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
r := new(GetExtendedACLResponse)
|
|
|
|
|
|
|
|
r.SetBody(
|
|
|
|
GetExtendedACLResponseBodyFromGRPCMessage(m.GetBody()),
|
|
|
|
)
|
|
|
|
|
2020-08-20 10:41:55 +00:00
|
|
|
session.ResponseHeadersFromGRPC(m, r)
|
2020-08-17 16:00:10 +00:00
|
|
|
|
|
|
|
return r
|
|
|
|
}
|
2021-01-21 14:57:04 +00:00
|
|
|
|
|
|
|
func UsedSpaceAnnouncementToGRPCMessage(a *UsedSpaceAnnouncement) *container.AnnounceUsedSpaceRequest_Body_Announcement {
|
|
|
|
if a == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
m := new(container.AnnounceUsedSpaceRequest_Body_Announcement)
|
|
|
|
|
2021-01-26 18:32:33 +00:00
|
|
|
m.SetEpoch(a.GetEpoch())
|
|
|
|
|
2021-01-21 14:57:04 +00:00
|
|
|
m.SetContainerId(
|
|
|
|
refs.ContainerIDToGRPCMessage(a.GetContainerID()),
|
|
|
|
)
|
|
|
|
|
|
|
|
m.SetUsedSpace(a.GetUsedSpace())
|
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func UsedSpaceAnnouncementFromGRPCMessage(m *container.AnnounceUsedSpaceRequest_Body_Announcement) *UsedSpaceAnnouncement {
|
|
|
|
if m == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
a := new(UsedSpaceAnnouncement)
|
|
|
|
|
2021-01-26 18:32:33 +00:00
|
|
|
a.SetEpoch(m.GetEpoch())
|
|
|
|
|
2021-01-21 14:57:04 +00:00
|
|
|
a.SetContainerID(
|
|
|
|
refs.ContainerIDFromGRPCMessage(m.GetContainerId()),
|
|
|
|
)
|
|
|
|
|
|
|
|
a.SetUsedSpace(m.GetUsedSpace())
|
|
|
|
|
|
|
|
return a
|
|
|
|
}
|
|
|
|
|
|
|
|
func AnnounceUsedSpaceRequestBodyToGRPCMessage(r *AnnounceUsedSpaceRequestBody) *container.AnnounceUsedSpaceRequest_Body {
|
|
|
|
if r == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
m := new(container.AnnounceUsedSpaceRequest_Body)
|
|
|
|
|
|
|
|
announcements := r.GetAnnouncements()
|
|
|
|
msgAnnouncements := make([]*container.AnnounceUsedSpaceRequest_Body_Announcement, 0, len(announcements))
|
|
|
|
|
|
|
|
for i := range announcements {
|
|
|
|
msgAnnouncements = append(
|
|
|
|
msgAnnouncements,
|
|
|
|
UsedSpaceAnnouncementToGRPCMessage(announcements[i]),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
m.SetAnnouncements(msgAnnouncements)
|
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func AnnounceUsedSpaceRequestBodyFromGRPCMessage(m *container.AnnounceUsedSpaceRequest_Body) *AnnounceUsedSpaceRequestBody {
|
|
|
|
if m == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
r := new(AnnounceUsedSpaceRequestBody)
|
|
|
|
|
|
|
|
msgAnnouncements := m.GetAnnouncements()
|
|
|
|
announcements := make([]*UsedSpaceAnnouncement, 0, len(msgAnnouncements))
|
|
|
|
|
|
|
|
for i := range msgAnnouncements {
|
|
|
|
announcements = append(
|
|
|
|
announcements,
|
|
|
|
UsedSpaceAnnouncementFromGRPCMessage(msgAnnouncements[i]),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
r.SetAnnouncements(announcements)
|
|
|
|
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
func AnnounceUsedSpaceRequestToGRPCMessage(r *AnnounceUsedSpaceRequest) *container.AnnounceUsedSpaceRequest {
|
|
|
|
if r == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
m := new(container.AnnounceUsedSpaceRequest)
|
|
|
|
|
|
|
|
m.SetBody(
|
|
|
|
AnnounceUsedSpaceRequestBodyToGRPCMessage(r.GetBody()),
|
|
|
|
)
|
|
|
|
|
|
|
|
session.RequestHeadersToGRPC(r, m)
|
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func AnnounceUsedSpaceRequestFromGRPCMessage(m *container.AnnounceUsedSpaceRequest) *AnnounceUsedSpaceRequest {
|
|
|
|
if m == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
r := new(AnnounceUsedSpaceRequest)
|
|
|
|
|
|
|
|
r.SetBody(
|
|
|
|
AnnounceUsedSpaceRequestBodyFromGRPCMessage(m.GetBody()),
|
|
|
|
)
|
|
|
|
|
|
|
|
session.RequestHeadersFromGRPC(m, r)
|
|
|
|
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
func AnnounceUsedSpaceResponseBodyToGRPCMessage(r *AnnounceUsedSpaceResponseBody) *container.AnnounceUsedSpaceResponse_Body {
|
|
|
|
if r == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
m := new(container.AnnounceUsedSpaceResponse_Body)
|
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func AnnounceUsedSpaceResponseBodyFromGRPCMessage(m *container.AnnounceUsedSpaceResponse_Body) *AnnounceUsedSpaceResponseBody {
|
|
|
|
if m == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
r := new(AnnounceUsedSpaceResponseBody)
|
|
|
|
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
func AnnounceUsedSpaceResponseToGRPCMessage(r *AnnounceUsedSpaceResponse) *container.AnnounceUsedSpaceResponse {
|
|
|
|
if r == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
m := new(container.AnnounceUsedSpaceResponse)
|
|
|
|
|
|
|
|
m.SetBody(
|
|
|
|
AnnounceUsedSpaceResponseBodyToGRPCMessage(r.GetBody()),
|
|
|
|
)
|
|
|
|
|
|
|
|
session.ResponseHeadersToGRPC(r, m)
|
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func AnnounceUsedSpaceResponseFromGRPCMessage(m *container.AnnounceUsedSpaceResponse) *AnnounceUsedSpaceResponse {
|
|
|
|
if m == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
r := new(AnnounceUsedSpaceResponse)
|
|
|
|
|
|
|
|
r.SetBody(
|
|
|
|
AnnounceUsedSpaceResponseBodyFromGRPCMessage(m.GetBody()),
|
|
|
|
)
|
|
|
|
|
|
|
|
session.ResponseHeadersFromGRPC(m, r)
|
|
|
|
|
|
|
|
return r
|
|
|
|
}
|