[#66] node: Replace interface{} with any
Signed-off-by: Alejandro Lopez <a.lopez@yadro.com>
This commit is contained in:
parent
3d873237d5
commit
cb5468abb8
67 changed files with 135 additions and 135 deletions
|
@ -140,7 +140,7 @@ func setConfigCmd(cmd *cobra.Command, args []string) error {
|
||||||
return wCtx.awaitTx()
|
return wCtx.awaitTx()
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseConfigPair(kvStr string, force bool) (key string, val interface{}, err error) {
|
func parseConfigPair(kvStr string, force bool) (key string, val any, err error) {
|
||||||
kv := strings.SplitN(kvStr, "=", 2)
|
kv := strings.SplitN(kvStr, "=", 2)
|
||||||
if len(kv) != 2 {
|
if len(kv) != 2 {
|
||||||
return "", nil, fmt.Errorf("invalid parameter format: must be 'key=val', got: %s", kvStr)
|
return "", nil, fmt.Errorf("invalid parameter format: must be 'key=val', got: %s", kvStr)
|
||||||
|
|
|
@ -167,7 +167,7 @@ func (c *initializeContext) updateContracts() error {
|
||||||
|
|
||||||
w := io2.NewBufBinWriter()
|
w := io2.NewBufBinWriter()
|
||||||
|
|
||||||
var keysParam []interface{}
|
var keysParam []any
|
||||||
|
|
||||||
// Update script size for a single-node committee is close to the maximum allowed size of 65535.
|
// Update script size for a single-node committee is close to the maximum allowed size of 65535.
|
||||||
// Because of this we want to reuse alphabet contract NEF and manifest for different updates.
|
// Because of this we want to reuse alphabet contract NEF and manifest for different updates.
|
||||||
|
@ -299,7 +299,7 @@ func (c *initializeContext) updateContracts() error {
|
||||||
func (c *initializeContext) deployContracts() error {
|
func (c *initializeContext) deployContracts() error {
|
||||||
alphaCs := c.getContract(alphabetContract)
|
alphaCs := c.getContract(alphabetContract)
|
||||||
|
|
||||||
var keysParam []interface{}
|
var keysParam []any
|
||||||
|
|
||||||
baseGroups := alphaCs.Manifest.Groups
|
baseGroups := alphaCs.Manifest.Groups
|
||||||
|
|
||||||
|
@ -510,12 +510,12 @@ func readContractsFromArchive(file io.Reader, names []string) (map[string]*contr
|
||||||
return m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func getContractDeployParameters(cs *contractState, deployData []interface{}) []interface{} {
|
func getContractDeployParameters(cs *contractState, deployData []any) []any {
|
||||||
return []interface{}{cs.RawNEF, cs.RawManifest, deployData}
|
return []any{cs.RawNEF, cs.RawManifest, deployData}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *initializeContext) getContractDeployData(ctrName string, keysParam []interface{}) []interface{} {
|
func (c *initializeContext) getContractDeployData(ctrName string, keysParam []any) []any {
|
||||||
items := make([]interface{}, 1, 6)
|
items := make([]any, 1, 6)
|
||||||
items[0] = false // notaryDisabled is false
|
items[0] = false // notaryDisabled is false
|
||||||
|
|
||||||
switch ctrName {
|
switch ctrName {
|
||||||
|
@ -551,7 +551,7 @@ func (c *initializeContext) getContractDeployData(ctrName string, keysParam []in
|
||||||
c.Contracts[netmapContract].Hash,
|
c.Contracts[netmapContract].Hash,
|
||||||
c.Contracts[containerContract].Hash)
|
c.Contracts[containerContract].Hash)
|
||||||
case netmapContract:
|
case netmapContract:
|
||||||
configParam := []interface{}{
|
configParam := []any{
|
||||||
netmapEpochKey, viper.GetInt64(epochDurationInitFlag),
|
netmapEpochKey, viper.GetInt64(epochDurationInitFlag),
|
||||||
netmapMaxObjectSizeKey, viper.GetInt64(maxObjectSizeInitFlag),
|
netmapMaxObjectSizeKey, viper.GetInt64(maxObjectSizeInitFlag),
|
||||||
netmapAuditFeeKey, viper.GetInt64(auditFeeInitFlag),
|
netmapAuditFeeKey, viper.GetInt64(auditFeeInitFlag),
|
||||||
|
@ -580,8 +580,8 @@ func (c *initializeContext) getContractDeployData(ctrName string, keysParam []in
|
||||||
return items
|
return items
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *initializeContext) getAlphabetDeployItems(i, n int) []interface{} {
|
func (c *initializeContext) getAlphabetDeployItems(i, n int) []any {
|
||||||
items := make([]interface{}, 6)
|
items := make([]any, 6)
|
||||||
items[0] = false
|
items[0] = false
|
||||||
items[1] = c.Contracts[netmapContract].Hash
|
items[1] = c.Contracts[netmapContract].Hash
|
||||||
items[2] = c.Contracts[proxyContract].Hash
|
items[2] = c.Contracts[proxyContract].Hash
|
||||||
|
|
|
@ -281,7 +281,7 @@ func nnsIsAvailable(c Client, nnsHash util.Uint160, name string) (bool, error) {
|
||||||
case *rpcclient.Client:
|
case *rpcclient.Client:
|
||||||
return ct.NNSIsAvailable(nnsHash, name)
|
return ct.NNSIsAvailable(nnsHash, name)
|
||||||
default:
|
default:
|
||||||
b, err := unwrap.Bool(invokeFunction(c, nnsHash, "isAvailable", []interface{}{name}, nil))
|
b, err := unwrap.Bool(invokeFunction(c, nnsHash, "isAvailable", []any{name}, nil))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, fmt.Errorf("`isAvailable`: invalid response: %w", err)
|
return false, fmt.Errorf("`isAvailable`: invalid response: %w", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ func (c *initializeContext) setNotaryAndAlphabetNodes() error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
var pubs []interface{}
|
var pubs []any
|
||||||
for _, acc := range c.Accounts {
|
for _, acc := range c.Accounts {
|
||||||
pubs = append(pubs, acc.PrivateKey().PublicKey().Bytes())
|
pubs = append(pubs, acc.PrivateKey().PublicKey().Bytes())
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,7 +190,7 @@ func (l *localClient) GetCommittee() (keys.PublicKeys, error) {
|
||||||
func (l *localClient) InvokeFunction(h util.Uint160, method string, sPrm []smartcontract.Parameter, ss []transaction.Signer) (*result.Invoke, error) {
|
func (l *localClient) InvokeFunction(h util.Uint160, method string, sPrm []smartcontract.Parameter, ss []transaction.Signer) (*result.Invoke, error) {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
pp := make([]interface{}, len(sPrm))
|
pp := make([]any, len(sPrm))
|
||||||
for i, p := range sPrm {
|
for i, p := range sPrm {
|
||||||
pp[i], err = smartcontract.ExpandParameterToEmitable(p)
|
pp[i], err = smartcontract.ExpandParameterToEmitable(p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -346,7 +346,7 @@ func getSigners(sender *wallet.Account, cosigners []rpcclient.SignerAccount) ([]
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *localClient) NEP17BalanceOf(h util.Uint160, acc util.Uint160) (int64, error) {
|
func (l *localClient) NEP17BalanceOf(h util.Uint160, acc util.Uint160) (int64, error) {
|
||||||
res, err := invokeFunction(l, h, "balanceOf", []interface{}{acc}, nil)
|
res, err := invokeFunction(l, h, "balanceOf", []any{acc}, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
@ -451,7 +451,7 @@ func (l *localClient) putTransactions() error {
|
||||||
return l.bc.AddBlock(b)
|
return l.bc.AddBlock(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
func invokeFunction(c Client, h util.Uint160, method string, parameters []interface{}, signers []transaction.Signer) (*result.Invoke, error) {
|
func invokeFunction(c Client, h util.Uint160, method string, parameters []any, signers []transaction.Signer) (*result.Invoke, error) {
|
||||||
w := io.NewBufBinWriter()
|
w := io.NewBufBinWriter()
|
||||||
emit.Array(w.BinWriter, parameters...)
|
emit.Array(w.BinWriter, parameters...)
|
||||||
emit.AppCallNoArgs(w.BinWriter, h, method, callflag.All)
|
emit.AppCallNoArgs(w.BinWriter, h, method, callflag.All)
|
||||||
|
|
|
@ -111,7 +111,7 @@ func depositNotary(cmd *cobra.Command, _ []string) error {
|
||||||
accHash,
|
accHash,
|
||||||
notary.Hash,
|
notary.Hash,
|
||||||
big.NewInt(int64(gasAmount)),
|
big.NewInt(int64(gasAmount)),
|
||||||
[]interface{}{nil, int64(height) + till},
|
[]any{nil, int64(height) + till},
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("could not send tx: %w", err)
|
return fmt.Errorf("could not send tx: %w", err)
|
||||||
|
|
|
@ -340,7 +340,7 @@ func manageSubnetAdmins(cmd *cobra.Command, rm bool) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// prepare call parameters
|
// prepare call parameters
|
||||||
prm := make([]interface{}, 0, 3)
|
prm := make([]any, 0, 3)
|
||||||
prm = append(prm, id.Marshal())
|
prm = append(prm, id.Marshal())
|
||||||
|
|
||||||
var method string
|
var method string
|
||||||
|
@ -742,7 +742,7 @@ func init() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testInvokeMethod(key keys.PrivateKey, method string, args ...interface{}) ([]stackitem.Item, error) {
|
func testInvokeMethod(key keys.PrivateKey, method string, args ...any) ([]stackitem.Item, error) {
|
||||||
c, err := getN3Client(viper.GetViper())
|
c, err := getN3Client(viper.GetViper())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("morph client creation: %w", err)
|
return nil, fmt.Errorf("morph client creation: %w", err)
|
||||||
|
@ -780,7 +780,7 @@ func testInvokeMethod(key keys.PrivateKey, method string, args ...interface{}) (
|
||||||
return res.Stack, nil
|
return res.Stack, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func invokeMethod(key keys.PrivateKey, tryNotary bool, method string, args ...interface{}) error {
|
func invokeMethod(key keys.PrivateKey, tryNotary bool, method string, args ...any) error {
|
||||||
c, err := getN3Client(viper.GetViper())
|
c, err := getN3Client(viper.GetViper())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("morph client creation: %w", err)
|
return fmt.Errorf("morph client creation: %w", err)
|
||||||
|
@ -821,7 +821,7 @@ func invokeMethod(key keys.PrivateKey, tryNotary bool, method string, args ...in
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func invokeNonNotary(c Client, key keys.PrivateKey, method string, args ...interface{}) error {
|
func invokeNonNotary(c Client, key keys.PrivateKey, method string, args ...any) error {
|
||||||
nnsCs, err := c.GetContractStateByID(1)
|
nnsCs, err := c.GetContractStateByID(1)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("NNS contract resolving: %w", err)
|
return fmt.Errorf("NNS contract resolving: %w", err)
|
||||||
|
@ -868,7 +868,7 @@ func invokeNonNotary(c Client, key keys.PrivateKey, method string, args ...inter
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func invokeNotary(c Client, key keys.PrivateKey, method string, notaryHash util.Uint160, args ...interface{}) error {
|
func invokeNotary(c Client, key keys.PrivateKey, method string, notaryHash util.Uint160, args ...any) error {
|
||||||
nnsCs, err := c.GetContractStateByID(1)
|
nnsCs, err := c.GetContractStateByID(1)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("NNS contract resolving: %w", err)
|
return fmt.Errorf("NNS contract resolving: %w", err)
|
||||||
|
|
|
@ -12,7 +12,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// PrintVerbose prints to the stdout if the commonflags.Verbose flag is on.
|
// PrintVerbose prints to the stdout if the commonflags.Verbose flag is on.
|
||||||
func PrintVerbose(cmd *cobra.Command, format string, a ...interface{}) {
|
func PrintVerbose(cmd *cobra.Command, format string, a ...any) {
|
||||||
if viper.GetBool(commonflags.Verbose) {
|
if viper.GetBool(commonflags.Verbose) {
|
||||||
cmd.Printf(format+"\n", a...)
|
cmd.Printf(format+"\n", a...)
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,9 +58,9 @@ func listShards(cmd *cobra.Command, _ []string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func prettyPrintShardsJSON(cmd *cobra.Command, ii []*control.ShardInfo) {
|
func prettyPrintShardsJSON(cmd *cobra.Command, ii []*control.ShardInfo) {
|
||||||
out := make([]map[string]interface{}, 0, len(ii))
|
out := make([]map[string]any, 0, len(ii))
|
||||||
for _, i := range ii {
|
for _, i := range ii {
|
||||||
out = append(out, map[string]interface{}{
|
out = append(out, map[string]any{
|
||||||
"shard_id": base58.Encode(i.Shard_ID),
|
"shard_id": base58.Encode(i.Shard_ID),
|
||||||
"mode": shardModeToString(i.GetMode()),
|
"mode": shardModeToString(i.GetMode()),
|
||||||
"metabase": i.GetMetabasePath(),
|
"metabase": i.GetMetabasePath(),
|
||||||
|
|
|
@ -127,7 +127,7 @@ type sgHeadReceiver struct {
|
||||||
prm internalclient.HeadObjectPrm
|
prm internalclient.HeadObjectPrm
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c sgHeadReceiver) Head(addr oid.Address) (interface{}, error) {
|
func (c sgHeadReceiver) Head(addr oid.Address) (any, error) {
|
||||||
c.prm.SetAddress(addr)
|
c.prm.SetAddress(addr)
|
||||||
|
|
||||||
res, err := internalclient.HeadObject(c.prm)
|
res, err := internalclient.HeadObject(c.prm)
|
||||||
|
|
|
@ -37,7 +37,7 @@ func (x *Config) Sub(name string) *Config {
|
||||||
// recommended.
|
// recommended.
|
||||||
//
|
//
|
||||||
// Returns nil if config is nil.
|
// Returns nil if config is nil.
|
||||||
func (x *Config) Value(name string) interface{} {
|
func (x *Config) Value(name string) any {
|
||||||
value := x.v.Get(strings.Join(append(x.path, name), separator))
|
value := x.v.Get(strings.Join(append(x.path, name), separator))
|
||||||
if value != nil || x.defaultPath == nil {
|
if value != nil || x.defaultPath == nil {
|
||||||
return value
|
return value
|
||||||
|
|
|
@ -50,6 +50,6 @@ func (*OnlyKeyRemoteServerInfo) ExternalAddresses() []string {
|
||||||
|
|
||||||
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
|
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
|
||||||
|
|
||||||
func PanicOnPrmValue(n string, v interface{}) {
|
func PanicOnPrmValue(n string, v any) {
|
||||||
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
|
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ type (
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func panicOnPrmValue(n string, v interface{}) {
|
func panicOnPrmValue(n string, v any) {
|
||||||
panic(fmt.Sprintf("invalid parameter %s (%T):%v", n, v, v))
|
panic(fmt.Sprintf("invalid parameter %s (%T):%v", n, v, v))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ func TestDeleteBigObject(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkGetError(t *testing.T, e *StorageEngine, addr oid.Address, expected interface{}) {
|
func checkGetError(t *testing.T, e *StorageEngine, addr oid.Address, expected any) {
|
||||||
var getPrm GetPrm
|
var getPrm GetPrm
|
||||||
getPrm.WithAddress(addr)
|
getPrm.WithAddress(addr)
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ func Write(logger *logger.Logger, fields ...zap.Field) {
|
||||||
// AddressField returns logger's field for object address.
|
// AddressField returns logger's field for object address.
|
||||||
//
|
//
|
||||||
// Address should be type of *object.Address or string.
|
// Address should be type of *object.Address or string.
|
||||||
func AddressField(addr interface{}) zap.Field {
|
func AddressField(addr any) zap.Field {
|
||||||
return zap.Any("address", addr)
|
return zap.Any("address", addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -179,7 +179,7 @@ func wrapFrostFSError(err error) error {
|
||||||
|
|
||||||
// Invoke invokes contract method by sending transaction into blockchain.
|
// Invoke invokes contract method by sending transaction into blockchain.
|
||||||
// Supported args types: int64, string, util.Uint160, []byte and bool.
|
// Supported args types: int64, string, util.Uint160, []byte and bool.
|
||||||
func (c *Client) Invoke(contract util.Uint160, fee fixedn.Fixed8, method string, args ...interface{}) error {
|
func (c *Client) Invoke(contract util.Uint160, fee fixedn.Fixed8, method string, args ...any) error {
|
||||||
c.switchLock.RLock()
|
c.switchLock.RLock()
|
||||||
defer c.switchLock.RUnlock()
|
defer c.switchLock.RUnlock()
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ func (c *Client) Invoke(contract util.Uint160, fee fixedn.Fixed8, method string,
|
||||||
|
|
||||||
// TestInvoke invokes contract method locally in neo-go node. This method should
|
// TestInvoke invokes contract method locally in neo-go node. This method should
|
||||||
// be used to read data from smart-contract.
|
// be used to read data from smart-contract.
|
||||||
func (c *Client) TestInvoke(contract util.Uint160, method string, args ...interface{}) (res []stackitem.Item, err error) {
|
func (c *Client) TestInvoke(contract util.Uint160, method string, args ...any) (res []stackitem.Item, err error) {
|
||||||
c.switchLock.RLock()
|
c.switchLock.RLock()
|
||||||
defer c.switchLock.RUnlock()
|
defer c.switchLock.RUnlock()
|
||||||
|
|
||||||
|
@ -384,7 +384,7 @@ func (c *Client) roleList(r noderoles.Role) (keys.PublicKeys, error) {
|
||||||
// tries to resolve sc.Parameter from the arg.
|
// tries to resolve sc.Parameter from the arg.
|
||||||
//
|
//
|
||||||
// Wraps any error to frostfsError.
|
// Wraps any error to frostfsError.
|
||||||
func toStackParameter(value interface{}) (sc.Parameter, error) {
|
func toStackParameter(value any) (sc.Parameter, error) {
|
||||||
var result = sc.Parameter{
|
var result = sc.Parameter{
|
||||||
Value: value,
|
Value: value,
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,9 @@ import (
|
||||||
|
|
||||||
func TestToStackParameter(t *testing.T) {
|
func TestToStackParameter(t *testing.T) {
|
||||||
items := []struct {
|
items := []struct {
|
||||||
value interface{}
|
value any
|
||||||
expType sc.ParamType
|
expType sc.ParamType
|
||||||
expVal interface{}
|
expVal any
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
value: []byte{1, 2, 3},
|
value: []byte{1, 2, 3},
|
||||||
|
|
|
@ -191,7 +191,7 @@ func (c *Client) readBoolConfig(key string) (bool, error) {
|
||||||
type SetConfigPrm struct {
|
type SetConfigPrm struct {
|
||||||
id []byte
|
id []byte
|
||||||
key []byte
|
key []byte
|
||||||
value interface{}
|
value any
|
||||||
|
|
||||||
client.InvokePrmOptional
|
client.InvokePrmOptional
|
||||||
}
|
}
|
||||||
|
@ -207,7 +207,7 @@ func (s *SetConfigPrm) SetKey(key []byte) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetValue sets value of the config value.
|
// SetValue sets value of the config value.
|
||||||
func (s *SetConfigPrm) SetValue(value interface{}) {
|
func (s *SetConfigPrm) SetValue(value any) {
|
||||||
s.value = value
|
s.value = value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,7 +359,7 @@ var ErrConfigNotFound = errors.New("config value not found")
|
||||||
// method of FrostFS Netmap contract.
|
// method of FrostFS Netmap contract.
|
||||||
//
|
//
|
||||||
// Returns ErrConfigNotFound if config key is not found in the contract.
|
// Returns ErrConfigNotFound if config key is not found in the contract.
|
||||||
func (c *Client) config(key []byte, assert func(stackitem.Item) (interface{}, error)) (interface{}, error) {
|
func (c *Client) config(key []byte, assert func(stackitem.Item) (any, error)) (any, error) {
|
||||||
prm := client.TestInvokePrm{}
|
prm := client.TestInvokePrm{}
|
||||||
prm.SetMethod(configMethod)
|
prm.SetMethod(configMethod)
|
||||||
prm.SetArgs(key)
|
prm.SetArgs(key)
|
||||||
|
@ -383,17 +383,17 @@ func (c *Client) config(key []byte, assert func(stackitem.Item) (interface{}, er
|
||||||
}
|
}
|
||||||
|
|
||||||
// IntegerAssert converts stack item to int64.
|
// IntegerAssert converts stack item to int64.
|
||||||
func IntegerAssert(item stackitem.Item) (interface{}, error) {
|
func IntegerAssert(item stackitem.Item) (any, error) {
|
||||||
return client.IntFromStackItem(item)
|
return client.IntFromStackItem(item)
|
||||||
}
|
}
|
||||||
|
|
||||||
// StringAssert converts stack item to string.
|
// StringAssert converts stack item to string.
|
||||||
func StringAssert(item stackitem.Item) (interface{}, error) {
|
func StringAssert(item stackitem.Item) (any, error) {
|
||||||
return client.StringFromStackItem(item)
|
return client.StringFromStackItem(item)
|
||||||
}
|
}
|
||||||
|
|
||||||
// BoolAssert converts stack item to bool.
|
// BoolAssert converts stack item to bool.
|
||||||
func BoolAssert(item stackitem.Item) (interface{}, error) {
|
func BoolAssert(item stackitem.Item) (any, error) {
|
||||||
return client.BoolFromStackItem(item)
|
return client.BoolFromStackItem(item)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -194,7 +194,7 @@ func (c *Client) depositNotary(amount fixedn.Fixed8, till int64) (res util.Uint2
|
||||||
c.accAddr,
|
c.accAddr,
|
||||||
c.notary.notary,
|
c.notary.notary,
|
||||||
big.NewInt(int64(amount)),
|
big.NewInt(int64(amount)),
|
||||||
[]interface{}{c.acc.PrivateKey().GetScriptHash(), till})
|
[]any{c.acc.PrivateKey().GetScriptHash(), till})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !errors.Is(err, neorpc.ErrAlreadyExists) {
|
if !errors.Is(err, neorpc.ErrAlreadyExists) {
|
||||||
return util.Uint256{}, fmt.Errorf("can't make notary deposit: %w", err)
|
return util.Uint256{}, fmt.Errorf("can't make notary deposit: %w", err)
|
||||||
|
@ -354,7 +354,7 @@ func (c *Client) UpdateNeoFSAlphabetList(prm UpdateAlphabetListPrm) error {
|
||||||
// it fallbacks to a simple `Invoke()`.
|
// it fallbacks to a simple `Invoke()`.
|
||||||
//
|
//
|
||||||
// `nonce` and `vub` are used only if notary is enabled.
|
// `nonce` and `vub` are used only if notary is enabled.
|
||||||
func (c *Client) NotaryInvoke(contract util.Uint160, fee fixedn.Fixed8, nonce uint32, vub *uint32, method string, args ...interface{}) error {
|
func (c *Client) NotaryInvoke(contract util.Uint160, fee fixedn.Fixed8, nonce uint32, vub *uint32, method string, args ...any) error {
|
||||||
c.switchLock.RLock()
|
c.switchLock.RLock()
|
||||||
defer c.switchLock.RUnlock()
|
defer c.switchLock.RUnlock()
|
||||||
|
|
||||||
|
@ -374,7 +374,7 @@ func (c *Client) NotaryInvoke(contract util.Uint160, fee fixedn.Fixed8, nonce ui
|
||||||
// not expected to be signed by the current node.
|
// not expected to be signed by the current node.
|
||||||
//
|
//
|
||||||
// Considered to be used by non-IR nodes.
|
// Considered to be used by non-IR nodes.
|
||||||
func (c *Client) NotaryInvokeNotAlpha(contract util.Uint160, fee fixedn.Fixed8, method string, args ...interface{}) error {
|
func (c *Client) NotaryInvokeNotAlpha(contract util.Uint160, fee fixedn.Fixed8, method string, args ...any) error {
|
||||||
c.switchLock.RLock()
|
c.switchLock.RLock()
|
||||||
defer c.switchLock.RUnlock()
|
defer c.switchLock.RUnlock()
|
||||||
|
|
||||||
|
@ -440,12 +440,12 @@ func (c *Client) NotarySignAndInvokeTX(mainTx *transaction.Transaction) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) notaryInvokeAsCommittee(method string, nonce, vub uint32, args ...interface{}) error {
|
func (c *Client) notaryInvokeAsCommittee(method string, nonce, vub uint32, args ...any) error {
|
||||||
designate := c.GetDesignateHash()
|
designate := c.GetDesignateHash()
|
||||||
return c.notaryInvoke(true, true, designate, nonce, &vub, method, args...)
|
return c.notaryInvoke(true, true, designate, nonce, &vub, method, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) notaryInvoke(committee, invokedByAlpha bool, contract util.Uint160, nonce uint32, vub *uint32, method string, args ...interface{}) error {
|
func (c *Client) notaryInvoke(committee, invokedByAlpha bool, contract util.Uint160, nonce uint32, vub *uint32, method string, args ...any) error {
|
||||||
alphabetList, err := c.notary.alphabetSource() // prepare arguments for test invocation
|
alphabetList, err := c.notary.alphabetSource() // prepare arguments for test invocation
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -750,7 +750,7 @@ func (c *Client) depositExpirationOf() (int64, error) {
|
||||||
return currentTillBig.Int64(), nil
|
return currentTillBig.Int64(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func invocationParams(args ...interface{}) ([]sc.Parameter, error) {
|
func invocationParams(args ...any) ([]sc.Parameter, error) {
|
||||||
params := make([]sc.Parameter, 0, len(args))
|
params := make([]sc.Parameter, 0, len(args))
|
||||||
|
|
||||||
for i := range args {
|
for i := range args {
|
||||||
|
|
|
@ -151,7 +151,7 @@ func (s StaticClient) Invoke(prm InvokePrm) error {
|
||||||
// TestInvokePrm groups parameters of the TestInvoke operation.
|
// TestInvokePrm groups parameters of the TestInvoke operation.
|
||||||
type TestInvokePrm struct {
|
type TestInvokePrm struct {
|
||||||
method string
|
method string
|
||||||
args []interface{}
|
args []any
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetMethod sets method of the contract to call.
|
// SetMethod sets method of the contract to call.
|
||||||
|
@ -160,7 +160,7 @@ func (ti *TestInvokePrm) SetMethod(method string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetArgs sets arguments of the contact call.
|
// SetArgs sets arguments of the contact call.
|
||||||
func (ti *TestInvokePrm) SetArgs(args ...interface{}) {
|
func (ti *TestInvokePrm) SetArgs(args ...any) {
|
||||||
ti.args = args
|
ti.args = args
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ type ManageAdminsRes struct{}
|
||||||
func (x Client) ManageAdmins(prm ManageAdminsPrm) (*ManageAdminsPrm, error) {
|
func (x Client) ManageAdmins(prm ManageAdminsPrm) (*ManageAdminsPrm, error) {
|
||||||
var method string
|
var method string
|
||||||
|
|
||||||
args := make([]interface{}, 1, 3)
|
args := make([]any, 1, 3)
|
||||||
args[0] = prm.subnet
|
args[0] = prm.subnet
|
||||||
|
|
||||||
if prm.client {
|
if prm.client {
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
|
|
||||||
// UserAllowedPrm groups parameters of UserAllowed method of Subnet contract.
|
// UserAllowedPrm groups parameters of UserAllowed method of Subnet contract.
|
||||||
type UserAllowedPrm struct {
|
type UserAllowedPrm struct {
|
||||||
args [2]interface{}
|
args [2]any
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetID sets identifier of the subnet in a binary FrostFS API protocol format.
|
// SetID sets identifier of the subnet in a binary FrostFS API protocol format.
|
||||||
|
@ -64,7 +64,7 @@ type ManageClientsPrm struct {
|
||||||
// remove or add client
|
// remove or add client
|
||||||
rm bool
|
rm bool
|
||||||
|
|
||||||
args [3]interface{}
|
args [3]any
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetRemove marks client to be removed. By default, client is added.
|
// SetRemove marks client to be removed. By default, client is added.
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
type DeletePrm struct {
|
type DeletePrm struct {
|
||||||
cliPrm client.InvokePrm
|
cliPrm client.InvokePrm
|
||||||
|
|
||||||
args [1]interface{}
|
args [1]any
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetTxHash sets hash of the transaction which spawned the notification.
|
// SetTxHash sets hash of the transaction which spawned the notification.
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
|
|
||||||
// GetPrm groups parameters of Get method of Subnet contract.
|
// GetPrm groups parameters of Get method of Subnet contract.
|
||||||
type GetPrm struct {
|
type GetPrm struct {
|
||||||
args [1]interface{}
|
args [1]any
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetID sets identifier of the subnet to be read in a binary FrostFS API protocol format.
|
// SetID sets identifier of the subnet to be read in a binary FrostFS API protocol format.
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
type NodeAllowedPrm struct {
|
type NodeAllowedPrm struct {
|
||||||
cliPrm client.TestInvokePrm
|
cliPrm client.TestInvokePrm
|
||||||
|
|
||||||
args [2]interface{}
|
args [2]any
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetID sets identifier of the subnet of the node in a binary FrostFS API protocol format.
|
// SetID sets identifier of the subnet of the node in a binary FrostFS API protocol format.
|
||||||
|
|
|
@ -9,7 +9,7 @@ type ManageNodesPrm struct {
|
||||||
// remove or add node
|
// remove or add node
|
||||||
rm bool
|
rm bool
|
||||||
|
|
||||||
args [2]interface{}
|
args [2]any
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetRemove marks node to be removed. By default, node is added.
|
// SetRemove marks node to be removed. By default, node is added.
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
type PutPrm struct {
|
type PutPrm struct {
|
||||||
cliPrm client.InvokePrm
|
cliPrm client.InvokePrm
|
||||||
|
|
||||||
args [3]interface{}
|
args [3]any
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetTxHash sets hash of the transaction which spawned the notification.
|
// SetTxHash sets hash of the transaction which spawned the notification.
|
||||||
|
|
|
@ -341,7 +341,7 @@ func TestPrepare_CorrectNR(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
hash util.Uint160
|
hash util.Uint160
|
||||||
method string
|
method string
|
||||||
args []interface{}
|
args []any
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
scriptHash,
|
scriptHash,
|
||||||
|
@ -351,10 +351,10 @@ func TestPrepare_CorrectNR(t *testing.T) {
|
||||||
{
|
{
|
||||||
scriptHash,
|
scriptHash,
|
||||||
"test2",
|
"test2",
|
||||||
[]interface{}{
|
[]any{
|
||||||
int64(4),
|
int64(4),
|
||||||
"test",
|
"test",
|
||||||
[]interface{}{
|
[]any{
|
||||||
int64(4),
|
int64(4),
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
|
@ -416,7 +416,7 @@ func alphaKeysSource() client.AlphabetKeys {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func script(hash util.Uint160, method string, args ...interface{}) []byte {
|
func script(hash util.Uint160, method string, args ...any) []byte {
|
||||||
bw := io.NewBufBinWriter()
|
bw := io.NewBufBinWriter()
|
||||||
|
|
||||||
if len(args) > 0 {
|
if len(args) > 0 {
|
||||||
|
|
|
@ -25,7 +25,7 @@ func NewResponseService(accSvc Server, respSvc *response.Service) Server {
|
||||||
|
|
||||||
func (s *responseService) Balance(ctx context.Context, req *accounting.BalanceRequest) (*accounting.BalanceResponse, error) {
|
func (s *responseService) Balance(ctx context.Context, req *accounting.BalanceRequest) (*accounting.BalanceResponse, error) {
|
||||||
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
|
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
|
||||||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
func(ctx context.Context, req any) (util.ResponseMessage, error) {
|
||||||
return s.svc.Balance(ctx, req.(*accounting.BalanceRequest))
|
return s.svc.Balance(ctx, req.(*accounting.BalanceRequest))
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
@ -23,7 +23,7 @@ func NewSignService(key *ecdsa.PrivateKey, svc Server) Server {
|
||||||
|
|
||||||
func (s *signService) Balance(ctx context.Context, req *accounting.BalanceRequest) (*accounting.BalanceResponse, error) {
|
func (s *signService) Balance(ctx context.Context, req *accounting.BalanceRequest) (*accounting.BalanceResponse, error) {
|
||||||
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
|
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
|
||||||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
func(ctx context.Context, req any) (util.ResponseMessage, error) {
|
||||||
return s.svc.Balance(ctx, req.(*accounting.BalanceRequest))
|
return s.svc.Balance(ctx, req.(*accounting.BalanceRequest))
|
||||||
},
|
},
|
||||||
func() util.ResponseMessage {
|
func() util.ResponseMessage {
|
||||||
|
|
|
@ -57,7 +57,7 @@ type Controller struct {
|
||||||
|
|
||||||
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
|
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
|
||||||
|
|
||||||
func panicOnPrmValue(n string, v interface{}) {
|
func panicOnPrmValue(n string, v any) {
|
||||||
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
|
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ type Builder struct {
|
||||||
|
|
||||||
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
|
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
|
||||||
|
|
||||||
func panicOnPrmValue(n string, v interface{}) {
|
func panicOnPrmValue(n string, v any) {
|
||||||
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
|
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ type Router struct {
|
||||||
|
|
||||||
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
|
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
|
||||||
|
|
||||||
func panicOnPrmValue(n string, v interface{}) {
|
func panicOnPrmValue(n string, v any) {
|
||||||
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
|
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ func NewResponseService(cnrSvc Server, respSvc *response.Service) Server {
|
||||||
|
|
||||||
func (s *responseService) Put(ctx context.Context, req *container.PutRequest) (*container.PutResponse, error) {
|
func (s *responseService) Put(ctx context.Context, req *container.PutRequest) (*container.PutResponse, error) {
|
||||||
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
|
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
|
||||||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
func(ctx context.Context, req any) (util.ResponseMessage, error) {
|
||||||
return s.svc.Put(ctx, req.(*container.PutRequest))
|
return s.svc.Put(ctx, req.(*container.PutRequest))
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -38,7 +38,7 @@ func (s *responseService) Put(ctx context.Context, req *container.PutRequest) (*
|
||||||
|
|
||||||
func (s *responseService) Delete(ctx context.Context, req *container.DeleteRequest) (*container.DeleteResponse, error) {
|
func (s *responseService) Delete(ctx context.Context, req *container.DeleteRequest) (*container.DeleteResponse, error) {
|
||||||
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
|
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
|
||||||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
func(ctx context.Context, req any) (util.ResponseMessage, error) {
|
||||||
return s.svc.Delete(ctx, req.(*container.DeleteRequest))
|
return s.svc.Delete(ctx, req.(*container.DeleteRequest))
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -51,7 +51,7 @@ func (s *responseService) Delete(ctx context.Context, req *container.DeleteReque
|
||||||
|
|
||||||
func (s *responseService) Get(ctx context.Context, req *container.GetRequest) (*container.GetResponse, error) {
|
func (s *responseService) Get(ctx context.Context, req *container.GetRequest) (*container.GetResponse, error) {
|
||||||
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
|
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
|
||||||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
func(ctx context.Context, req any) (util.ResponseMessage, error) {
|
||||||
return s.svc.Get(ctx, req.(*container.GetRequest))
|
return s.svc.Get(ctx, req.(*container.GetRequest))
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -64,7 +64,7 @@ func (s *responseService) Get(ctx context.Context, req *container.GetRequest) (*
|
||||||
|
|
||||||
func (s *responseService) List(ctx context.Context, req *container.ListRequest) (*container.ListResponse, error) {
|
func (s *responseService) List(ctx context.Context, req *container.ListRequest) (*container.ListResponse, error) {
|
||||||
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
|
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
|
||||||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
func(ctx context.Context, req any) (util.ResponseMessage, error) {
|
||||||
return s.svc.List(ctx, req.(*container.ListRequest))
|
return s.svc.List(ctx, req.(*container.ListRequest))
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -77,7 +77,7 @@ func (s *responseService) List(ctx context.Context, req *container.ListRequest)
|
||||||
|
|
||||||
func (s *responseService) SetExtendedACL(ctx context.Context, req *container.SetExtendedACLRequest) (*container.SetExtendedACLResponse, error) {
|
func (s *responseService) SetExtendedACL(ctx context.Context, req *container.SetExtendedACLRequest) (*container.SetExtendedACLResponse, error) {
|
||||||
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
|
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
|
||||||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
func(ctx context.Context, req any) (util.ResponseMessage, error) {
|
||||||
return s.svc.SetExtendedACL(ctx, req.(*container.SetExtendedACLRequest))
|
return s.svc.SetExtendedACL(ctx, req.(*container.SetExtendedACLRequest))
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -90,7 +90,7 @@ func (s *responseService) SetExtendedACL(ctx context.Context, req *container.Set
|
||||||
|
|
||||||
func (s *responseService) GetExtendedACL(ctx context.Context, req *container.GetExtendedACLRequest) (*container.GetExtendedACLResponse, error) {
|
func (s *responseService) GetExtendedACL(ctx context.Context, req *container.GetExtendedACLRequest) (*container.GetExtendedACLResponse, error) {
|
||||||
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
|
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
|
||||||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
func(ctx context.Context, req any) (util.ResponseMessage, error) {
|
||||||
return s.svc.GetExtendedACL(ctx, req.(*container.GetExtendedACLRequest))
|
return s.svc.GetExtendedACL(ctx, req.(*container.GetExtendedACLRequest))
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -103,7 +103,7 @@ func (s *responseService) GetExtendedACL(ctx context.Context, req *container.Get
|
||||||
|
|
||||||
func (s *responseService) AnnounceUsedSpace(ctx context.Context, req *container.AnnounceUsedSpaceRequest) (*container.AnnounceUsedSpaceResponse, error) {
|
func (s *responseService) AnnounceUsedSpace(ctx context.Context, req *container.AnnounceUsedSpaceRequest) (*container.AnnounceUsedSpaceResponse, error) {
|
||||||
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
|
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
|
||||||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
func(ctx context.Context, req any) (util.ResponseMessage, error) {
|
||||||
return s.svc.AnnounceUsedSpace(ctx, req.(*container.AnnounceUsedSpaceRequest))
|
return s.svc.AnnounceUsedSpace(ctx, req.(*container.AnnounceUsedSpaceRequest))
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
@ -23,7 +23,7 @@ func NewSignService(key *ecdsa.PrivateKey, svc Server) Server {
|
||||||
|
|
||||||
func (s *signService) Put(ctx context.Context, req *container.PutRequest) (*container.PutResponse, error) {
|
func (s *signService) Put(ctx context.Context, req *container.PutRequest) (*container.PutResponse, error) {
|
||||||
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
|
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
|
||||||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
func(ctx context.Context, req any) (util.ResponseMessage, error) {
|
||||||
return s.svc.Put(ctx, req.(*container.PutRequest))
|
return s.svc.Put(ctx, req.(*container.PutRequest))
|
||||||
},
|
},
|
||||||
func() util.ResponseMessage {
|
func() util.ResponseMessage {
|
||||||
|
@ -39,7 +39,7 @@ func (s *signService) Put(ctx context.Context, req *container.PutRequest) (*cont
|
||||||
|
|
||||||
func (s *signService) Delete(ctx context.Context, req *container.DeleteRequest) (*container.DeleteResponse, error) {
|
func (s *signService) Delete(ctx context.Context, req *container.DeleteRequest) (*container.DeleteResponse, error) {
|
||||||
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
|
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
|
||||||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
func(ctx context.Context, req any) (util.ResponseMessage, error) {
|
||||||
return s.svc.Delete(ctx, req.(*container.DeleteRequest))
|
return s.svc.Delete(ctx, req.(*container.DeleteRequest))
|
||||||
},
|
},
|
||||||
func() util.ResponseMessage {
|
func() util.ResponseMessage {
|
||||||
|
@ -55,7 +55,7 @@ func (s *signService) Delete(ctx context.Context, req *container.DeleteRequest)
|
||||||
|
|
||||||
func (s *signService) Get(ctx context.Context, req *container.GetRequest) (*container.GetResponse, error) {
|
func (s *signService) Get(ctx context.Context, req *container.GetRequest) (*container.GetResponse, error) {
|
||||||
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
|
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
|
||||||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
func(ctx context.Context, req any) (util.ResponseMessage, error) {
|
||||||
return s.svc.Get(ctx, req.(*container.GetRequest))
|
return s.svc.Get(ctx, req.(*container.GetRequest))
|
||||||
},
|
},
|
||||||
func() util.ResponseMessage {
|
func() util.ResponseMessage {
|
||||||
|
@ -71,7 +71,7 @@ func (s *signService) Get(ctx context.Context, req *container.GetRequest) (*cont
|
||||||
|
|
||||||
func (s *signService) List(ctx context.Context, req *container.ListRequest) (*container.ListResponse, error) {
|
func (s *signService) List(ctx context.Context, req *container.ListRequest) (*container.ListResponse, error) {
|
||||||
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
|
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
|
||||||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
func(ctx context.Context, req any) (util.ResponseMessage, error) {
|
||||||
return s.svc.List(ctx, req.(*container.ListRequest))
|
return s.svc.List(ctx, req.(*container.ListRequest))
|
||||||
},
|
},
|
||||||
func() util.ResponseMessage {
|
func() util.ResponseMessage {
|
||||||
|
@ -87,7 +87,7 @@ func (s *signService) List(ctx context.Context, req *container.ListRequest) (*co
|
||||||
|
|
||||||
func (s *signService) SetExtendedACL(ctx context.Context, req *container.SetExtendedACLRequest) (*container.SetExtendedACLResponse, error) {
|
func (s *signService) SetExtendedACL(ctx context.Context, req *container.SetExtendedACLRequest) (*container.SetExtendedACLResponse, error) {
|
||||||
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
|
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
|
||||||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
func(ctx context.Context, req any) (util.ResponseMessage, error) {
|
||||||
return s.svc.SetExtendedACL(ctx, req.(*container.SetExtendedACLRequest))
|
return s.svc.SetExtendedACL(ctx, req.(*container.SetExtendedACLRequest))
|
||||||
},
|
},
|
||||||
func() util.ResponseMessage {
|
func() util.ResponseMessage {
|
||||||
|
@ -103,7 +103,7 @@ func (s *signService) SetExtendedACL(ctx context.Context, req *container.SetExte
|
||||||
|
|
||||||
func (s *signService) GetExtendedACL(ctx context.Context, req *container.GetExtendedACLRequest) (*container.GetExtendedACLResponse, error) {
|
func (s *signService) GetExtendedACL(ctx context.Context, req *container.GetExtendedACLRequest) (*container.GetExtendedACLResponse, error) {
|
||||||
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
|
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
|
||||||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
func(ctx context.Context, req any) (util.ResponseMessage, error) {
|
||||||
return s.svc.GetExtendedACL(ctx, req.(*container.GetExtendedACLRequest))
|
return s.svc.GetExtendedACL(ctx, req.(*container.GetExtendedACLRequest))
|
||||||
},
|
},
|
||||||
func() util.ResponseMessage {
|
func() util.ResponseMessage {
|
||||||
|
@ -119,7 +119,7 @@ func (s *signService) GetExtendedACL(ctx context.Context, req *container.GetExte
|
||||||
|
|
||||||
func (s *signService) AnnounceUsedSpace(ctx context.Context, req *container.AnnounceUsedSpaceRequest) (*container.AnnounceUsedSpaceResponse, error) {
|
func (s *signService) AnnounceUsedSpace(ctx context.Context, req *container.AnnounceUsedSpaceRequest) (*container.AnnounceUsedSpaceResponse, error) {
|
||||||
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
|
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
|
||||||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
func(ctx context.Context, req any) (util.ResponseMessage, error) {
|
||||||
return s.svc.AnnounceUsedSpace(ctx, req.(*container.AnnounceUsedSpaceRequest))
|
return s.svc.AnnounceUsedSpace(ctx, req.(*container.AnnounceUsedSpaceRequest))
|
||||||
},
|
},
|
||||||
func() util.ResponseMessage {
|
func() util.ResponseMessage {
|
||||||
|
|
|
@ -15,7 +15,7 @@ type Server struct {
|
||||||
allowedKeys [][]byte
|
allowedKeys [][]byte
|
||||||
}
|
}
|
||||||
|
|
||||||
func panicOnPrmValue(n string, v interface{}) {
|
func panicOnPrmValue(n string, v any) {
|
||||||
const invalidPrmValFmt = "invalid %s parameter (%T): %v"
|
const invalidPrmValFmt = "invalid %s parameter (%T): %v"
|
||||||
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
|
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ func NewResponseService(nmSvc Server, respSvc *response.Service) Server {
|
||||||
|
|
||||||
func (s *responseService) LocalNodeInfo(ctx context.Context, req *netmap.LocalNodeInfoRequest) (*netmap.LocalNodeInfoResponse, error) {
|
func (s *responseService) LocalNodeInfo(ctx context.Context, req *netmap.LocalNodeInfoRequest) (*netmap.LocalNodeInfoResponse, error) {
|
||||||
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
|
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
|
||||||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
func(ctx context.Context, req any) (util.ResponseMessage, error) {
|
||||||
return s.svc.LocalNodeInfo(ctx, req.(*netmap.LocalNodeInfoRequest))
|
return s.svc.LocalNodeInfo(ctx, req.(*netmap.LocalNodeInfoRequest))
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -38,7 +38,7 @@ func (s *responseService) LocalNodeInfo(ctx context.Context, req *netmap.LocalNo
|
||||||
|
|
||||||
func (s *responseService) NetworkInfo(ctx context.Context, req *netmap.NetworkInfoRequest) (*netmap.NetworkInfoResponse, error) {
|
func (s *responseService) NetworkInfo(ctx context.Context, req *netmap.NetworkInfoRequest) (*netmap.NetworkInfoResponse, error) {
|
||||||
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
|
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
|
||||||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
func(ctx context.Context, req any) (util.ResponseMessage, error) {
|
||||||
return s.svc.NetworkInfo(ctx, req.(*netmap.NetworkInfoRequest))
|
return s.svc.NetworkInfo(ctx, req.(*netmap.NetworkInfoRequest))
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -51,7 +51,7 @@ func (s *responseService) NetworkInfo(ctx context.Context, req *netmap.NetworkIn
|
||||||
|
|
||||||
func (s *responseService) Snapshot(ctx context.Context, req *netmap.SnapshotRequest) (*netmap.SnapshotResponse, error) {
|
func (s *responseService) Snapshot(ctx context.Context, req *netmap.SnapshotRequest) (*netmap.SnapshotResponse, error) {
|
||||||
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
|
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
|
||||||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
func(ctx context.Context, req any) (util.ResponseMessage, error) {
|
||||||
return s.svc.Snapshot(ctx, req.(*netmap.SnapshotRequest))
|
return s.svc.Snapshot(ctx, req.(*netmap.SnapshotRequest))
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
@ -25,7 +25,7 @@ func (s *signService) LocalNodeInfo(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
req *netmap.LocalNodeInfoRequest) (*netmap.LocalNodeInfoResponse, error) {
|
req *netmap.LocalNodeInfoRequest) (*netmap.LocalNodeInfoResponse, error) {
|
||||||
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
|
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
|
||||||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
func(ctx context.Context, req any) (util.ResponseMessage, error) {
|
||||||
return s.svc.LocalNodeInfo(ctx, req.(*netmap.LocalNodeInfoRequest))
|
return s.svc.LocalNodeInfo(ctx, req.(*netmap.LocalNodeInfoRequest))
|
||||||
},
|
},
|
||||||
func() util.ResponseMessage {
|
func() util.ResponseMessage {
|
||||||
|
@ -41,7 +41,7 @@ func (s *signService) LocalNodeInfo(
|
||||||
|
|
||||||
func (s *signService) NetworkInfo(ctx context.Context, req *netmap.NetworkInfoRequest) (*netmap.NetworkInfoResponse, error) {
|
func (s *signService) NetworkInfo(ctx context.Context, req *netmap.NetworkInfoRequest) (*netmap.NetworkInfoResponse, error) {
|
||||||
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
|
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
|
||||||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
func(ctx context.Context, req any) (util.ResponseMessage, error) {
|
||||||
return s.svc.NetworkInfo(ctx, req.(*netmap.NetworkInfoRequest))
|
return s.svc.NetworkInfo(ctx, req.(*netmap.NetworkInfoRequest))
|
||||||
},
|
},
|
||||||
func() util.ResponseMessage {
|
func() util.ResponseMessage {
|
||||||
|
@ -57,7 +57,7 @@ func (s *signService) NetworkInfo(ctx context.Context, req *netmap.NetworkInfoRe
|
||||||
|
|
||||||
func (s *signService) Snapshot(ctx context.Context, req *netmap.SnapshotRequest) (*netmap.SnapshotResponse, error) {
|
func (s *signService) Snapshot(ctx context.Context, req *netmap.SnapshotRequest) (*netmap.SnapshotResponse, error) {
|
||||||
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
|
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
|
||||||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
func(ctx context.Context, req any) (util.ResponseMessage, error) {
|
||||||
return s.svc.Snapshot(ctx, req.(*netmap.SnapshotRequest))
|
return s.svc.Snapshot(ctx, req.(*netmap.SnapshotRequest))
|
||||||
},
|
},
|
||||||
func() util.ResponseMessage {
|
func() util.ResponseMessage {
|
||||||
|
|
|
@ -52,7 +52,7 @@ type Notificator struct {
|
||||||
// Panics if any field of the passed Prm structure is not set/set
|
// Panics if any field of the passed Prm structure is not set/set
|
||||||
// to nil.
|
// to nil.
|
||||||
func New(prm *Prm) *Notificator {
|
func New(prm *Prm) *Notificator {
|
||||||
panicOnNil := func(v interface{}, name string) {
|
panicOnNil := func(v any, name string) {
|
||||||
if v == nil {
|
if v == nil {
|
||||||
panic(fmt.Sprintf("Notificator constructor: %s is nil\n", name))
|
panic(fmt.Sprintf("Notificator constructor: %s is nil\n", name))
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ var (
|
||||||
// NewChecker creates Checker.
|
// NewChecker creates Checker.
|
||||||
// Panics if at least one of the parameter is nil.
|
// Panics if at least one of the parameter is nil.
|
||||||
func NewChecker(prm *CheckerPrm) *Checker {
|
func NewChecker(prm *CheckerPrm) *Checker {
|
||||||
panicOnNil := func(fieldName string, field interface{}) {
|
panicOnNil := func(fieldName string, field any) {
|
||||||
if field == nil {
|
if field == nil {
|
||||||
panic(fmt.Sprintf("incorrect field %s (%T): %v", fieldName, field, field))
|
panic(fmt.Sprintf("incorrect field %s (%T): %v", fieldName, field, field))
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ func (c *Checker) StickyBitCheck(info v2.RequestInfo, owner user.ID) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
// CheckEACL is a main check function for extended ACL.
|
// CheckEACL is a main check function for extended ACL.
|
||||||
func (c *Checker) CheckEACL(msg interface{}, reqInfo v2.RequestInfo) error {
|
func (c *Checker) CheckEACL(msg any, reqInfo v2.RequestInfo) error {
|
||||||
basicACL := reqInfo.BasicACL()
|
basicACL := reqInfo.BasicACL()
|
||||||
if !basicACL.Extendable() {
|
if !basicACL.Extendable() {
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -32,7 +32,7 @@ type RequestInfo struct {
|
||||||
|
|
||||||
bearer *bearer.Token // bearer token of request
|
bearer *bearer.Token // bearer token of request
|
||||||
|
|
||||||
srcRequest interface{}
|
srcRequest any
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *RequestInfo) SetBasicACL(basicACL acl.Basic) {
|
func (r *RequestInfo) SetBasicACL(basicACL acl.Basic) {
|
||||||
|
@ -48,7 +48,7 @@ func (r *RequestInfo) SetSenderKey(senderKey []byte) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Request returns raw API request.
|
// Request returns raw API request.
|
||||||
func (r RequestInfo) Request() interface{} {
|
func (r RequestInfo) Request() any {
|
||||||
return r.srcRequest
|
return r.srcRequest
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ type MetaWithToken struct {
|
||||||
vheader *sessionV2.RequestVerificationHeader
|
vheader *sessionV2.RequestVerificationHeader
|
||||||
token *sessionSDK.Object
|
token *sessionSDK.Object
|
||||||
bearer *bearer.Token
|
bearer *bearer.Token
|
||||||
src interface{}
|
src any
|
||||||
}
|
}
|
||||||
|
|
||||||
// RequestOwner returns ownerID and its public key
|
// RequestOwner returns ownerID and its public key
|
||||||
|
|
|
@ -86,7 +86,7 @@ func New(opts ...Option) Service {
|
||||||
opts[i](cfg)
|
opts[i](cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
panicOnNil := func(v interface{}, name string) {
|
panicOnNil := func(v any, name string) {
|
||||||
if v == nil {
|
if v == nil {
|
||||||
panic(fmt.Sprintf("ACL service: %s is nil", name))
|
panic(fmt.Sprintf("ACL service: %s is nil", name))
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ type ACLChecker interface {
|
||||||
CheckBasicACL(RequestInfo) bool
|
CheckBasicACL(RequestInfo) bool
|
||||||
// CheckEACL must return non-nil error if request
|
// CheckEACL must return non-nil error if request
|
||||||
// doesn't pass extended ACL validation.
|
// doesn't pass extended ACL validation.
|
||||||
CheckEACL(interface{}, RequestInfo) error
|
CheckEACL(any, RequestInfo) error
|
||||||
// StickyBitCheck must return true only if sticky bit
|
// StickyBitCheck must return true only if sticky bit
|
||||||
// is disabled or enabled but request contains correct
|
// is disabled or enabled but request contains correct
|
||||||
// owner field.
|
// owner field.
|
||||||
|
|
|
@ -20,7 +20,7 @@ import (
|
||||||
|
|
||||||
var errMissingContainerID = errors.New("missing container ID")
|
var errMissingContainerID = errors.New("missing container ID")
|
||||||
|
|
||||||
func getContainerIDFromRequest(req interface{}) (cid.ID, error) {
|
func getContainerIDFromRequest(req any) (cid.ID, error) {
|
||||||
var idV2 *refsV2.ContainerID
|
var idV2 *refsV2.ContainerID
|
||||||
var id cid.ID
|
var id cid.ID
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
const defaultAllocSize = 1024
|
const defaultAllocSize = 1024
|
||||||
|
|
||||||
var putBytesPool = &sync.Pool{
|
var putBytesPool = &sync.Pool{
|
||||||
New: func() interface{} { return make([]byte, 0, defaultAllocSize) },
|
New: func() any { return make([]byte, 0, defaultAllocSize) },
|
||||||
}
|
}
|
||||||
|
|
||||||
func getPayload() []byte {
|
func getPayload() []byte {
|
||||||
|
|
|
@ -80,7 +80,7 @@ func (s *ResponseService) Put(ctx context.Context) (PutObjectStream, error) {
|
||||||
|
|
||||||
return &putStreamResponser{
|
return &putStreamResponser{
|
||||||
stream: s.respSvc.CreateRequestStreamer(
|
stream: s.respSvc.CreateRequestStreamer(
|
||||||
func(req interface{}) error {
|
func(req any) error {
|
||||||
return stream.Send(req.(*object.PutRequest))
|
return stream.Send(req.(*object.PutRequest))
|
||||||
},
|
},
|
||||||
func() (util.ResponseMessage, error) {
|
func() (util.ResponseMessage, error) {
|
||||||
|
@ -92,7 +92,7 @@ func (s *ResponseService) Put(ctx context.Context) (PutObjectStream, error) {
|
||||||
|
|
||||||
func (s *ResponseService) Head(ctx context.Context, req *object.HeadRequest) (*object.HeadResponse, error) {
|
func (s *ResponseService) Head(ctx context.Context, req *object.HeadRequest) (*object.HeadResponse, error) {
|
||||||
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
|
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
|
||||||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
func(ctx context.Context, req any) (util.ResponseMessage, error) {
|
||||||
return s.svc.Head(ctx, req.(*object.HeadRequest))
|
return s.svc.Head(ctx, req.(*object.HeadRequest))
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -118,7 +118,7 @@ func (s *ResponseService) Search(req *object.SearchRequest, stream SearchStream)
|
||||||
|
|
||||||
func (s *ResponseService) Delete(ctx context.Context, req *object.DeleteRequest) (*object.DeleteResponse, error) {
|
func (s *ResponseService) Delete(ctx context.Context, req *object.DeleteRequest) (*object.DeleteResponse, error) {
|
||||||
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
|
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
|
||||||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
func(ctx context.Context, req any) (util.ResponseMessage, error) {
|
||||||
return s.svc.Delete(ctx, req.(*object.DeleteRequest))
|
return s.svc.Delete(ctx, req.(*object.DeleteRequest))
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -144,7 +144,7 @@ func (s *ResponseService) GetRange(req *object.GetRangeRequest, stream GetObject
|
||||||
|
|
||||||
func (s *ResponseService) GetRangeHash(ctx context.Context, req *object.GetRangeHashRequest) (*object.GetRangeHashResponse, error) {
|
func (s *ResponseService) GetRangeHash(ctx context.Context, req *object.GetRangeHashRequest) (*object.GetRangeHashResponse, error) {
|
||||||
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
|
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
|
||||||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
func(ctx context.Context, req any) (util.ResponseMessage, error) {
|
||||||
return s.svc.GetRangeHash(ctx, req.(*object.GetRangeHashRequest))
|
return s.svc.GetRangeHash(ctx, req.(*object.GetRangeHashRequest))
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
@ -91,7 +91,7 @@ func (s *SignService) Put(ctx context.Context) (PutObjectStream, error) {
|
||||||
|
|
||||||
return &putStreamSigner{
|
return &putStreamSigner{
|
||||||
stream: s.sigSvc.CreateRequestStreamer(
|
stream: s.sigSvc.CreateRequestStreamer(
|
||||||
func(req interface{}) error {
|
func(req any) error {
|
||||||
return stream.Send(req.(*object.PutRequest))
|
return stream.Send(req.(*object.PutRequest))
|
||||||
},
|
},
|
||||||
func() (util.ResponseMessage, error) {
|
func() (util.ResponseMessage, error) {
|
||||||
|
@ -106,7 +106,7 @@ func (s *SignService) Put(ctx context.Context) (PutObjectStream, error) {
|
||||||
|
|
||||||
func (s *SignService) Head(ctx context.Context, req *object.HeadRequest) (*object.HeadResponse, error) {
|
func (s *SignService) Head(ctx context.Context, req *object.HeadRequest) (*object.HeadResponse, error) {
|
||||||
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
|
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
|
||||||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
func(ctx context.Context, req any) (util.ResponseMessage, error) {
|
||||||
return s.svc.Head(ctx, req.(*object.HeadRequest))
|
return s.svc.Head(ctx, req.(*object.HeadRequest))
|
||||||
},
|
},
|
||||||
func() util.ResponseMessage {
|
func() util.ResponseMessage {
|
||||||
|
@ -157,7 +157,7 @@ func (s *SignService) Search(req *object.SearchRequest, stream SearchStream) err
|
||||||
|
|
||||||
func (s *SignService) Delete(ctx context.Context, req *object.DeleteRequest) (*object.DeleteResponse, error) {
|
func (s *SignService) Delete(ctx context.Context, req *object.DeleteRequest) (*object.DeleteResponse, error) {
|
||||||
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
|
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
|
||||||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
func(ctx context.Context, req any) (util.ResponseMessage, error) {
|
||||||
return s.svc.Delete(ctx, req.(*object.DeleteRequest))
|
return s.svc.Delete(ctx, req.(*object.DeleteRequest))
|
||||||
},
|
},
|
||||||
func() util.ResponseMessage {
|
func() util.ResponseMessage {
|
||||||
|
@ -194,7 +194,7 @@ func (s *SignService) GetRange(req *object.GetRangeRequest, stream GetObjectRang
|
||||||
|
|
||||||
func (s *SignService) GetRangeHash(ctx context.Context, req *object.GetRangeHashRequest) (*object.GetRangeHashResponse, error) {
|
func (s *SignService) GetRangeHash(ctx context.Context, req *object.GetRangeHashRequest) (*object.GetRangeHashResponse, error) {
|
||||||
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
|
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
|
||||||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
func(ctx context.Context, req any) (util.ResponseMessage, error) {
|
||||||
return s.svc.GetRangeHash(ctx, req.(*object.GetRangeHashRequest))
|
return s.svc.GetRangeHash(ctx, req.(*object.GetRangeHashRequest))
|
||||||
},
|
},
|
||||||
func() util.ResponseMessage {
|
func() util.ResponseMessage {
|
||||||
|
|
|
@ -14,7 +14,7 @@ type HeadReceiver interface {
|
||||||
// Head must return one of:
|
// Head must return one of:
|
||||||
// * object header (*object.Object);
|
// * object header (*object.Object);
|
||||||
// * structured information about split-chain (*object.SplitInfo).
|
// * structured information about split-chain (*object.SplitInfo).
|
||||||
Head(id oid.Address) (interface{}, error)
|
Head(id oid.Address) (any, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SplitMemberHandler is a handler of next split-chain element.
|
// SplitMemberHandler is a handler of next split-chain element.
|
||||||
|
|
|
@ -40,7 +40,7 @@ func NewChecker(oo ...Option) *ExpirationChecker {
|
||||||
o(cfg)
|
o(cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
panicOnNil := func(v interface{}, name string) {
|
panicOnNil := func(v any, name string) {
|
||||||
if v == nil {
|
if v == nil {
|
||||||
panic(fmt.Sprintf("tombstone getter constructor: %s is nil", name))
|
panic(fmt.Sprintf("tombstone getter constructor: %s is nil", name))
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ type Router struct {
|
||||||
|
|
||||||
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
|
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
|
||||||
|
|
||||||
func panicOnPrmValue(n string, v interface{}) {
|
func panicOnPrmValue(n string, v any) {
|
||||||
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
|
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ type Calculator struct {
|
||||||
|
|
||||||
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
|
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
|
||||||
|
|
||||||
func panicOnPrmValue(n string, v interface{}) {
|
func panicOnPrmValue(n string, v any) {
|
||||||
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
|
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ type Controller struct {
|
||||||
|
|
||||||
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
|
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
|
||||||
|
|
||||||
func panicOnPrmValue(n string, v interface{}) {
|
func panicOnPrmValue(n string, v any) {
|
||||||
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
|
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ type Builder struct {
|
||||||
|
|
||||||
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
|
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
|
||||||
|
|
||||||
func panicOnPrmValue(n string, v interface{}) {
|
func panicOnPrmValue(n string, v any) {
|
||||||
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
|
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ type Controller struct {
|
||||||
|
|
||||||
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
|
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
|
||||||
|
|
||||||
func panicOnPrmValue(n string, v interface{}) {
|
func panicOnPrmValue(n string, v any) {
|
||||||
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
|
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ type Builder struct {
|
||||||
|
|
||||||
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
|
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
|
||||||
|
|
||||||
func panicOnPrmValue(n string, v interface{}) {
|
func panicOnPrmValue(n string, v any) {
|
||||||
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
|
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ func NewResponseService(cnrSvc Server, respSvc *response.Service) Server {
|
||||||
|
|
||||||
func (s *responseService) AnnounceLocalTrust(ctx context.Context, req *reputation.AnnounceLocalTrustRequest) (*reputation.AnnounceLocalTrustResponse, error) {
|
func (s *responseService) AnnounceLocalTrust(ctx context.Context, req *reputation.AnnounceLocalTrustRequest) (*reputation.AnnounceLocalTrustResponse, error) {
|
||||||
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
|
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
|
||||||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
func(ctx context.Context, req any) (util.ResponseMessage, error) {
|
||||||
return s.svc.AnnounceLocalTrust(ctx, req.(*reputation.AnnounceLocalTrustRequest))
|
return s.svc.AnnounceLocalTrust(ctx, req.(*reputation.AnnounceLocalTrustRequest))
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -38,7 +38,7 @@ func (s *responseService) AnnounceLocalTrust(ctx context.Context, req *reputatio
|
||||||
|
|
||||||
func (s *responseService) AnnounceIntermediateResult(ctx context.Context, req *reputation.AnnounceIntermediateResultRequest) (*reputation.AnnounceIntermediateResultResponse, error) {
|
func (s *responseService) AnnounceIntermediateResult(ctx context.Context, req *reputation.AnnounceIntermediateResultRequest) (*reputation.AnnounceIntermediateResultResponse, error) {
|
||||||
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
|
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
|
||||||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
func(ctx context.Context, req any) (util.ResponseMessage, error) {
|
||||||
return s.svc.AnnounceIntermediateResult(ctx, req.(*reputation.AnnounceIntermediateResultRequest))
|
return s.svc.AnnounceIntermediateResult(ctx, req.(*reputation.AnnounceIntermediateResultRequest))
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
@ -23,7 +23,7 @@ func NewSignService(key *ecdsa.PrivateKey, svc Server) Server {
|
||||||
|
|
||||||
func (s *signService) AnnounceLocalTrust(ctx context.Context, req *reputation.AnnounceLocalTrustRequest) (*reputation.AnnounceLocalTrustResponse, error) {
|
func (s *signService) AnnounceLocalTrust(ctx context.Context, req *reputation.AnnounceLocalTrustRequest) (*reputation.AnnounceLocalTrustResponse, error) {
|
||||||
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
|
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
|
||||||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
func(ctx context.Context, req any) (util.ResponseMessage, error) {
|
||||||
return s.svc.AnnounceLocalTrust(ctx, req.(*reputation.AnnounceLocalTrustRequest))
|
return s.svc.AnnounceLocalTrust(ctx, req.(*reputation.AnnounceLocalTrustRequest))
|
||||||
},
|
},
|
||||||
func() util.ResponseMessage {
|
func() util.ResponseMessage {
|
||||||
|
@ -39,7 +39,7 @@ func (s *signService) AnnounceLocalTrust(ctx context.Context, req *reputation.An
|
||||||
|
|
||||||
func (s *signService) AnnounceIntermediateResult(ctx context.Context, req *reputation.AnnounceIntermediateResultRequest) (*reputation.AnnounceIntermediateResultResponse, error) {
|
func (s *signService) AnnounceIntermediateResult(ctx context.Context, req *reputation.AnnounceIntermediateResultRequest) (*reputation.AnnounceIntermediateResultResponse, error) {
|
||||||
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
|
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
|
||||||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
func(ctx context.Context, req any) (util.ResponseMessage, error) {
|
||||||
return s.svc.AnnounceIntermediateResult(ctx, req.(*reputation.AnnounceIntermediateResultRequest))
|
return s.svc.AnnounceIntermediateResult(ctx, req.(*reputation.AnnounceIntermediateResultRequest))
|
||||||
},
|
},
|
||||||
func() util.ResponseMessage {
|
func() util.ResponseMessage {
|
||||||
|
|
|
@ -25,7 +25,7 @@ func NewResponseService(ssSvc Server, respSvc *response.Service) Server {
|
||||||
|
|
||||||
func (s *responseService) Create(ctx context.Context, req *session.CreateRequest) (*session.CreateResponse, error) {
|
func (s *responseService) Create(ctx context.Context, req *session.CreateRequest) (*session.CreateResponse, error) {
|
||||||
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
|
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
|
||||||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
func(ctx context.Context, req any) (util.ResponseMessage, error) {
|
||||||
return s.svc.Create(ctx, req.(*session.CreateRequest))
|
return s.svc.Create(ctx, req.(*session.CreateRequest))
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
@ -23,7 +23,7 @@ func NewSignService(key *ecdsa.PrivateKey, svc Server) Server {
|
||||||
|
|
||||||
func (s *signService) Create(ctx context.Context, req *session.CreateRequest) (*session.CreateResponse, error) {
|
func (s *signService) Create(ctx context.Context, req *session.CreateRequest) (*session.CreateResponse, error) {
|
||||||
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
|
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
|
||||||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
func(ctx context.Context, req any) (util.ResponseMessage, error) {
|
||||||
return s.svc.Create(ctx, req.(*session.CreateRequest))
|
return s.svc.Create(ctx, req.(*session.CreateRequest))
|
||||||
},
|
},
|
||||||
func() util.ResponseMessage {
|
func() util.ResponseMessage {
|
||||||
|
|
|
@ -17,7 +17,7 @@ type ClientMessageStreamer struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send calls send method of internal streamer.
|
// Send calls send method of internal streamer.
|
||||||
func (s *ClientMessageStreamer) Send(req interface{}) error {
|
func (s *ClientMessageStreamer) Send(req any) error {
|
||||||
if err := s.send(req); err != nil {
|
if err := s.send(req); err != nil {
|
||||||
return fmt.Errorf("(%T) could not send the request: %w", s, err)
|
return fmt.Errorf("(%T) could not send the request: %w", s, err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// HandleUnaryRequest call passes request to handler, sets response meta header values and returns it.
|
// HandleUnaryRequest call passes request to handler, sets response meta header values and returns it.
|
||||||
func (s *Service) HandleUnaryRequest(ctx context.Context, req interface{}, handler util.UnaryHandler) (util.ResponseMessage, error) {
|
func (s *Service) HandleUnaryRequest(ctx context.Context, req any, handler util.UnaryHandler) (util.ResponseMessage, error) {
|
||||||
// process request
|
// process request
|
||||||
resp, err := handler(ctx, req)
|
resp, err := handler(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -21,7 +21,7 @@ type ResponseMessage interface {
|
||||||
SetMetaHeader(*session.ResponseMetaHeader)
|
SetMetaHeader(*session.ResponseMetaHeader)
|
||||||
}
|
}
|
||||||
|
|
||||||
type UnaryHandler func(context.Context, interface{}) (ResponseMessage, error)
|
type UnaryHandler func(context.Context, any) (ResponseMessage, error)
|
||||||
|
|
||||||
type SignService struct {
|
type SignService struct {
|
||||||
key *ecdsa.PrivateKey
|
key *ecdsa.PrivateKey
|
||||||
|
@ -29,7 +29,7 @@ type SignService struct {
|
||||||
|
|
||||||
type ResponseMessageWriter func(ResponseMessage) error
|
type ResponseMessageWriter func(ResponseMessage) error
|
||||||
|
|
||||||
type ServerStreamHandler func(context.Context, interface{}) (ResponseMessageReader, error)
|
type ServerStreamHandler func(context.Context, any) (ResponseMessageReader, error)
|
||||||
|
|
||||||
type ResponseMessageReader func() (ResponseMessage, error)
|
type ResponseMessageReader func() (ResponseMessage, error)
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ var ErrAbortStream = errors.New("abort message stream")
|
||||||
|
|
||||||
type ResponseConstructor func() ResponseMessage
|
type ResponseConstructor func() ResponseMessage
|
||||||
|
|
||||||
type RequestMessageWriter func(interface{}) error
|
type RequestMessageWriter func(any) error
|
||||||
|
|
||||||
type ClientStreamCloser func() (ResponseMessage, error)
|
type ClientStreamCloser func() (ResponseMessage, error)
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ func NewUnarySignService(key *ecdsa.PrivateKey) *SignService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *RequestMessageStreamer) Send(req interface{}) error {
|
func (s *RequestMessageStreamer) Send(req any) error {
|
||||||
// req argument should be strengthen with type RequestMessage
|
// req argument should be strengthen with type RequestMessage
|
||||||
s.statusSupported = isStatusSupported(req.(RequestMessage)) // panic is OK here for now
|
s.statusSupported = isStatusSupported(req.(RequestMessage)) // panic is OK here for now
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ func (s *SignService) CreateRequestStreamer(sender RequestMessageWriter, closer
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SignService) HandleServerStreamRequest(
|
func (s *SignService) HandleServerStreamRequest(
|
||||||
req interface{},
|
req any,
|
||||||
respWriter ResponseMessageWriter,
|
respWriter ResponseMessageWriter,
|
||||||
blankResp ResponseConstructor,
|
blankResp ResponseConstructor,
|
||||||
respWriterCaller func(ResponseMessageWriter) error,
|
respWriterCaller func(ResponseMessageWriter) error,
|
||||||
|
@ -172,7 +172,7 @@ func (s *SignService) HandleServerStreamRequest(
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SignService) HandleUnaryRequest(ctx context.Context, req interface{}, handler UnaryHandler, blankResp ResponseConstructor) (ResponseMessage, error) {
|
func (s *SignService) HandleUnaryRequest(ctx context.Context, req any, handler UnaryHandler, blankResp ResponseConstructor) (ResponseMessage, error) {
|
||||||
// handle protocol versions <=2.10 (API statuses was introduced in 2.11 only)
|
// handle protocol versions <=2.10 (API statuses was introduced in 2.11 only)
|
||||||
|
|
||||||
// req argument should be strengthen with type RequestMessage
|
// req argument should be strengthen with type RequestMessage
|
||||||
|
@ -233,7 +233,7 @@ func setStatusV2(resp ResponseMessage, err error) {
|
||||||
// The signature error affects the result depending on the protocol version:
|
// The signature error affects the result depending on the protocol version:
|
||||||
// - if status return is supported, panics since we cannot return the failed status, because it will not be signed;
|
// - if status return is supported, panics since we cannot return the failed status, because it will not be signed;
|
||||||
// - otherwise, returns error in order to transport it directly.
|
// - otherwise, returns error in order to transport it directly.
|
||||||
func signResponse(key *ecdsa.PrivateKey, resp interface{}, statusSupported bool) error {
|
func signResponse(key *ecdsa.PrivateKey, resp any, statusSupported bool) error {
|
||||||
err := signature.SignServiceMessage(key, resp)
|
err := signature.SignServiceMessage(key, resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = fmt.Errorf("could not sign response: %w", err)
|
err = fmt.Errorf("could not sign response: %w", err)
|
||||||
|
|
|
@ -37,15 +37,15 @@ type Server struct {
|
||||||
|
|
||||||
const invalidValFmt = "invalid %s %s (%T): %v"
|
const invalidValFmt = "invalid %s %s (%T): %v"
|
||||||
|
|
||||||
func panicOnPrmValue(n string, v interface{}) {
|
func panicOnPrmValue(n string, v any) {
|
||||||
panicOnValue("parameter", n, v)
|
panicOnValue("parameter", n, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
func panicOnOptValue(n string, v interface{}) {
|
func panicOnOptValue(n string, v any) {
|
||||||
panicOnValue("option", n, v)
|
panicOnValue("option", n, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
func panicOnValue(t, n string, v interface{}) {
|
func panicOnValue(t, n string, v any) {
|
||||||
panic(fmt.Sprintf(invalidValFmt, t, n, v, v))
|
panic(fmt.Sprintf(invalidValFmt, t, n, v, v))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ type pathMode struct {
|
||||||
|
|
||||||
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
|
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
|
||||||
|
|
||||||
func panicOnPrmValue(n string, v interface{}) {
|
func panicOnPrmValue(n string, v any) {
|
||||||
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
|
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ type DB struct {
|
||||||
|
|
||||||
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
|
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
|
||||||
|
|
||||||
func panicOnPrmValue(n string, v interface{}) {
|
func panicOnPrmValue(n string, v any) {
|
||||||
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
|
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ type DB struct {
|
||||||
|
|
||||||
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
|
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
|
||||||
|
|
||||||
func panicOnPrmValue(n string, v interface{}) {
|
func panicOnPrmValue(n string, v any) {
|
||||||
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
|
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ type Table struct {
|
||||||
|
|
||||||
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
|
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
|
||||||
|
|
||||||
func panicOnPrmValue(n string, v interface{}) {
|
func panicOnPrmValue(n string, v any) {
|
||||||
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
|
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue