[#76] Make setter names more consistent
All checks were successful
DCO action / DCO (pull_request) Successful in 1m2s
Tests and linters / Tests (1.20) (pull_request) Successful in 1m33s
Tests and linters / Tests (1.19) (pull_request) Successful in 1m38s
Tests and linters / Lint (pull_request) Successful in 1m46s
Tests and linters / Tests with -race (pull_request) Successful in 1m44s

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

View file

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

View file

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

View file

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

View file

@ -901,7 +901,7 @@ func (r *GetResponseBody) ToGRPCMessage() grpc.Message {
case *SplitInfo:
m.SetSplitInfo(t.ToGRPCMessage().(*object.SplitInfo))
case *ECInfo:
m.SetECInfo(t.ToGRPCMessage().(*object.ECInfo))
m.SetEcInfo(t.ToGRPCMessage().(*object.ECInfo))
default:
panic(fmt.Sprintf("unknown get object part %T", t))
}
@ -1486,7 +1486,7 @@ func (r *HeadResponseBody) ToGRPCMessage() grpc.Message {
case *SplitInfo:
m.SetSplitInfo(v.ToGRPCMessage().(*object.SplitInfo))
case *ECInfo:
m.SetECInfo(v.ToGRPCMessage().(*object.ECInfo))
m.SetEcInfo(v.ToGRPCMessage().(*object.ECInfo))
default:
panic(fmt.Sprintf("unknown head part %T", v))
}
@ -1963,7 +1963,7 @@ func (r *GetRangeResponseBody) ToGRPCMessage() grpc.Message {
case *SplitInfo:
m.SetSplitInfo(v.ToGRPCMessage().(*object.SplitInfo))
case *ECInfo:
m.SetECInfo(v.ToGRPCMessage().(*object.ECInfo))
m.SetEcInfo(v.ToGRPCMessage().(*object.ECInfo))
default:
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.
func (m *GetResponse_Body) SetECInfo(v *ECInfo) {
// SetEcInfo sets part of the object payload.
func (m *GetResponse_Body) SetEcInfo(v *ECInfo) {
m.ObjectPart = &GetResponse_Body_EcInfo{
EcInfo: v,
}
@ -282,8 +282,8 @@ func (m *HeadResponse_Body) SetSplitInfo(v *SplitInfo) {
}
}
// SetECInfo sets meta info about the erasure coded object.
func (m *HeadResponse_Body) SetECInfo(v *ECInfo) {
// SetEcInfo sets meta info about the erasure coded object.
func (m *HeadResponse_Body) SetEcInfo(v *ECInfo) {
m.Head = &HeadResponse_Body_EcInfo{
EcInfo: v,
}
@ -435,8 +435,8 @@ func (m *GetRangeResponse_Body) SetSplitInfo(v *SplitInfo) {
}
}
// SetECInfo sets meta info about the erasure-coded object.
func (m *GetRangeResponse_Body) SetECInfo(v *ECInfo) {
// SetEcInfo sets meta info about the erasure-coded object.
func (m *GetRangeResponse_Body) SetEcInfo(v *ECInfo) {
m.RangePart = &GetRangeResponse_Body_EcInfo{
EcInfo: v,
}

View file

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

View file

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

View file

@ -383,7 +383,7 @@ func (r *RequestMetaHeader) ToGRPCMessage() grpc.Message {
m.SetEpoch(r.epoch)
m.SetTtl(r.ttl)
m.SetOrigin(r.origin.ToGRPCMessage().(*session.RequestMetaHeader))
m.SetNetworkMagic(r.netMagic)
m.SetMagicNumber(r.netMagic)
}
return m
@ -674,7 +674,10 @@ func (c *ObjectSessionContext) ToGRPCMessage() grpc.Message {
m = new(session.ObjectSessionContext)
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
@ -724,9 +727,9 @@ func (t *TokenBody) ToGRPCMessage() grpc.Message {
case nil:
m.Context = nil
case *ObjectSessionContext:
m.SetObjectSessionContext(typ.ToGRPCMessage().(*session.ObjectSessionContext))
m.SetObject(typ.ToGRPCMessage().(*session.ObjectSessionContext))
case *ContainerSessionContext:
m.SetContainerSessionContext(typ.ToGRPCMessage().(*session.ContainerSessionContext))
m.SetContainer(typ.ToGRPCMessage().(*session.ContainerSessionContext))
}
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.
func (m *SessionToken_Body) SetObjectSessionContext(v *ObjectSessionContext) {
func (m *SessionToken_Body) SetObject(v *ObjectSessionContext) {
m.Context = &SessionToken_Body_Object{
Object: v,
}
}
// SetContainerSessionContext sets container context of the session token.
func (m *SessionToken_Body) SetContainerSessionContext(v *ContainerSessionContext) {
// SetContainer sets container context of the session token.
func (m *SessionToken_Body) SetContainer(v *ContainerSessionContext) {
m.Context = &SessionToken_Body_Container{
Container: v,
}
}
// SetTarget specifies objects involved in the object session.
func (m *ObjectSessionContext) SetTarget(cnr *refs.ContainerID, objs []*refs.ObjectID) {
m.Target = &ObjectSessionContext_Target{
Container: cnr,
Objects: objs,
}
func (m *ObjectSessionContext) SetTarget(tgt *ObjectSessionContext_Target) {
m.Target = tgt
}
// SetVerb sets type of request for which the token is issued.
@ -147,8 +144,8 @@ func (m *RequestMetaHeader) GetNetworkMagic() uint64 {
return 0
}
// SetNetworkMagic sets NeoFS network magic.
func (m *RequestMetaHeader) SetNetworkMagic(v uint64) {
// SetMagicNumber sets NeoFS network magic.
func (m *RequestMetaHeader) SetMagicNumber(v uint64) {
m.MagicNumber = v
}