forked from TrueCloudLab/frostfs-sdk-go
[#315] netmap: Add maintenance mode network setting
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
4662d39886
commit
3dad44232e
2 changed files with 39 additions and 2 deletions
|
@ -75,7 +75,8 @@ func (x *NetworkInfo) readFromV2(m netmap.NetworkInfo, checkFieldPresence bool)
|
|||
configMaxObjSize,
|
||||
configWithdrawalFee:
|
||||
_, err = decodeConfigValueUint64(prm.GetValue())
|
||||
case configHomomorphicHashingDisabled:
|
||||
case configHomomorphicHashingDisabled,
|
||||
configMaintenanceModeAllowed:
|
||||
_, err = decodeConfigValueBool(prm.GetValue())
|
||||
}
|
||||
|
||||
|
@ -247,7 +248,8 @@ func (x *NetworkInfo) IterateRawNetworkParameters(f func(name string, value []by
|
|||
configIRCandidateFee,
|
||||
configMaxObjSize,
|
||||
configWithdrawalFee,
|
||||
configHomomorphicHashingDisabled:
|
||||
configHomomorphicHashingDisabled,
|
||||
configMaintenanceModeAllowed:
|
||||
}
|
||||
|
||||
return false
|
||||
|
@ -522,3 +524,20 @@ func (x *NetworkInfo) DisableHomomorphicHashing() {
|
|||
func (x NetworkInfo) HomomorphicHashingDisabled() bool {
|
||||
return x.configBool(configHomomorphicHashingDisabled)
|
||||
}
|
||||
|
||||
const configMaintenanceModeAllowed = "MaintenanceModeAllowed"
|
||||
|
||||
// AllowMaintenanceMode sets the flag allowing nodes to go into maintenance mode.
|
||||
//
|
||||
// See also MaintenanceModeAllowed.
|
||||
func (x *NetworkInfo) AllowMaintenanceMode() {
|
||||
x.setConfigBool(configMaintenanceModeAllowed, true)
|
||||
}
|
||||
|
||||
// MaintenanceModeAllowed returns true iff network config allows
|
||||
// maintenance mode for storage nodes.
|
||||
//
|
||||
// Zero NetworkInfo has disallows maintenance mode.
|
||||
func (x NetworkInfo) MaintenanceModeAllowed() bool {
|
||||
return x.configBool(configMaintenanceModeAllowed)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue