[#1681] morph/netmap: Support MaintenanceModeAllowed
config
After recent changes in the NeoFS API protocol network configuration contains `MaintenanceModeAllowed` boolean flag. There is a need to support the config value in all NeoFS applications. Provide `Client.MaintenanceModeAllowed` method which read the config from the Sidechain. Extend `NetworkConfiguration` structure with `MaintenanceModeAllowed` field. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
d2d4191868
commit
0826310b2a
1 changed files with 14 additions and 0 deletions
|
@ -22,6 +22,7 @@ const (
|
||||||
irCandidateFeeConfig = "InnerRingCandidateFee"
|
irCandidateFeeConfig = "InnerRingCandidateFee"
|
||||||
withdrawFeeConfig = "WithdrawFee"
|
withdrawFeeConfig = "WithdrawFee"
|
||||||
homomorphicHashingDisabledKey = "HomomorphicHashingDisabled"
|
homomorphicHashingDisabledKey = "HomomorphicHashingDisabled"
|
||||||
|
maintenanceModeAllowedConfig = "MaintenanceModeAllowed"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MaxObjectSize receives max object size configuration
|
// MaxObjectSize receives max object size configuration
|
||||||
|
@ -141,6 +142,15 @@ func (c *Client) WithdrawFee() (uint64, error) {
|
||||||
return fee, nil
|
return fee, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MaintenanceModeAllowed reads admission of "maintenance" state from the
|
||||||
|
// NeoFS network configuration stored in the Sidechain. The admission means
|
||||||
|
// that storage nodes are allowed to switch their state to "maintenance".
|
||||||
|
//
|
||||||
|
// By default, maintenance state is disallowed.
|
||||||
|
func (c *Client) MaintenanceModeAllowed() (bool, error) {
|
||||||
|
return c.readBoolConfig(maintenanceModeAllowedConfig)
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Client) readUInt64Config(key string) (uint64, error) {
|
func (c *Client) readUInt64Config(key string) (uint64, error) {
|
||||||
v, err := c.config([]byte(key), IntegerAssert)
|
v, err := c.config([]byte(key), IntegerAssert)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -246,6 +256,8 @@ type NetworkConfiguration struct {
|
||||||
|
|
||||||
HomomorphicHashingDisabled bool
|
HomomorphicHashingDisabled bool
|
||||||
|
|
||||||
|
MaintenanceModeAllowed bool
|
||||||
|
|
||||||
Raw []RawNetworkParameter
|
Raw []RawNetworkParameter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,6 +324,8 @@ func (c *Client) ReadNetworkConfiguration() (NetworkConfiguration, error) {
|
||||||
res.WithdrawalFee = bytesToUint64(value)
|
res.WithdrawalFee = bytesToUint64(value)
|
||||||
case homomorphicHashingDisabledKey:
|
case homomorphicHashingDisabledKey:
|
||||||
res.HomomorphicHashingDisabled = bytesToBool(value)
|
res.HomomorphicHashingDisabled = bytesToBool(value)
|
||||||
|
case maintenanceModeAllowedConfig:
|
||||||
|
res.MaintenanceModeAllowed = bytesToBool(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in a new issue