forked from TrueCloudLab/frostfs-node
[#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:
parent
27bdddc48f
commit
ece6c820e7
1 changed files with 15 additions and 9 deletions
|
@ -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,19 +68,26 @@ func (p *Streamer) initTarget(prm *PutInitPrm) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if prm.hdr.Signature() != nil {
|
if prm.hdr.Signature() != nil {
|
||||||
p.relay = prm.relay
|
return p.initUntrustedTarget(prm)
|
||||||
|
}
|
||||||
|
return p.initTrustedTarget(prm)
|
||||||
|
}
|
||||||
|
|
||||||
// prepare untrusted-Put object target
|
func (p *Streamer) initUntrustedTarget(prm *PutInitPrm) error {
|
||||||
p.target = &validatingTarget{
|
p.relay = prm.relay
|
||||||
nextTarget: p.newCommonTarget(prm),
|
|
||||||
fmt: p.fmtValidator,
|
|
||||||
|
|
||||||
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()
|
sToken := prm.common.SessionToken()
|
||||||
|
|
||||||
// prepare trusted-Put object target
|
// prepare trusted-Put object target
|
||||||
|
|
Loading…
Reference in a new issue