[#60] object/put: Provide network State interface to formatter

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-10-21 18:11:50 +03:00 committed by Alex Vanin
parent b627814dd8
commit 16a5107ef1
2 changed files with 9 additions and 0 deletions

View file

@ -40,6 +40,8 @@ type cfg struct {
fmtValidator *object.FormatValidator fmtValidator *object.FormatValidator
fmtValidatorOpts []object.FormatValidatorOption fmtValidatorOpts []object.FormatValidatorOption
networkState netmap.State
} }
func defaultCfg() *cfg { func defaultCfg() *cfg {
@ -116,3 +118,9 @@ func WithFormatValidatorOpts(v ...object.FormatValidatorOption) Option {
c.fmtValidatorOpts = v c.fmtValidatorOpts = v
} }
} }
func WithNetworkState(v netmap.State) Option {
return func(c *cfg) {
c.networkState = v
}
}

View file

@ -73,6 +73,7 @@ func (p *Streamer) initTarget(prm *PutInitPrm) error {
Key: sessionKey, Key: sessionKey,
NextTarget: p.newCommonTarget(prm), NextTarget: p.newCommonTarget(prm),
SessionToken: sToken, SessionToken: sToken,
NetworkState: p.networkState,
}) })
}, },
) )