[#199] putsvc: Refactor streamer initialization
All checks were successful
ci/woodpecker/pr/pre-commit Pipeline was successful
All checks were successful
ci/woodpecker/pr/pre-commit Pipeline was successful
Resolve funlen linter for initTarget method Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
5b59966b6a
commit
f6614e2a0b
1 changed files with 15 additions and 9 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue