[#76] Make setter names more consistent

This will make the transition to a new codegen more seamless.
1. Setter should be named as the field itself.
2. Setter should accept 1 parameter.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2024-04-26 11:54:35 +03:00
parent fa8f92d662
commit 0fe6b9adbb
10 changed files with 36 additions and 36 deletions

View file

@ -164,7 +164,7 @@ func (f *HeaderFilter) ToGRPCMessage() grpc.Message {
m.SetKey(f.key) m.SetKey(f.key)
m.SetValue(f.value) m.SetValue(f.value)
m.SetHeader(HeaderTypeToGRPCField(f.hdrType)) m.SetHeaderType(HeaderTypeToGRPCField(f.hdrType))
m.SetMatchType(MatchTypeToGRPCField(f.matchType)) m.SetMatchType(MatchTypeToGRPCField(f.matchType))
} }
@ -427,7 +427,7 @@ func (bt *BearerTokenBody) ToGRPCMessage() grpc.Message {
m.SetOwnerId(bt.ownerID.ToGRPCMessage().(*refsGRPC.OwnerID)) m.SetOwnerId(bt.ownerID.ToGRPCMessage().(*refsGRPC.OwnerID))
m.SetLifetime(bt.lifetime.ToGRPCMessage().(*acl.BearerToken_Body_TokenLifetime)) m.SetLifetime(bt.lifetime.ToGRPCMessage().(*acl.BearerToken_Body_TokenLifetime))
m.SetEaclTable(bt.eacl.ToGRPCMessage().(*acl.EACLTable)) m.SetEaclTable(bt.eacl.ToGRPCMessage().(*acl.EACLTable))
m.SetImpersonate(bt.impersonate) m.SetAllowImpersonate(bt.impersonate)
} }
return m return m

View file

@ -39,8 +39,8 @@ func (m *EACLRecord) SetTargets(v []*EACLRecord_Target) {
m.Targets = v m.Targets = v
} }
// SetHeader sets header type of the eACL filter. // SetHeaderType sets header type of the eACL filter.
func (m *EACLRecord_Filter) SetHeader(v HeaderType) { func (m *EACLRecord_Filter) SetHeaderType(v HeaderType) {
m.HeaderType = v m.HeaderType = v
} }
@ -84,8 +84,8 @@ func (m *BearerToken_Body) SetLifetime(v *BearerToken_Body_TokenLifetime) {
m.Lifetime = v m.Lifetime = v
} }
// SetImpersonate allows impersonate. // SetAllowImpersonate allows impersonate.
func (m *BearerToken_Body) SetImpersonate(v bool) { func (m *BearerToken_Body) SetAllowImpersonate(v bool) {
m.AllowImpersonate = v m.AllowImpersonate = v
} }

View file

@ -202,7 +202,7 @@ func (respBody *AddChainResponseBody) ToGRPCMessage() grpc.Message {
if respBody != nil { if respBody != nil {
respBodygrpc = new(apemanager.AddChainResponse_Body) respBodygrpc = new(apemanager.AddChainResponse_Body)
respBodygrpc.SetChainID(respBody.GetChainID()) respBodygrpc.SetChainId(respBody.GetChainID())
} }
return respBodygrpc return respBodygrpc
@ -255,7 +255,7 @@ func (reqBody *RemoveChainRequestBody) ToGRPCMessage() grpc.Message {
reqBodygrpc = new(apemanager.RemoveChainRequest_Body) reqBodygrpc = new(apemanager.RemoveChainRequest_Body)
reqBodygrpc.SetTarget(reqBody.target.ToGRPCMessage().(*apemanager.ChainTarget)) reqBodygrpc.SetTarget(reqBody.target.ToGRPCMessage().(*apemanager.ChainTarget))
reqBodygrpc.SetChainID(reqBody.GetChainID()) reqBodygrpc.SetChainId(reqBody.GetChainID())
} }
return reqBodygrpc return reqBodygrpc

View file

@ -24,7 +24,7 @@ func (r *AddChainRequest) SetVerifyHeader(vh *session_grpc.RequestVerificationHe
r.VerifyHeader = vh r.VerifyHeader = vh
} }
func (rb *AddChainResponse_Body) SetChainID(chainID []byte) { func (rb *AddChainResponse_Body) SetChainId(chainID []byte) {
rb.ChainId = chainID rb.ChainId = chainID
} }
@ -44,7 +44,7 @@ func (rb *RemoveChainRequest_Body) SetTarget(t *ChainTarget) {
rb.Target = t rb.Target = t
} }
func (rb *RemoveChainRequest_Body) SetChainID(chainID []byte) { func (rb *RemoveChainRequest_Body) SetChainId(chainID []byte) {
rb.ChainId = chainID rb.ChainId = chainID
} }

View file

@ -901,7 +901,7 @@ func (r *GetResponseBody) ToGRPCMessage() grpc.Message {
case *SplitInfo: case *SplitInfo:
m.SetSplitInfo(t.ToGRPCMessage().(*object.SplitInfo)) m.SetSplitInfo(t.ToGRPCMessage().(*object.SplitInfo))
case *ECInfo: case *ECInfo:
m.SetECInfo(t.ToGRPCMessage().(*object.ECInfo)) m.SetEcInfo(t.ToGRPCMessage().(*object.ECInfo))
default: default:
panic(fmt.Sprintf("unknown get object part %T", t)) panic(fmt.Sprintf("unknown get object part %T", t))
} }
@ -1486,7 +1486,7 @@ func (r *HeadResponseBody) ToGRPCMessage() grpc.Message {
case *SplitInfo: case *SplitInfo:
m.SetSplitInfo(v.ToGRPCMessage().(*object.SplitInfo)) m.SetSplitInfo(v.ToGRPCMessage().(*object.SplitInfo))
case *ECInfo: case *ECInfo:
m.SetECInfo(v.ToGRPCMessage().(*object.ECInfo)) m.SetEcInfo(v.ToGRPCMessage().(*object.ECInfo))
default: default:
panic(fmt.Sprintf("unknown head part %T", v)) panic(fmt.Sprintf("unknown head part %T", v))
} }
@ -1963,7 +1963,7 @@ func (r *GetRangeResponseBody) ToGRPCMessage() grpc.Message {
case *SplitInfo: case *SplitInfo:
m.SetSplitInfo(v.ToGRPCMessage().(*object.SplitInfo)) m.SetSplitInfo(v.ToGRPCMessage().(*object.SplitInfo))
case *ECInfo: case *ECInfo:
m.SetECInfo(v.ToGRPCMessage().(*object.ECInfo)) m.SetEcInfo(v.ToGRPCMessage().(*object.ECInfo))
default: default:
panic(fmt.Sprintf("unknown get range part %T", v)) panic(fmt.Sprintf("unknown get range part %T", v))
} }

View file

@ -78,8 +78,8 @@ func (m *GetResponse_Body) SetSplitInfo(v *SplitInfo) {
} }
} }
// SetECInfo sets part of the object payload. // SetEcInfo sets part of the object payload.
func (m *GetResponse_Body) SetECInfo(v *ECInfo) { func (m *GetResponse_Body) SetEcInfo(v *ECInfo) {
m.ObjectPart = &GetResponse_Body_EcInfo{ m.ObjectPart = &GetResponse_Body_EcInfo{
EcInfo: v, EcInfo: v,
} }
@ -282,8 +282,8 @@ func (m *HeadResponse_Body) SetSplitInfo(v *SplitInfo) {
} }
} }
// SetECInfo sets meta info about the erasure coded object. // SetEcInfo sets meta info about the erasure coded object.
func (m *HeadResponse_Body) SetECInfo(v *ECInfo) { func (m *HeadResponse_Body) SetEcInfo(v *ECInfo) {
m.Head = &HeadResponse_Body_EcInfo{ m.Head = &HeadResponse_Body_EcInfo{
EcInfo: v, EcInfo: v,
} }
@ -435,8 +435,8 @@ func (m *GetRangeResponse_Body) SetSplitInfo(v *SplitInfo) {
} }
} }
// SetECInfo sets meta info about the erasure-coded object. // SetEcInfo sets meta info about the erasure-coded object.
func (m *GetRangeResponse_Body) SetECInfo(v *ECInfo) { func (m *GetRangeResponse_Body) SetEcInfo(v *ECInfo) {
m.RangePart = &GetRangeResponse_Body_EcInfo{ m.RangePart = &GetRangeResponse_Body_EcInfo{
EcInfo: v, EcInfo: v,
} }

View file

@ -196,7 +196,7 @@ func (c *Checksum) ToGRPCMessage() grpc.Message {
if c != nil { if c != nil {
m = new(refs.Checksum) m = new(refs.Checksum)
m.SetChecksumType(ChecksumTypeToGRPC(c.typ)) m.SetType(ChecksumTypeToGRPC(c.typ))
m.SetSum(c.sum) m.SetSum(c.sum)
} }

View file

@ -25,8 +25,8 @@ func (x *Address) SetObjectId(v *ObjectID) {
x.ObjectId = v x.ObjectId = v
} }
// SetChecksumType in generic checksum structure. // SetType in generic checksum structure.
func (x *Checksum) SetChecksumType(v ChecksumType) { func (x *Checksum) SetType(v ChecksumType) {
x.Type = v x.Type = v
} }

View file

@ -383,7 +383,7 @@ func (r *RequestMetaHeader) ToGRPCMessage() grpc.Message {
m.SetEpoch(r.epoch) m.SetEpoch(r.epoch)
m.SetTtl(r.ttl) m.SetTtl(r.ttl)
m.SetOrigin(r.origin.ToGRPCMessage().(*session.RequestMetaHeader)) m.SetOrigin(r.origin.ToGRPCMessage().(*session.RequestMetaHeader))
m.SetNetworkMagic(r.netMagic) m.SetMagicNumber(r.netMagic)
} }
return m return m
@ -674,7 +674,10 @@ func (c *ObjectSessionContext) ToGRPCMessage() grpc.Message {
m = new(session.ObjectSessionContext) m = new(session.ObjectSessionContext)
m.SetVerb(ObjectSessionVerbToGRPCField(c.verb)) m.SetVerb(ObjectSessionVerbToGRPCField(c.verb))
m.SetTarget(c.cnr.ToGRPCMessage().(*refsGRPC.ContainerID), refs.ObjectIDListToGRPCMessage(c.objs)) m.SetTarget(&session.ObjectSessionContext_Target{
Container: c.cnr.ToGRPCMessage().(*refsGRPC.ContainerID),
Objects: refs.ObjectIDListToGRPCMessage(c.objs),
})
} }
return m return m
@ -724,9 +727,9 @@ func (t *TokenBody) ToGRPCMessage() grpc.Message {
case nil: case nil:
m.Context = nil m.Context = nil
case *ObjectSessionContext: case *ObjectSessionContext:
m.SetObjectSessionContext(typ.ToGRPCMessage().(*session.ObjectSessionContext)) m.SetObject(typ.ToGRPCMessage().(*session.ObjectSessionContext))
case *ContainerSessionContext: case *ContainerSessionContext:
m.SetContainerSessionContext(typ.ToGRPCMessage().(*session.ContainerSessionContext)) m.SetContainer(typ.ToGRPCMessage().(*session.ContainerSessionContext))
} }
m.SetOwnerId(t.ownerID.ToGRPCMessage().(*refsGRPC.OwnerID)) m.SetOwnerId(t.ownerID.ToGRPCMessage().(*refsGRPC.OwnerID))

View file

@ -52,25 +52,22 @@ func (m *SessionToken_Body) SetSessionKey(v []byte) {
} }
// SetObjectAddressContext sets object context of the session token. // SetObjectAddressContext sets object context of the session token.
func (m *SessionToken_Body) SetObjectSessionContext(v *ObjectSessionContext) { func (m *SessionToken_Body) SetObject(v *ObjectSessionContext) {
m.Context = &SessionToken_Body_Object{ m.Context = &SessionToken_Body_Object{
Object: v, Object: v,
} }
} }
// SetContainerSessionContext sets container context of the session token. // SetContainer sets container context of the session token.
func (m *SessionToken_Body) SetContainerSessionContext(v *ContainerSessionContext) { func (m *SessionToken_Body) SetContainer(v *ContainerSessionContext) {
m.Context = &SessionToken_Body_Container{ m.Context = &SessionToken_Body_Container{
Container: v, Container: v,
} }
} }
// SetTarget specifies objects involved in the object session. // SetTarget specifies objects involved in the object session.
func (m *ObjectSessionContext) SetTarget(cnr *refs.ContainerID, objs []*refs.ObjectID) { func (m *ObjectSessionContext) SetTarget(tgt *ObjectSessionContext_Target) {
m.Target = &ObjectSessionContext_Target{ m.Target = tgt
Container: cnr,
Objects: objs,
}
} }
// SetVerb sets type of request for which the token is issued. // SetVerb sets type of request for which the token is issued.
@ -147,8 +144,8 @@ func (m *RequestMetaHeader) GetNetworkMagic() uint64 {
return 0 return 0
} }
// SetNetworkMagic sets NeoFS network magic. // SetMagicNumber sets NeoFS network magic.
func (m *RequestMetaHeader) SetNetworkMagic(v uint64) { func (m *RequestMetaHeader) SetMagicNumber(v uint64) {
m.MagicNumber = v m.MagicNumber = v
} }