From eaecc438f853f7a627adafb468ee27f2a7da5dcd Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 19 Oct 2021 18:14:23 +0300 Subject: [PATCH] [#932] neofs-cli: Support `ContainerAliasFee` global config parameter Signed-off-by: Alex Vanin --- cmd/neofs-cli/modules/netmap.go | 4 +++ pkg/morph/client/netmap/wrapper/config.go | 33 ++++++++++++++++------- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/cmd/neofs-cli/modules/netmap.go b/cmd/neofs-cli/modules/netmap.go index 3f2ec88e1..2364e7d41 100644 --- a/cmd/neofs-cli/modules/netmap.go +++ b/cmd/neofs-cli/modules/netmap.go @@ -128,6 +128,10 @@ func (x *netCfgWriter) ContainerFee(v uint64) { x.print("Container fee", v, false) } +func (x *netCfgWriter) ContainerAliasFee(v uint64) { + x.print("Container alias fee", v, false) +} + func (x *netCfgWriter) EigenTrustIterations(v uint64) { x.print("Number EigenTrust of iterations", v, false) } diff --git a/pkg/morph/client/netmap/wrapper/config.go b/pkg/morph/client/netmap/wrapper/config.go index 6e31b97e9..32c90aa0b 100644 --- a/pkg/morph/client/netmap/wrapper/config.go +++ b/pkg/morph/client/netmap/wrapper/config.go @@ -9,15 +9,16 @@ import ( ) const ( - maxObjectSizeConfig = "MaxObjectSize" - basicIncomeRateConfig = "BasicIncomeRate" - auditFeeConfig = "AuditFee" - epochDurationConfig = "EpochDuration" - containerFeeConfig = "ContainerFee" - etIterationsConfig = "EigenTrustIterations" - etAlphaConfig = "EigenTrustAlpha" - irCandidateFeeConfig = "InnerRingCandidateFee" - withdrawFeeConfig = "WithdrawFee" + maxObjectSizeConfig = "MaxObjectSize" + basicIncomeRateConfig = "BasicIncomeRate" + auditFeeConfig = "AuditFee" + epochDurationConfig = "EpochDuration" + containerFeeConfig = "ContainerFee" + containerAliasFeeConfig = "ContainerAliasFee" + etIterationsConfig = "EigenTrustIterations" + etAlphaConfig = "EigenTrustAlpha" + irCandidateFeeConfig = "InnerRingCandidateFee" + withdrawFeeConfig = "WithdrawFee" ) // MaxObjectSize receives max object size configuration @@ -74,6 +75,17 @@ func (w *Wrapper) ContainerFee() (uint64, error) { return fee, nil } +// ContainerAliasFee returns additional fee paid by container owner to each +// alphabet node for container nice name registration. +func (w *Wrapper) ContainerAliasFee() (uint64, error) { + fee, err := w.readUInt64Config(containerAliasFeeConfig) + if err != nil { + return 0, fmt.Errorf("(%T) could not get container alias fee: %w", w, err) + } + + return fee, nil +} + // EigenTrustIterations returns global configuration value of iteration cycles // for EigenTrust algorithm per epoch. func (w *Wrapper) EigenTrustIterations() (uint64, error) { @@ -185,6 +197,7 @@ type ConfigWriter interface { AuditFee(uint64) EpochDuration(uint64) ContainerFee(uint64) + ContainerAliasFee(uint64) EigenTrustIterations(uint64) EigenTrustAlpha(float64) InnerRingCandidateFee(uint64) @@ -209,6 +222,8 @@ func WriteConfig(dst ConfigWriter, iterator func(func(key, val []byte) error) er dst.EpochDuration(bigint.FromBytes(val).Uint64()) case containerFeeConfig: dst.ContainerFee(bigint.FromBytes(val).Uint64()) + case containerAliasFeeConfig: + dst.ContainerAliasFee(bigint.FromBytes(val).Uint64()) case etIterationsConfig: dst.EigenTrustIterations(bigint.FromBytes(val).Uint64()) case etAlphaConfig: