forked from TrueCloudLab/frostfs-node
[#1613] morph: Add tracing for morph queries to neo-go
Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
This commit is contained in:
parent
4de5fca547
commit
9b113c3156
120 changed files with 623 additions and 562 deletions
|
@ -25,8 +25,8 @@ const (
|
|||
|
||||
// MaxObjectSize receives max object size configuration
|
||||
// value through the Netmap contract call.
|
||||
func (c *Client) MaxObjectSize() (uint64, error) {
|
||||
objectSize, err := c.readUInt64Config(MaxObjectSizeConfig)
|
||||
func (c *Client) MaxObjectSize(ctx context.Context) (uint64, error) {
|
||||
objectSize, err := c.readUInt64Config(ctx, MaxObjectSizeConfig)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
@ -35,8 +35,8 @@ func (c *Client) MaxObjectSize() (uint64, error) {
|
|||
}
|
||||
|
||||
// EpochDuration returns number of sidechain blocks per one FrostFS epoch.
|
||||
func (c *Client) EpochDuration() (uint64, error) {
|
||||
epochDuration, err := c.readUInt64Config(EpochDurationConfig)
|
||||
func (c *Client) EpochDuration(ctx context.Context) (uint64, error) {
|
||||
epochDuration, err := c.readUInt64Config(ctx, EpochDurationConfig)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
@ -46,8 +46,8 @@ func (c *Client) EpochDuration() (uint64, error) {
|
|||
|
||||
// ContainerFee returns fee paid by container owner to each alphabet node
|
||||
// for container registration.
|
||||
func (c *Client) ContainerFee() (uint64, error) {
|
||||
fee, err := c.readUInt64Config(ContainerFeeConfig)
|
||||
func (c *Client) ContainerFee(ctx context.Context) (uint64, error) {
|
||||
fee, err := c.readUInt64Config(ctx, ContainerFeeConfig)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
@ -57,8 +57,8 @@ func (c *Client) ContainerFee() (uint64, error) {
|
|||
|
||||
// ContainerAliasFee returns additional fee paid by container owner to each
|
||||
// alphabet node for container nice name registration.
|
||||
func (c *Client) ContainerAliasFee() (uint64, error) {
|
||||
fee, err := c.readUInt64Config(ContainerAliasFeeConfig)
|
||||
func (c *Client) ContainerAliasFee(ctx context.Context) (uint64, error) {
|
||||
fee, err := c.readUInt64Config(ctx, ContainerAliasFeeConfig)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
@ -70,14 +70,14 @@ func (c *Client) ContainerAliasFee() (uint64, error) {
|
|||
// settings.
|
||||
//
|
||||
// Returns (false, nil) if config key is not found in the contract.
|
||||
func (c *Client) HomomorphicHashDisabled() (bool, error) {
|
||||
return c.readBoolConfig(HomomorphicHashingDisabledKey)
|
||||
func (c *Client) HomomorphicHashDisabled(ctx context.Context) (bool, error) {
|
||||
return c.readBoolConfig(ctx, HomomorphicHashingDisabledKey)
|
||||
}
|
||||
|
||||
// InnerRingCandidateFee returns global configuration value of fee paid by
|
||||
// node to be in inner ring candidates list.
|
||||
func (c *Client) InnerRingCandidateFee() (uint64, error) {
|
||||
fee, err := c.readUInt64Config(IrCandidateFeeConfig)
|
||||
func (c *Client) InnerRingCandidateFee(ctx context.Context) (uint64, error) {
|
||||
fee, err := c.readUInt64Config(ctx, IrCandidateFeeConfig)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
@ -87,8 +87,8 @@ func (c *Client) InnerRingCandidateFee() (uint64, error) {
|
|||
|
||||
// WithdrawFee returns global configuration value of fee paid by user to
|
||||
// withdraw assets from FrostFS contract.
|
||||
func (c *Client) WithdrawFee() (uint64, error) {
|
||||
fee, err := c.readUInt64Config(WithdrawFeeConfig)
|
||||
func (c *Client) WithdrawFee(ctx context.Context) (uint64, error) {
|
||||
fee, err := c.readUInt64Config(ctx, WithdrawFeeConfig)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
@ -101,12 +101,12 @@ func (c *Client) WithdrawFee() (uint64, error) {
|
|||
// 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) MaintenanceModeAllowed(ctx context.Context) (bool, error) {
|
||||
return c.readBoolConfig(ctx, MaintenanceModeAllowedConfig)
|
||||
}
|
||||
|
||||
func (c *Client) readUInt64Config(key string) (uint64, error) {
|
||||
v, err := c.config([]byte(key), IntegerAssert)
|
||||
func (c *Client) readUInt64Config(ctx context.Context, key string) (uint64, error) {
|
||||
v, err := c.config(ctx, []byte(key), IntegerAssert)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("read netconfig value '%s': %w", key, err)
|
||||
}
|
||||
|
@ -117,8 +117,8 @@ func (c *Client) readUInt64Config(key string) (uint64, error) {
|
|||
|
||||
// reads boolean value by the given key from the FrostFS network configuration
|
||||
// stored in the Sidechain. Returns false if key is not presented.
|
||||
func (c *Client) readBoolConfig(key string) (bool, error) {
|
||||
v, err := c.config([]byte(key), BoolAssert)
|
||||
func (c *Client) readBoolConfig(ctx context.Context, key string) (bool, error) {
|
||||
v, err := c.config(ctx, []byte(key), BoolAssert)
|
||||
if err != nil {
|
||||
if errors.Is(err, ErrConfigNotFound) {
|
||||
return false, nil
|
||||
|
@ -199,12 +199,12 @@ type NetworkConfiguration struct {
|
|||
}
|
||||
|
||||
// ReadNetworkConfiguration reads NetworkConfiguration from the FrostFS Sidechain.
|
||||
func (c *Client) ReadNetworkConfiguration() (NetworkConfiguration, error) {
|
||||
func (c *Client) ReadNetworkConfiguration(ctx context.Context) (NetworkConfiguration, error) {
|
||||
var res NetworkConfiguration
|
||||
prm := client.TestInvokePrm{}
|
||||
prm.SetMethod(configListMethod)
|
||||
|
||||
items, err := c.client.TestInvoke(prm)
|
||||
items, err := c.client.TestInvoke(ctx, prm)
|
||||
if err != nil {
|
||||
return res, fmt.Errorf("test invoke (%s): %w",
|
||||
configListMethod, err)
|
||||
|
@ -285,12 +285,12 @@ var ErrConfigNotFound = errors.New("config value not found")
|
|||
// method of FrostFS Netmap contract.
|
||||
//
|
||||
// Returns ErrConfigNotFound if config key is not found in the contract.
|
||||
func (c *Client) config(key []byte, assert func(stackitem.Item) (any, error)) (any, error) {
|
||||
func (c *Client) config(ctx context.Context, key []byte, assert func(stackitem.Item) (any, error)) (any, error) {
|
||||
prm := client.TestInvokePrm{}
|
||||
prm.SetMethod(configMethod)
|
||||
prm.SetArgs(key)
|
||||
|
||||
items, err := c.client.TestInvoke(prm)
|
||||
items, err := c.client.TestInvoke(ctx, prm)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("test invoke (%s): %w",
|
||||
configMethod, err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue