[#199] putsvc: Refactor streamer initialization

Resolve funlen linter for initTarget method

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2023-04-03 15:40:52 +03:00 committed by Gitea
parent 27bdddc48f
commit ece6c820e7

View file

@ -51,7 +51,6 @@ func (p *Streamer) MaxObjectSize() uint64 {
return p.maxPayloadSz return p.maxPayloadSz
} }
// nolint: funlen
func (p *Streamer) initTarget(prm *PutInitPrm) error { func (p *Streamer) initTarget(prm *PutInitPrm) error {
// prevent re-calling // prevent re-calling
if p.target != nil { if p.target != nil {
@ -69,6 +68,12 @@ func (p *Streamer) initTarget(prm *PutInitPrm) error {
} }
if prm.hdr.Signature() != nil { if prm.hdr.Signature() != nil {
return p.initUntrustedTarget(prm)
}
return p.initTrustedTarget(prm)
}
func (p *Streamer) initUntrustedTarget(prm *PutInitPrm) error {
p.relay = prm.relay p.relay = prm.relay
// prepare untrusted-Put object target // prepare untrusted-Put object target
@ -82,6 +87,7 @@ func (p *Streamer) initTarget(prm *PutInitPrm) error {
return nil return nil
} }
func (p *Streamer) initTrustedTarget(prm *PutInitPrm) error {
sToken := prm.common.SessionToken() sToken := prm.common.SessionToken()
// prepare trusted-Put object target // prepare trusted-Put object target