forked from TrueCloudLab/frostfs-node
[#833] morph/netmap: Support ListConfig contract method
Implement `Client.ListConfig` method which calls `listConfig` method of Netmap contract. Implement `Wrapper.IterateConfigParameters` method which uses previous one. Implement `wrapper.WriteConfig` helper function which allows to interpret parameters by names. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
cb22e2bf29
commit
7582689de4
3 changed files with 156 additions and 1 deletions
|
@ -43,7 +43,8 @@ type cfg struct {
|
|||
lastEpochBlockMethod, // get last epoch number method name
|
||||
updateInnerRing, // update innerring method name
|
||||
setConfigMethod, // set config method name
|
||||
configMethod string // get config value method name
|
||||
configMethod, // get config value method name
|
||||
configListMethod string // list config method name
|
||||
}
|
||||
|
||||
const (
|
||||
|
@ -61,6 +62,8 @@ const (
|
|||
defaultUpdateStateMethod = "updateState" // default update state method name
|
||||
|
||||
defaultEpochSnapshotMethod = "snapshotByEpoch" // default get network map snapshot by epoch method name
|
||||
|
||||
defaultConfigListMethod = "listConfig" // default config listing method name
|
||||
)
|
||||
|
||||
func defaultConfig() *cfg {
|
||||
|
@ -78,6 +81,7 @@ func defaultConfig() *cfg {
|
|||
updateStateMethod: defaultUpdateStateMethod,
|
||||
updateInnerRing: defaultUpdateInnerRingMethod,
|
||||
epochSnapshotMethod: defaultEpochSnapshotMethod,
|
||||
configListMethod: defaultConfigListMethod,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -214,3 +218,17 @@ func WithEpochSnapshotMethod(n string) Option {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// WithConfigListMethod returns a client constructor option that
|
||||
// specifies the config listing method name.
|
||||
//
|
||||
// Ignores empty value.
|
||||
//
|
||||
// If option not provided, "listConfig" is used.
|
||||
func WithConfigListMethod(n string) Option {
|
||||
return func(c *cfg) {
|
||||
if n != "" {
|
||||
c.configListMethod = n
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue