[#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
}
// nolint: funlen
func (p *Streamer) initTarget(prm *PutInitPrm) error {
// prevent re-calling
if p.target != nil {
@ -69,19 +68,26 @@ func (p *Streamer) initTarget(prm *PutInitPrm) error {
}
if prm.hdr.Signature() != nil {
p.relay = prm.relay
return p.initUntrustedTarget(prm)
}
return p.initTrustedTarget(prm)
}
// prepare untrusted-Put object target
p.target = &validatingTarget{
nextTarget: p.newCommonTarget(prm),
fmt: p.fmtValidator,
func (p *Streamer) initUntrustedTarget(prm *PutInitPrm) error {
p.relay = prm.relay
maxPayloadSz: p.maxPayloadSz,
}
// prepare untrusted-Put object target
p.target = &validatingTarget{
nextTarget: p.newCommonTarget(prm),
fmt: p.fmtValidator,
return nil
maxPayloadSz: p.maxPayloadSz,
}
return nil
}
func (p *Streamer) initTrustedTarget(prm *PutInitPrm) error {
sToken := prm.common.SessionToken()
// prepare trusted-Put object target