forked from TrueCloudLab/frostfs-node
Compare commits
10 commits
KirillovDe
...
master
Author | SHA1 | Date | |
---|---|---|---|
79ba34714a | |||
6d4f48f37a | |||
e9f3c24229 | |||
88e3868f47 | |||
6925fb4c59 | |||
c3a7039801 | |||
a1ab25b33e | |||
73bb590cb1 | |||
7eaf159a8b | |||
cb5468abb8 |
96 changed files with 281 additions and 232 deletions
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
|
@ -1 +1 @@
|
|||
* @carpawell @fyrchik @acid-ant
|
||||
* @TrueCloudLab/storage-core @TrueCloudLab/committers
|
||||
|
|
|
@ -12,6 +12,7 @@ Changelog for FrostFS Node
|
|||
- `object.delete.tombstone_lifetime` config parameter to set tombstone lifetime in the DELETE service (#2246)
|
||||
- Reload config for pprof and metrics on SIGHUP in `neofs-node` (#1868)
|
||||
- Multiple configs support (#44)
|
||||
- Parameters `nns-name` and `nns-zone` for command `frostfs-cli container create` (#37)
|
||||
|
||||
### Changed
|
||||
- Change `frostfs_node_engine_container_size` to counting sizes of logical objects
|
||||
|
@ -42,6 +43,8 @@ Changelog for FrostFS Node
|
|||
- `neo-go` client deadlock on subscription restoration (#2244)
|
||||
- Possible panic during write-cache initialization (#2234)
|
||||
- Do not fetch an object if `meta` is missing it (#61)
|
||||
- Create contract wallet only by `init` and `update-config` command (#63)
|
||||
- Actually use `object.put.pool_size_local` and independent pool for local puts (#64).
|
||||
|
||||
### Removed
|
||||
### Updated
|
||||
|
@ -51,6 +54,7 @@ Changelog for FrostFS Node
|
|||
- `golang.org/x/term` to `v0.3.0`
|
||||
- `google.golang.org/grpc` to `v1.51.0`
|
||||
- `github.com/nats-io/nats.go` to `v1.22.1`
|
||||
- `github.com/TrueCloudLab/hrw` to `v.1.1.1`
|
||||
- Minimum go version to v1.18
|
||||
|
||||
### Updating from v0.35.0
|
||||
|
|
|
@ -140,14 +140,14 @@ func setConfigCmd(cmd *cobra.Command, args []string) error {
|
|||
return wCtx.awaitTx()
|
||||
}
|
||||
|
||||
func parseConfigPair(kvStr string, force bool) (key string, val interface{}, err error) {
|
||||
kv := strings.SplitN(kvStr, "=", 2)
|
||||
if len(kv) != 2 {
|
||||
func parseConfigPair(kvStr string, force bool) (key string, val any, err error) {
|
||||
k, v, found := strings.Cut(kvStr, "=")
|
||||
if !found {
|
||||
return "", nil, fmt.Errorf("invalid parameter format: must be 'key=val', got: %s", kvStr)
|
||||
}
|
||||
|
||||
key = kv[0]
|
||||
valRaw := kv[1]
|
||||
key = k
|
||||
valRaw := v
|
||||
|
||||
switch key {
|
||||
case netmapAuditFeeKey, netmapBasicIncomeRateKey,
|
||||
|
@ -162,7 +162,7 @@ func parseConfigPair(kvStr string, force bool) (key string, val interface{}, err
|
|||
case netmapEigenTrustAlphaKey:
|
||||
// just check that it could
|
||||
// be parsed correctly
|
||||
_, err = strconv.ParseFloat(kv[1], 64)
|
||||
_, err = strconv.ParseFloat(v, 64)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("could not parse %s's value '%s' as float: %w", key, valRaw, err)
|
||||
}
|
||||
|
|
|
@ -115,8 +115,10 @@ func newInitializeContext(cmd *cobra.Command, v *viper.Viper) (*initializeContex
|
|||
return nil, err
|
||||
}
|
||||
|
||||
needContracts := cmd.Name() == "update-contracts" || cmd.Name() == "init"
|
||||
|
||||
var w *wallet.Wallet
|
||||
if cmd.Name() != "deploy" {
|
||||
if needContracts {
|
||||
w, err = openContractWallet(v, cmd, walletDir)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -157,7 +159,6 @@ func newInitializeContext(cmd *cobra.Command, v *viper.Viper) (*initializeContex
|
|||
}
|
||||
}
|
||||
|
||||
needContracts := cmd.Name() == "update-contracts" || cmd.Name() == "init"
|
||||
if needContracts {
|
||||
ctrPath, err = cmd.Flags().GetString(contractsInitFlag)
|
||||
if err != nil {
|
||||
|
|
|
@ -167,7 +167,7 @@ func (c *initializeContext) updateContracts() error {
|
|||
|
||||
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.
|
||||
// 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 {
|
||||
alphaCs := c.getContract(alphabetContract)
|
||||
|
||||
var keysParam []interface{}
|
||||
var keysParam []any
|
||||
|
||||
baseGroups := alphaCs.Manifest.Groups
|
||||
|
||||
|
@ -510,12 +510,12 @@ func readContractsFromArchive(file io.Reader, names []string) (map[string]*contr
|
|||
return m, nil
|
||||
}
|
||||
|
||||
func getContractDeployParameters(cs *contractState, deployData []interface{}) []interface{} {
|
||||
return []interface{}{cs.RawNEF, cs.RawManifest, deployData}
|
||||
func getContractDeployParameters(cs *contractState, deployData []any) []any {
|
||||
return []any{cs.RawNEF, cs.RawManifest, deployData}
|
||||
}
|
||||
|
||||
func (c *initializeContext) getContractDeployData(ctrName string, keysParam []interface{}) []interface{} {
|
||||
items := make([]interface{}, 1, 6)
|
||||
func (c *initializeContext) getContractDeployData(ctrName string, keysParam []any) []any {
|
||||
items := make([]any, 1, 6)
|
||||
items[0] = false // notaryDisabled is false
|
||||
|
||||
switch ctrName {
|
||||
|
@ -551,7 +551,7 @@ func (c *initializeContext) getContractDeployData(ctrName string, keysParam []in
|
|||
c.Contracts[netmapContract].Hash,
|
||||
c.Contracts[containerContract].Hash)
|
||||
case netmapContract:
|
||||
configParam := []interface{}{
|
||||
configParam := []any{
|
||||
netmapEpochKey, viper.GetInt64(epochDurationInitFlag),
|
||||
netmapMaxObjectSizeKey, viper.GetInt64(maxObjectSizeInitFlag),
|
||||
netmapAuditFeeKey, viper.GetInt64(auditFeeInitFlag),
|
||||
|
@ -580,8 +580,8 @@ func (c *initializeContext) getContractDeployData(ctrName string, keysParam []in
|
|||
return items
|
||||
}
|
||||
|
||||
func (c *initializeContext) getAlphabetDeployItems(i, n int) []interface{} {
|
||||
items := make([]interface{}, 6)
|
||||
func (c *initializeContext) getAlphabetDeployItems(i, n int) []any {
|
||||
items := make([]any, 6)
|
||||
items[0] = false
|
||||
items[1] = c.Contracts[netmapContract].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:
|
||||
return ct.NNSIsAvailable(nnsHash, name)
|
||||
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 {
|
||||
return false, fmt.Errorf("`isAvailable`: invalid response: %w", err)
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ func (c *initializeContext) setNotaryAndAlphabetNodes() error {
|
|||
return err
|
||||
}
|
||||
|
||||
var pubs []interface{}
|
||||
var pubs []any
|
||||
for _, acc := range c.Accounts {
|
||||
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) {
|
||||
var err error
|
||||
|
||||
pp := make([]interface{}, len(sPrm))
|
||||
pp := make([]any, len(sPrm))
|
||||
for i, p := range sPrm {
|
||||
pp[i], err = smartcontract.ExpandParameterToEmitable(p)
|
||||
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) {
|
||||
res, err := invokeFunction(l, h, "balanceOf", []interface{}{acc}, nil)
|
||||
res, err := invokeFunction(l, h, "balanceOf", []any{acc}, nil)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
@ -451,7 +451,7 @@ func (l *localClient) putTransactions() error {
|
|||
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()
|
||||
emit.Array(w.BinWriter, parameters...)
|
||||
emit.AppCallNoArgs(w.BinWriter, h, method, callflag.All)
|
||||
|
|
|
@ -111,7 +111,7 @@ func depositNotary(cmd *cobra.Command, _ []string) error {
|
|||
accHash,
|
||||
notary.Hash,
|
||||
big.NewInt(int64(gasAmount)),
|
||||
[]interface{}{nil, int64(height) + till},
|
||||
[]any{nil, int64(height) + till},
|
||||
)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not send tx: %w", err)
|
||||
|
|
|
@ -27,23 +27,23 @@ func setPolicyCmd(cmd *cobra.Command, args []string) error {
|
|||
|
||||
bw := io.NewBufBinWriter()
|
||||
for i := range args {
|
||||
kv := strings.SplitN(args[i], "=", 2)
|
||||
if len(kv) != 2 {
|
||||
k, v, found := strings.Cut(args[i], "=")
|
||||
if !found {
|
||||
return fmt.Errorf("invalid parameter format, must be Parameter=Value")
|
||||
}
|
||||
|
||||
switch kv[0] {
|
||||
switch k {
|
||||
case execFeeParam, storagePriceParam, setFeeParam:
|
||||
default:
|
||||
return fmt.Errorf("parameter must be one of %s, %s and %s", execFeeParam, storagePriceParam, setFeeParam)
|
||||
}
|
||||
|
||||
value, err := strconv.ParseUint(kv[1], 10, 32)
|
||||
value, err := strconv.ParseUint(v, 10, 32)
|
||||
if err != nil {
|
||||
return fmt.Errorf("can't parse parameter value '%s': %w", args[1], err)
|
||||
}
|
||||
|
||||
emit.AppCall(bw.BinWriter, policy.Hash, "set"+kv[0], callflag.All, int64(value))
|
||||
emit.AppCall(bw.BinWriter, policy.Hash, "set"+k, callflag.All, int64(value))
|
||||
}
|
||||
|
||||
if err := wCtx.sendCommitteeTx(bw.Bytes(), false); err != nil {
|
||||
|
|
|
@ -340,7 +340,7 @@ func manageSubnetAdmins(cmd *cobra.Command, rm bool) error {
|
|||
}
|
||||
|
||||
// prepare call parameters
|
||||
prm := make([]interface{}, 0, 3)
|
||||
prm := make([]any, 0, 3)
|
||||
prm = append(prm, id.Marshal())
|
||||
|
||||
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())
|
||||
if err != nil {
|
||||
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
|
||||
}
|
||||
|
||||
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())
|
||||
if err != nil {
|
||||
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
|
||||
}
|
||||
|
||||
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)
|
||||
if err != nil {
|
||||
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
|
||||
}
|
||||
|
||||
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)
|
||||
if err != nil {
|
||||
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.
|
||||
func PrintVerbose(cmd *cobra.Command, format string, a ...interface{}) {
|
||||
func PrintVerbose(cmd *cobra.Command, format string, a ...any) {
|
||||
if viper.GetBool(commonflags.Verbose) {
|
||||
cmd.Printf(format+"\n", a...)
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
containerApi "github.com/TrueCloudLab/frostfs-api-go/v2/container"
|
||||
internalclient "github.com/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/client"
|
||||
"github.com/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/common"
|
||||
"github.com/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/commonflags"
|
||||
|
@ -26,6 +27,8 @@ var (
|
|||
containerAttributes []string
|
||||
containerAwait bool
|
||||
containerName string
|
||||
containerNnsName string
|
||||
containerNnsZone string
|
||||
containerNoTimestamp bool
|
||||
containerSubnet string
|
||||
force bool
|
||||
|
@ -160,6 +163,8 @@ func initContainerCreateCmd() {
|
|||
flags.StringSliceVarP(&containerAttributes, "attributes", "a", nil, "Comma separated pairs of container attributes in form of Key1=Value1,Key2=Value2")
|
||||
flags.BoolVar(&containerAwait, "await", false, "Block execution until container is persisted")
|
||||
flags.StringVar(&containerName, "name", "", "Container name attribute")
|
||||
flags.StringVar(&containerNnsName, "nns-name", "", "Container nns name attribute")
|
||||
flags.StringVar(&containerNnsZone, "nns-zone", "", "Container nns zone attribute")
|
||||
flags.BoolVar(&containerNoTimestamp, "disable-timestamp", false, "Disable timestamp container attribute")
|
||||
flags.StringVar(&containerSubnet, "subnet", "", "String representation of container subnetwork")
|
||||
flags.BoolVarP(&force, commonflags.ForceFlag, commonflags.ForceFlagShorthand, false,
|
||||
|
@ -197,12 +202,12 @@ func parseContainerPolicy(cmd *cobra.Command, policyString string) (*netmap.Plac
|
|||
|
||||
func parseAttributes(dst *container.Container, attributes []string) error {
|
||||
for i := range attributes {
|
||||
kvPair := strings.Split(attributes[i], attributeDelimiter)
|
||||
if len(kvPair) != 2 {
|
||||
k, v, found := strings.Cut(attributes[i], attributeDelimiter)
|
||||
if !found {
|
||||
return errors.New("invalid container attribute")
|
||||
}
|
||||
|
||||
dst.SetAttribute(kvPair[0], kvPair[1])
|
||||
dst.SetAttribute(k, v)
|
||||
}
|
||||
|
||||
if !containerNoTimestamp {
|
||||
|
@ -213,5 +218,12 @@ func parseAttributes(dst *container.Container, attributes []string) error {
|
|||
container.SetName(dst, containerName)
|
||||
}
|
||||
|
||||
if containerNnsName != "" {
|
||||
dst.SetAttribute(containerApi.SysAttributeName, containerNnsName)
|
||||
}
|
||||
if containerNnsZone != "" {
|
||||
dst.SetAttribute(containerApi.SysAttributeZone, containerNnsZone)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -58,9 +58,9 @@ func listShards(cmd *cobra.Command, _ []string) {
|
|||
}
|
||||
|
||||
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 {
|
||||
out = append(out, map[string]interface{}{
|
||||
out = append(out, map[string]any{
|
||||
"shard_id": base58.Encode(i.Shard_ID),
|
||||
"mode": shardModeToString(i.GetMode()),
|
||||
"metabase": i.GetMetabasePath(),
|
||||
|
|
|
@ -179,12 +179,12 @@ func parseObjectAttrs(cmd *cobra.Command) ([]object.Attribute, error) {
|
|||
|
||||
attrs := make([]object.Attribute, len(rawAttrs), len(rawAttrs)+2) // name + timestamp attributes
|
||||
for i := range rawAttrs {
|
||||
kv := strings.SplitN(rawAttrs[i], "=", 2)
|
||||
if len(kv) != 2 {
|
||||
k, v, found := strings.Cut(rawAttrs[i], "=")
|
||||
if !found {
|
||||
return nil, fmt.Errorf("invalid attribute format: %s", rawAttrs[i])
|
||||
}
|
||||
attrs[i].SetKey(kv[0])
|
||||
attrs[i].SetValue(kv[1])
|
||||
attrs[i].SetKey(k)
|
||||
attrs[i].SetValue(v)
|
||||
}
|
||||
|
||||
disableFilename, _ := cmd.Flags().GetBool("disable-filename")
|
||||
|
@ -218,26 +218,26 @@ func parseObjectNotifications(cmd *cobra.Command) (*object.NotificationInfo, err
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
rawSlice := strings.SplitN(raw, separator, 2)
|
||||
if len(rawSlice) != 2 {
|
||||
before, after, found := strings.Cut(raw, separator)
|
||||
if !found {
|
||||
return nil, fmt.Errorf("notification must be in the form of: *epoch*%s*topic*, got %s", separator, raw)
|
||||
}
|
||||
|
||||
ni := new(object.NotificationInfo)
|
||||
|
||||
epoch, err := strconv.ParseUint(rawSlice[0], 10, 64)
|
||||
epoch, err := strconv.ParseUint(before, 10, 64)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not parse notification epoch %s: %w", rawSlice[0], err)
|
||||
return nil, fmt.Errorf("could not parse notification epoch %s: %w", before, err)
|
||||
}
|
||||
|
||||
ni.SetEpoch(epoch)
|
||||
|
||||
if rawSlice[1] == "" {
|
||||
if after == "" {
|
||||
return nil, fmt.Errorf("incorrect empty topic: use %s to force using default topic", useDefaultTopic)
|
||||
}
|
||||
|
||||
if rawSlice[1] != useDefaultTopic {
|
||||
ni.SetTopic(rawSlice[1])
|
||||
if after != useDefaultTopic {
|
||||
ni.SetTopic(after)
|
||||
}
|
||||
|
||||
return ni, nil
|
||||
|
|
|
@ -154,16 +154,16 @@ func getRangeList(cmd *cobra.Command) ([]*object.Range, error) {
|
|||
vs := strings.Split(v, ",")
|
||||
rs := make([]*object.Range, len(vs))
|
||||
for i := range vs {
|
||||
r := strings.Split(vs[i], rangeSep)
|
||||
if len(r) != 2 {
|
||||
before, after, found := strings.Cut(vs[i], rangeSep)
|
||||
if !found {
|
||||
return nil, fmt.Errorf("invalid range specifier: %s", vs[i])
|
||||
}
|
||||
|
||||
offset, err := strconv.ParseUint(r[0], 10, 64)
|
||||
offset, err := strconv.ParseUint(before, 10, 64)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("invalid '%s' range offset specifier: %w", vs[i], err)
|
||||
}
|
||||
length, err := strconv.ParseUint(r[1], 10, 64)
|
||||
length, err := strconv.ParseUint(after, 10, 64)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("invalid '%s' range length specifier: %w", vs[i], err)
|
||||
}
|
||||
|
|
|
@ -63,12 +63,12 @@ func parseXHeaders(cmd *cobra.Command) []string {
|
|||
xs := make([]string, 0, 2*len(xHeaders))
|
||||
|
||||
for i := range xHeaders {
|
||||
kv := strings.SplitN(xHeaders[i], "=", 2)
|
||||
if len(kv) != 2 {
|
||||
k, v, found := strings.Cut(xHeaders[i], "=")
|
||||
if !found {
|
||||
panic(fmt.Errorf("invalid X-Header format: %s", xHeaders[i]))
|
||||
}
|
||||
|
||||
xs = append(xs, kv[0], kv[1])
|
||||
xs = append(xs, k, v)
|
||||
}
|
||||
|
||||
return xs
|
||||
|
|
|
@ -127,7 +127,7 @@ type sgHeadReceiver struct {
|
|||
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)
|
||||
|
||||
res, err := internalclient.HeadObject(c.prm)
|
||||
|
|
|
@ -79,14 +79,14 @@ func parseMeta(cmd *cobra.Command) ([]*tree.KeyValue, error) {
|
|||
|
||||
pairs := make([]*tree.KeyValue, 0, len(raws))
|
||||
for i := range raws {
|
||||
kv := strings.SplitN(raws[i], "=", 2)
|
||||
if len(kv) != 2 {
|
||||
k, v, found := strings.Cut(raws[i], "=")
|
||||
if !found {
|
||||
return nil, fmt.Errorf("invalid meta pair format: %s", raws[i])
|
||||
}
|
||||
|
||||
var pair tree.KeyValue
|
||||
pair.Key = kv[0]
|
||||
pair.Value = []byte(kv[1])
|
||||
pair.Key = k
|
||||
pair.Value = []byte(v)
|
||||
|
||||
pairs = append(pairs, &pair)
|
||||
}
|
||||
|
|
|
@ -226,35 +226,32 @@ func parseEACLTable(tb *eacl.Table, args []string) error {
|
|||
|
||||
func parseEACLRecord(args []string) (*eacl.Record, error) {
|
||||
r := new(eacl.Record)
|
||||
for i := range args {
|
||||
ss := strings.SplitN(args[i], ":", 2)
|
||||
for _, arg := range args {
|
||||
before, after, found := strings.Cut(arg, ":")
|
||||
|
||||
switch prefix := strings.ToLower(ss[0]); prefix {
|
||||
switch prefix := strings.ToLower(before); prefix {
|
||||
case "req", "obj": // filters
|
||||
if len(ss) != 2 {
|
||||
return nil, fmt.Errorf("invalid filter or target: %s", args[i])
|
||||
}
|
||||
|
||||
i := strings.Index(ss[1], "=")
|
||||
if i < 0 {
|
||||
return nil, fmt.Errorf("invalid filter key-value pair: %s", ss[1])
|
||||
if !found {
|
||||
return nil, fmt.Errorf("invalid filter or target: %s", arg)
|
||||
}
|
||||
|
||||
var key, value string
|
||||
var op eacl.Match
|
||||
var f bool
|
||||
|
||||
if 0 < i && ss[1][i-1] == '!' {
|
||||
key = ss[1][:i-1]
|
||||
key, value, f = strings.Cut(after, "!=")
|
||||
if f {
|
||||
op = eacl.MatchStringNotEqual
|
||||
} else {
|
||||
key = ss[1][:i]
|
||||
key, value, f = strings.Cut(after, "=")
|
||||
if !f {
|
||||
return nil, fmt.Errorf("invalid filter key-value pair: %s", after)
|
||||
}
|
||||
op = eacl.MatchStringEqual
|
||||
}
|
||||
|
||||
value = ss[1][i+1:]
|
||||
|
||||
typ := eacl.HeaderFromRequest
|
||||
if ss[0] == "obj" {
|
||||
if before == "obj" {
|
||||
typ = eacl.HeaderFromObject
|
||||
}
|
||||
|
||||
|
@ -263,8 +260,8 @@ func parseEACLRecord(args []string) (*eacl.Record, error) {
|
|||
var err error
|
||||
|
||||
var pubs []ecdsa.PublicKey
|
||||
if len(ss) == 2 {
|
||||
pubs, err = parseKeyList(ss[1])
|
||||
if found {
|
||||
pubs, err = parseKeyList(after)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -281,7 +278,7 @@ func parseEACLRecord(args []string) (*eacl.Record, error) {
|
|||
eacl.AddFormedTarget(r, role, pubs...)
|
||||
|
||||
default:
|
||||
return nil, fmt.Errorf("invalid prefix: %s", ss[0])
|
||||
return nil, fmt.Errorf("invalid prefix: %s", before)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -496,6 +496,10 @@ type cfgObjectRoutines struct {
|
|||
|
||||
putRemoteCapacity int
|
||||
|
||||
putLocal *ants.Pool
|
||||
|
||||
putLocalCapacity int
|
||||
|
||||
replicatorPoolSize int
|
||||
|
||||
replication *ants.Pool
|
||||
|
@ -834,10 +838,13 @@ func initObjectPool(cfg *config.Config) (pool cfgObjectRoutines) {
|
|||
optNonBlocking := ants.WithNonblocking(true)
|
||||
|
||||
pool.putRemoteCapacity = objectconfig.Put(cfg).PoolSizeRemote()
|
||||
|
||||
pool.putRemote, err = ants.NewPool(pool.putRemoteCapacity, optNonBlocking)
|
||||
fatalOnErr(err)
|
||||
|
||||
pool.putLocalCapacity = objectconfig.Put(cfg).PoolSizeLocal()
|
||||
pool.putLocal, err = ants.NewPool(pool.putLocalCapacity, optNonBlocking)
|
||||
fatalOnErr(err)
|
||||
|
||||
pool.replicatorPoolSize = replicatorconfig.PoolSize(cfg)
|
||||
if pool.replicatorPoolSize <= 0 {
|
||||
pool.replicatorPoolSize = pool.putRemoteCapacity
|
||||
|
|
|
@ -37,7 +37,7 @@ func (x *Config) Sub(name string) *Config {
|
|||
// recommended.
|
||||
//
|
||||
// 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))
|
||||
if value != nil || x.defaultPath == nil {
|
||||
return value
|
||||
|
|
|
@ -39,3 +39,15 @@ func (g PutConfig) PoolSizeRemote() int {
|
|||
|
||||
return PutPoolSizeDefault
|
||||
}
|
||||
|
||||
// PoolSizeLocal returns the value of "pool_size_local" config parameter.
|
||||
//
|
||||
// Returns PutPoolSizeDefault if the value is not a positive number.
|
||||
func (g PutConfig) PoolSizeLocal() int {
|
||||
v := config.Int(g.cfg, "pool_size_local")
|
||||
if v > 0 {
|
||||
return int(v)
|
||||
}
|
||||
|
||||
return PutPoolSizeDefault
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ func TestObjectSection(t *testing.T) {
|
|||
empty := configtest.EmptyConfig()
|
||||
|
||||
require.Equal(t, objectconfig.PutPoolSizeDefault, objectconfig.Put(empty).PoolSizeRemote())
|
||||
require.Equal(t, objectconfig.PutPoolSizeDefault, objectconfig.Put(empty).PoolSizeLocal())
|
||||
require.EqualValues(t, objectconfig.DefaultTombstoneLifetime, objectconfig.TombstoneLifetime(empty))
|
||||
})
|
||||
|
||||
|
@ -21,6 +22,7 @@ func TestObjectSection(t *testing.T) {
|
|||
|
||||
var fileConfigTest = func(c *config.Config) {
|
||||
require.Equal(t, 100, objectconfig.Put(c).PoolSizeRemote())
|
||||
require.Equal(t, 200, objectconfig.Put(c).PoolSizeLocal())
|
||||
require.EqualValues(t, 10, objectconfig.TombstoneLifetime(c))
|
||||
}
|
||||
|
||||
|
|
|
@ -65,14 +65,14 @@ func loadEnv(path string) {
|
|||
|
||||
scanner := bufio.NewScanner(f)
|
||||
for scanner.Scan() {
|
||||
pair := strings.SplitN(scanner.Text(), "=", 2)
|
||||
if len(pair) != 2 {
|
||||
k, v, found := strings.Cut(scanner.Text(), "=")
|
||||
if !found {
|
||||
continue
|
||||
}
|
||||
|
||||
pair[1] = strings.Trim(pair[1], `"`)
|
||||
v = strings.Trim(v, `"`)
|
||||
|
||||
err = os.Setenv(pair[0], pair[1])
|
||||
err = os.Setenv(k, v)
|
||||
if err != nil {
|
||||
panic("can't set environment variable")
|
||||
}
|
||||
|
|
|
@ -275,7 +275,7 @@ func initObjectService(c *cfg) {
|
|||
putsvc.WithNetworkMapSource(c.netMapSource),
|
||||
putsvc.WithNetmapKeys(c),
|
||||
putsvc.WithNetworkState(c.cfgNetmap.state),
|
||||
putsvc.WithWorkerPools(c.cfgObject.pool.putRemote),
|
||||
putsvc.WithWorkerPools(c.cfgObject.pool.putRemote, c.cfgObject.pool.putLocal),
|
||||
putsvc.WithLogger(c.log),
|
||||
)
|
||||
|
||||
|
|
|
@ -50,6 +50,6 @@ func (*OnlyKeyRemoteServerInfo) ExternalAddresses() []string {
|
|||
|
||||
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))
|
||||
}
|
||||
|
|
|
@ -85,6 +85,7 @@ FROSTFS_REPLICATOR_POOL_SIZE=10
|
|||
|
||||
# Object service section
|
||||
FROSTFS_OBJECT_PUT_POOL_SIZE_REMOTE=100
|
||||
FROSTFS_OBJECT_PUT_POOL_SIZE_LOCAL=200
|
||||
FROSTFS_OBJECT_DELETE_TOMBSTONE_LIFETIME=10
|
||||
|
||||
# Storage engine section
|
||||
|
|
|
@ -132,7 +132,8 @@
|
|||
"tombstone_lifetime": 10
|
||||
},
|
||||
"put": {
|
||||
"pool_size_remote": 100
|
||||
"pool_size_remote": 100,
|
||||
"pool_size_local": 200
|
||||
}
|
||||
},
|
||||
"storage": {
|
||||
|
|
|
@ -111,6 +111,7 @@ object:
|
|||
tombstone_lifetime: 10 # tombstone "local" lifetime in epochs
|
||||
put:
|
||||
pool_size_remote: 100 # number of async workers for remote PUT operations
|
||||
pool_size_local: 200 # number of async workers for local PUT operations
|
||||
|
||||
storage:
|
||||
# note: shard configuration can be omitted for relay node (see `node.relay`)
|
||||
|
|
|
@ -427,3 +427,4 @@ object:
|
|||
|-----------------------------|-------|---------------|------------------------------------------------------------------------------------------------|
|
||||
| `delete.tombstone_lifetime` | `int` | `5` | Tombstone lifetime for removed objects in epochs. |
|
||||
| `put.pool_size_remote` | `int` | `10` | Max pool size for performing remote `PUT` operations. Used by Policer and Replicator services. |
|
||||
| `put.pool_size_local` | `int` | `10` | Max pool size for performing local `PUT` operations. Used by Policer and Replicator services. |
|
||||
|
|
2
go.mod
2
go.mod
|
@ -6,7 +6,7 @@ require (
|
|||
github.com/TrueCloudLab/frostfs-api-go/v2 v2.0.0-20221212144048-1351b6656d68
|
||||
github.com/TrueCloudLab/frostfs-contract v0.0.0-20221213081248-6c805c1b4e42
|
||||
github.com/TrueCloudLab/frostfs-sdk-go v0.0.0-20221214065929-4c779423f556
|
||||
github.com/TrueCloudLab/hrw v1.1.0
|
||||
github.com/TrueCloudLab/hrw v1.1.1-0.20230227111858-79b208bebf52
|
||||
github.com/TrueCloudLab/tzhash v1.7.0
|
||||
github.com/cheggaaa/pb v1.0.29
|
||||
github.com/chzyer/readline v1.5.1
|
||||
|
|
2
go.sum
2
go.sum
|
@ -52,6 +52,8 @@ github.com/TrueCloudLab/frostfs-sdk-go v0.0.0-20221214065929-4c779423f556 h1:Cc1
|
|||
github.com/TrueCloudLab/frostfs-sdk-go v0.0.0-20221214065929-4c779423f556/go.mod h1:4ZiG4jNLzrqeJbmZUrPI7wDZhQVPaf0zEIWa/eBsqBg=
|
||||
github.com/TrueCloudLab/hrw v1.1.0 h1:2U69PpUX1UtMWgh/RAg6D8mQW+/WsxbLNE+19EUhLhY=
|
||||
github.com/TrueCloudLab/hrw v1.1.0/go.mod h1:Pzi8Hy3qx12cew+ajVxgbtDVM4sRG9/gJnJLcL/yRyY=
|
||||
github.com/TrueCloudLab/hrw v1.1.1-0.20230227111858-79b208bebf52 h1:fBeG0EkL7Pa2D0SIiZt3yQYGpP/IvrXg4xEPAZ4Jjys=
|
||||
github.com/TrueCloudLab/hrw v1.1.1-0.20230227111858-79b208bebf52/go.mod h1:BG6NztCuNc0UFr6MWJ4MM1sUl9lxx6PBRwLmTxdre20=
|
||||
github.com/TrueCloudLab/rfc6979 v0.3.0 h1:0SYMAfQWh/TjnofqYQHy+s3rmQ5gi0fvOaDbqd60/Ic=
|
||||
github.com/TrueCloudLab/rfc6979 v0.3.0/go.mod h1:qylxFXFQ/sMvpZC/8JyWp+mfzk5Zj/KDT5FAbekhobc=
|
||||
github.com/TrueCloudLab/tzhash v1.7.0 h1:btGORepc7Dg+n4MxgJxv73c9eYhwSBI5HqsqUBRmJiw=
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
|
||||
|
|
|
@ -73,18 +73,18 @@ func stringifyAddress(addr oid.Address) string {
|
|||
}
|
||||
|
||||
func addressFromString(s string) (oid.Address, error) {
|
||||
i := strings.IndexByte(s, '.')
|
||||
if i == -1 {
|
||||
before, after, found := strings.Cut(s, ".")
|
||||
if !found {
|
||||
return oid.Address{}, errors.New("invalid address")
|
||||
}
|
||||
|
||||
var obj oid.ID
|
||||
if err := obj.DecodeString(s[:i]); err != nil {
|
||||
if err := obj.DecodeString(before); err != nil {
|
||||
return oid.Address{}, err
|
||||
}
|
||||
|
||||
var cnr cid.ID
|
||||
if err := cnr.DecodeString(s[i+1:]); err != nil {
|
||||
if err := cnr.DecodeString(after); err != nil {
|
||||
return oid.Address{}, err
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
getPrm.WithAddress(addr)
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ type StorageEngine struct {
|
|||
|
||||
mtx *sync.RWMutex
|
||||
|
||||
shards map[string]shardWrapper
|
||||
shards map[string]hashedShard
|
||||
|
||||
shardPools map[string]util.WorkerPool
|
||||
|
||||
|
@ -223,7 +223,7 @@ func New(opts ...Option) *StorageEngine {
|
|||
return &StorageEngine{
|
||||
cfg: c,
|
||||
mtx: new(sync.RWMutex),
|
||||
shards: make(map[string]shardWrapper),
|
||||
shards: make(map[string]hashedShard),
|
||||
shardPools: make(map[string]util.WorkerPool),
|
||||
closeCh: make(chan struct{}),
|
||||
setModeCh: make(chan setModeRequest),
|
||||
|
|
|
@ -21,6 +21,7 @@ import (
|
|||
oidtest "github.com/TrueCloudLab/frostfs-sdk-go/object/id/test"
|
||||
usertest "github.com/TrueCloudLab/frostfs-sdk-go/user/test"
|
||||
"github.com/TrueCloudLab/frostfs-sdk-go/version"
|
||||
"github.com/TrueCloudLab/hrw"
|
||||
"github.com/TrueCloudLab/tzhash/tz"
|
||||
"github.com/panjf2000/ants/v2"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -86,9 +87,12 @@ func testNewEngineWithShards(shards ...*shard.Shard) *StorageEngine {
|
|||
panic(err)
|
||||
}
|
||||
|
||||
engine.shards[s.ID().String()] = shardWrapper{
|
||||
errorCount: atomic.NewUint32(0),
|
||||
Shard: s,
|
||||
engine.shards[s.ID().String()] = hashedShard{
|
||||
shardWrapper: shardWrapper{
|
||||
errorCount: atomic.NewUint32(0),
|
||||
Shard: s,
|
||||
},
|
||||
hash: hrw.Hash([]byte(s.ID().String())),
|
||||
}
|
||||
engine.shardPools[s.ID().String()] = pool
|
||||
}
|
||||
|
|
|
@ -151,7 +151,7 @@ mainLoop:
|
|||
return res, err
|
||||
}
|
||||
|
||||
hrw.SortSliceByWeightValue(shards, weights, hrw.Hash([]byte(addr.EncodeToString())))
|
||||
hrw.SortHasherSliceByWeightValue(shards, weights, hrw.Hash([]byte(addr.EncodeToString())))
|
||||
for j := range shards {
|
||||
if _, ok := shardMap[shards[j].ID().String()]; ok {
|
||||
continue
|
||||
|
|
|
@ -16,7 +16,10 @@ import (
|
|||
|
||||
var errShardNotFound = logicerr.New("shard not found")
|
||||
|
||||
type hashedShard shardWrapper
|
||||
type hashedShard struct {
|
||||
shardWrapper
|
||||
hash uint64
|
||||
}
|
||||
|
||||
type metricsWithID struct {
|
||||
id string
|
||||
|
@ -127,9 +130,12 @@ func (e *StorageEngine) addShard(sh *shard.Shard) error {
|
|||
return fmt.Errorf("shard with id %s was already added", strID)
|
||||
}
|
||||
|
||||
e.shards[strID] = shardWrapper{
|
||||
errorCount: atomic.NewUint32(0),
|
||||
Shard: sh,
|
||||
e.shards[strID] = hashedShard{
|
||||
shardWrapper: shardWrapper{
|
||||
errorCount: atomic.NewUint32(0),
|
||||
Shard: sh,
|
||||
},
|
||||
hash: hrw.Hash([]byte(strID)),
|
||||
}
|
||||
|
||||
e.shardPools[strID] = pool
|
||||
|
@ -144,7 +150,7 @@ func (e *StorageEngine) removeShards(ids ...string) {
|
|||
return
|
||||
}
|
||||
|
||||
ss := make([]shardWrapper, 0, len(ids))
|
||||
ss := make([]hashedShard, 0, len(ids))
|
||||
|
||||
e.mtx.Lock()
|
||||
for _, id := range ids {
|
||||
|
@ -210,7 +216,7 @@ func (e *StorageEngine) sortShardsByWeight(objAddr interface{ EncodeToString() s
|
|||
weights = append(weights, e.shardWeight(sh.Shard))
|
||||
}
|
||||
|
||||
hrw.SortSliceByWeightValue(shards, weights, hrw.Hash([]byte(objAddr.EncodeToString())))
|
||||
hrw.SortHasherSliceByWeightValue(shards, weights, hrw.Hash([]byte(objAddr.EncodeToString())))
|
||||
|
||||
return shards
|
||||
}
|
||||
|
@ -276,7 +282,5 @@ func (e *StorageEngine) HandleNewEpoch(epoch uint64) {
|
|||
}
|
||||
|
||||
func (s hashedShard) Hash() uint64 {
|
||||
return hrw.Hash(
|
||||
[]byte(s.Shard.ID().String()),
|
||||
)
|
||||
return s.hash
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ func Write(logger *logger.Logger, fields ...zap.Field) {
|
|||
// AddressField returns logger's field for object address.
|
||||
//
|
||||
// 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)
|
||||
}
|
||||
|
||||
|
|
|
@ -179,7 +179,7 @@ func wrapFrostFSError(err error) error {
|
|||
|
||||
// Invoke invokes contract method by sending transaction into blockchain.
|
||||
// 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()
|
||||
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
|
||||
// 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()
|
||||
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.
|
||||
//
|
||||
// Wraps any error to frostfsError.
|
||||
func toStackParameter(value interface{}) (sc.Parameter, error) {
|
||||
func toStackParameter(value any) (sc.Parameter, error) {
|
||||
var result = sc.Parameter{
|
||||
Value: value,
|
||||
}
|
||||
|
|
|
@ -10,9 +10,9 @@ import (
|
|||
|
||||
func TestToStackParameter(t *testing.T) {
|
||||
items := []struct {
|
||||
value interface{}
|
||||
value any
|
||||
expType sc.ParamType
|
||||
expVal interface{}
|
||||
expVal any
|
||||
}{
|
||||
{
|
||||
value: []byte{1, 2, 3},
|
||||
|
|
|
@ -191,7 +191,7 @@ func (c *Client) readBoolConfig(key string) (bool, error) {
|
|||
type SetConfigPrm struct {
|
||||
id []byte
|
||||
key []byte
|
||||
value interface{}
|
||||
value any
|
||||
|
||||
client.InvokePrmOptional
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ func (s *SetConfigPrm) SetKey(key []byte) {
|
|||
}
|
||||
|
||||
// SetValue sets value of the config value.
|
||||
func (s *SetConfigPrm) SetValue(value interface{}) {
|
||||
func (s *SetConfigPrm) SetValue(value any) {
|
||||
s.value = value
|
||||
}
|
||||
|
||||
|
@ -359,7 +359,7 @@ 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) (interface{}, error)) (interface{}, error) {
|
||||
func (c *Client) config(key []byte, assert func(stackitem.Item) (any, error)) (any, error) {
|
||||
prm := client.TestInvokePrm{}
|
||||
prm.SetMethod(configMethod)
|
||||
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.
|
||||
func IntegerAssert(item stackitem.Item) (interface{}, error) {
|
||||
func IntegerAssert(item stackitem.Item) (any, error) {
|
||||
return client.IntFromStackItem(item)
|
||||
}
|
||||
|
||||
// StringAssert converts stack item to string.
|
||||
func StringAssert(item stackitem.Item) (interface{}, error) {
|
||||
func StringAssert(item stackitem.Item) (any, error) {
|
||||
return client.StringFromStackItem(item)
|
||||
}
|
||||
|
||||
// BoolAssert converts stack item to bool.
|
||||
func BoolAssert(item stackitem.Item) (interface{}, error) {
|
||||
func BoolAssert(item stackitem.Item) (any, error) {
|
||||
return client.BoolFromStackItem(item)
|
||||
}
|
||||
|
||||
|
|
|
@ -194,7 +194,7 @@ func (c *Client) depositNotary(amount fixedn.Fixed8, till int64) (res util.Uint2
|
|||
c.accAddr,
|
||||
c.notary.notary,
|
||||
big.NewInt(int64(amount)),
|
||||
[]interface{}{c.acc.PrivateKey().GetScriptHash(), till})
|
||||
[]any{c.acc.PrivateKey().GetScriptHash(), till})
|
||||
if err != nil {
|
||||
if !errors.Is(err, neorpc.ErrAlreadyExists) {
|
||||
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()`.
|
||||
//
|
||||
// `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()
|
||||
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.
|
||||
//
|
||||
// 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()
|
||||
defer c.switchLock.RUnlock()
|
||||
|
||||
|
@ -440,12 +440,12 @@ func (c *Client) NotarySignAndInvokeTX(mainTx *transaction.Transaction) error {
|
|||
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()
|
||||
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
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -750,7 +750,7 @@ func (c *Client) depositExpirationOf() (int64, error) {
|
|||
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))
|
||||
|
||||
for i := range args {
|
||||
|
|
|
@ -151,7 +151,7 @@ func (s StaticClient) Invoke(prm InvokePrm) error {
|
|||
// TestInvokePrm groups parameters of the TestInvoke operation.
|
||||
type TestInvokePrm struct {
|
||||
method string
|
||||
args []interface{}
|
||||
args []any
|
||||
}
|
||||
|
||||
// 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.
|
||||
func (ti *TestInvokePrm) SetArgs(args ...interface{}) {
|
||||
func (ti *TestInvokePrm) SetArgs(args ...any) {
|
||||
ti.args = args
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ type ManageAdminsRes struct{}
|
|||
func (x Client) ManageAdmins(prm ManageAdminsPrm) (*ManageAdminsPrm, error) {
|
||||
var method string
|
||||
|
||||
args := make([]interface{}, 1, 3)
|
||||
args := make([]any, 1, 3)
|
||||
args[0] = prm.subnet
|
||||
|
||||
if prm.client {
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
// UserAllowedPrm groups parameters of UserAllowed method of Subnet contract.
|
||||
type UserAllowedPrm struct {
|
||||
args [2]interface{}
|
||||
args [2]any
|
||||
}
|
||||
|
||||
// SetID sets identifier of the subnet in a binary FrostFS API protocol format.
|
||||
|
@ -64,7 +64,7 @@ type ManageClientsPrm struct {
|
|||
// remove or add client
|
||||
rm bool
|
||||
|
||||
args [3]interface{}
|
||||
args [3]any
|
||||
}
|
||||
|
||||
// SetRemove marks client to be removed. By default, client is added.
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
type DeletePrm struct {
|
||||
cliPrm client.InvokePrm
|
||||
|
||||
args [1]interface{}
|
||||
args [1]any
|
||||
}
|
||||
|
||||
// SetTxHash sets hash of the transaction which spawned the notification.
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
// GetPrm groups parameters of Get method of Subnet contract.
|
||||
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.
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
type NodeAllowedPrm struct {
|
||||
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.
|
||||
|
|
|
@ -9,7 +9,7 @@ type ManageNodesPrm struct {
|
|||
// remove or add node
|
||||
rm bool
|
||||
|
||||
args [2]interface{}
|
||||
args [2]any
|
||||
}
|
||||
|
||||
// SetRemove marks node to be removed. By default, node is added.
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
type PutPrm struct {
|
||||
cliPrm client.InvokePrm
|
||||
|
||||
args [3]interface{}
|
||||
args [3]any
|
||||
}
|
||||
|
||||
// SetTxHash sets hash of the transaction which spawned the notification.
|
||||
|
|
|
@ -341,7 +341,7 @@ func TestPrepare_CorrectNR(t *testing.T) {
|
|||
tests := []struct {
|
||||
hash util.Uint160
|
||||
method string
|
||||
args []interface{}
|
||||
args []any
|
||||
}{
|
||||
{
|
||||
scriptHash,
|
||||
|
@ -351,10 +351,10 @@ func TestPrepare_CorrectNR(t *testing.T) {
|
|||
{
|
||||
scriptHash,
|
||||
"test2",
|
||||
[]interface{}{
|
||||
[]any{
|
||||
int64(4),
|
||||
"test",
|
||||
[]interface{}{
|
||||
[]any{
|
||||
int64(4),
|
||||
false,
|
||||
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()
|
||||
|
||||
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) {
|
||||
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))
|
||||
},
|
||||
)
|
||||
|
|
|
@ -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) {
|
||||
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))
|
||||
},
|
||||
func() util.ResponseMessage {
|
||||
|
|
|
@ -57,7 +57,7 @@ type Controller struct {
|
|||
|
||||
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))
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ type Builder struct {
|
|||
|
||||
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))
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ type Router struct {
|
|||
|
||||
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))
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
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))
|
||||
},
|
||||
)
|
||||
|
@ -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) {
|
||||
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))
|
||||
},
|
||||
)
|
||||
|
@ -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) {
|
||||
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))
|
||||
},
|
||||
)
|
||||
|
@ -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) {
|
||||
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))
|
||||
},
|
||||
)
|
||||
|
@ -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) {
|
||||
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))
|
||||
},
|
||||
)
|
||||
|
@ -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) {
|
||||
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))
|
||||
},
|
||||
)
|
||||
|
@ -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) {
|
||||
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))
|
||||
},
|
||||
)
|
||||
|
|
|
@ -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) {
|
||||
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))
|
||||
},
|
||||
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) {
|
||||
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))
|
||||
},
|
||||
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) {
|
||||
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))
|
||||
},
|
||||
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) {
|
||||
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))
|
||||
},
|
||||
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) {
|
||||
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))
|
||||
},
|
||||
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) {
|
||||
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))
|
||||
},
|
||||
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) {
|
||||
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))
|
||||
},
|
||||
func() util.ResponseMessage {
|
||||
|
|
|
@ -15,7 +15,7 @@ type Server struct {
|
|||
allowedKeys [][]byte
|
||||
}
|
||||
|
||||
func panicOnPrmValue(n string, v interface{}) {
|
||||
func panicOnPrmValue(n string, v any) {
|
||||
const invalidPrmValFmt = "invalid %s parameter (%T): %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) {
|
||||
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))
|
||||
},
|
||||
)
|
||||
|
@ -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) {
|
||||
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))
|
||||
},
|
||||
)
|
||||
|
@ -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) {
|
||||
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))
|
||||
},
|
||||
)
|
||||
|
|
|
@ -25,7 +25,7 @@ func (s *signService) LocalNodeInfo(
|
|||
ctx context.Context,
|
||||
req *netmap.LocalNodeInfoRequest) (*netmap.LocalNodeInfoResponse, error) {
|
||||
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))
|
||||
},
|
||||
func() util.ResponseMessage {
|
||||
|
@ -41,7 +41,7 @@ func (s *signService) LocalNodeInfo(
|
|||
|
||||
func (s *signService) NetworkInfo(ctx context.Context, req *netmap.NetworkInfoRequest) (*netmap.NetworkInfoResponse, error) {
|
||||
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))
|
||||
},
|
||||
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) {
|
||||
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))
|
||||
},
|
||||
func() util.ResponseMessage {
|
||||
|
|
|
@ -52,7 +52,7 @@ type Notificator struct {
|
|||
// Panics if any field of the passed Prm structure is not set/set
|
||||
// to nil.
|
||||
func New(prm *Prm) *Notificator {
|
||||
panicOnNil := func(v interface{}, name string) {
|
||||
panicOnNil := func(v any, name string) {
|
||||
if v == nil {
|
||||
panic(fmt.Sprintf("Notificator constructor: %s is nil\n", name))
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ var (
|
|||
// NewChecker creates Checker.
|
||||
// Panics if at least one of the parameter is nil.
|
||||
func NewChecker(prm *CheckerPrm) *Checker {
|
||||
panicOnNil := func(fieldName string, field interface{}) {
|
||||
panicOnNil := func(fieldName string, field any) {
|
||||
if field == nil {
|
||||
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.
|
||||
func (c *Checker) CheckEACL(msg interface{}, reqInfo v2.RequestInfo) error {
|
||||
func (c *Checker) CheckEACL(msg any, reqInfo v2.RequestInfo) error {
|
||||
basicACL := reqInfo.BasicACL()
|
||||
if !basicACL.Extendable() {
|
||||
return nil
|
||||
|
|
|
@ -32,7 +32,7 @@ type RequestInfo struct {
|
|||
|
||||
bearer *bearer.Token // bearer token of request
|
||||
|
||||
srcRequest interface{}
|
||||
srcRequest any
|
||||
}
|
||||
|
||||
func (r *RequestInfo) SetBasicACL(basicACL acl.Basic) {
|
||||
|
@ -48,7 +48,7 @@ func (r *RequestInfo) SetSenderKey(senderKey []byte) {
|
|||
}
|
||||
|
||||
// Request returns raw API request.
|
||||
func (r RequestInfo) Request() interface{} {
|
||||
func (r RequestInfo) Request() any {
|
||||
return r.srcRequest
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ type MetaWithToken struct {
|
|||
vheader *sessionV2.RequestVerificationHeader
|
||||
token *sessionSDK.Object
|
||||
bearer *bearer.Token
|
||||
src interface{}
|
||||
src any
|
||||
}
|
||||
|
||||
// RequestOwner returns ownerID and its public key
|
||||
|
|
|
@ -86,7 +86,7 @@ func New(opts ...Option) Service {
|
|||
opts[i](cfg)
|
||||
}
|
||||
|
||||
panicOnNil := func(v interface{}, name string) {
|
||||
panicOnNil := func(v any, name string) {
|
||||
if v == nil {
|
||||
panic(fmt.Sprintf("ACL service: %s is nil", name))
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ type ACLChecker interface {
|
|||
CheckBasicACL(RequestInfo) bool
|
||||
// CheckEACL must return non-nil error if request
|
||||
// doesn't pass extended ACL validation.
|
||||
CheckEACL(interface{}, RequestInfo) error
|
||||
CheckEACL(any, RequestInfo) error
|
||||
// StickyBitCheck must return true only if sticky bit
|
||||
// is disabled or enabled but request contains correct
|
||||
// owner field.
|
||||
|
|
|
@ -20,7 +20,7 @@ import (
|
|||
|
||||
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 id cid.ID
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
const defaultAllocSize = 1024
|
||||
|
||||
var putBytesPool = &sync.Pool{
|
||||
New: func() interface{} { return make([]byte, 0, defaultAllocSize) },
|
||||
New: func() any { return make([]byte, 0, defaultAllocSize) },
|
||||
}
|
||||
|
||||
func getPayload() []byte {
|
||||
|
|
|
@ -116,9 +116,9 @@ func WithNetworkMapSource(v netmap.Source) Option {
|
|||
}
|
||||
}
|
||||
|
||||
func WithWorkerPools(remote util.WorkerPool) Option {
|
||||
func WithWorkerPools(remote, local util.WorkerPool) Option {
|
||||
return func(c *cfg) {
|
||||
c.remotePool = remote
|
||||
c.remotePool, c.localPool = remote, local
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ func (s *ResponseService) Put(ctx context.Context) (PutObjectStream, error) {
|
|||
|
||||
return &putStreamResponser{
|
||||
stream: s.respSvc.CreateRequestStreamer(
|
||||
func(req interface{}) error {
|
||||
func(req any) error {
|
||||
return stream.Send(req.(*object.PutRequest))
|
||||
},
|
||||
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) {
|
||||
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))
|
||||
},
|
||||
)
|
||||
|
@ -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) {
|
||||
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))
|
||||
},
|
||||
)
|
||||
|
@ -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) {
|
||||
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))
|
||||
},
|
||||
)
|
||||
|
|
|
@ -91,7 +91,7 @@ func (s *SignService) Put(ctx context.Context) (PutObjectStream, error) {
|
|||
|
||||
return &putStreamSigner{
|
||||
stream: s.sigSvc.CreateRequestStreamer(
|
||||
func(req interface{}) error {
|
||||
func(req any) error {
|
||||
return stream.Send(req.(*object.PutRequest))
|
||||
},
|
||||
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) {
|
||||
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))
|
||||
},
|
||||
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) {
|
||||
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))
|
||||
},
|
||||
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) {
|
||||
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))
|
||||
},
|
||||
func() util.ResponseMessage {
|
||||
|
|
|
@ -14,7 +14,7 @@ type HeadReceiver interface {
|
|||
// Head must return one of:
|
||||
// * object header (*object.Object);
|
||||
// * 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.
|
||||
|
|
|
@ -40,7 +40,7 @@ func NewChecker(oo ...Option) *ExpirationChecker {
|
|||
o(cfg)
|
||||
}
|
||||
|
||||
panicOnNil := func(v interface{}, name string) {
|
||||
panicOnNil := func(v any, name string) {
|
||||
if v == nil {
|
||||
panic(fmt.Sprintf("tombstone getter constructor: %s is nil", name))
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ func (mb *managerBuilder) BuildManagers(epoch uint64, p apireputation.PeerID) ([
|
|||
|
||||
copy(nodes, nmNodes)
|
||||
|
||||
hrw.SortSliceByValue(nodes, epoch)
|
||||
hrw.SortHasherSliceByValue(nodes, epoch)
|
||||
|
||||
for i := range nodes {
|
||||
if apireputation.ComparePeerKey(p, nodes[i].PublicKey()) {
|
||||
|
|
|
@ -52,7 +52,7 @@ type Router struct {
|
|||
|
||||
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))
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ type Calculator struct {
|
|||
|
||||
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))
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ type Controller struct {
|
|||
|
||||
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))
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ type Builder struct {
|
|||
|
||||
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))
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ type Controller struct {
|
|||
|
||||
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))
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ type Builder struct {
|
|||
|
||||
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))
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
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))
|
||||
},
|
||||
)
|
||||
|
@ -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) {
|
||||
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))
|
||||
},
|
||||
)
|
||||
|
|
|
@ -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) {
|
||||
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))
|
||||
},
|
||||
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) {
|
||||
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))
|
||||
},
|
||||
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) {
|
||||
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))
|
||||
},
|
||||
)
|
||||
|
|
|
@ -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) {
|
||||
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))
|
||||
},
|
||||
func() util.ResponseMessage {
|
||||
|
|
|
@ -17,7 +17,7 @@ type ClientMessageStreamer struct {
|
|||
}
|
||||
|
||||
// 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 {
|
||||
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.
|
||||
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
|
||||
resp, err := handler(ctx, req)
|
||||
if err != nil {
|
||||
|
|
|
@ -21,7 +21,7 @@ type ResponseMessage interface {
|
|||
SetMetaHeader(*session.ResponseMetaHeader)
|
||||
}
|
||||
|
||||
type UnaryHandler func(context.Context, interface{}) (ResponseMessage, error)
|
||||
type UnaryHandler func(context.Context, any) (ResponseMessage, error)
|
||||
|
||||
type SignService struct {
|
||||
key *ecdsa.PrivateKey
|
||||
|
@ -29,7 +29,7 @@ type SignService struct {
|
|||
|
||||
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)
|
||||
|
||||
|
@ -37,7 +37,7 @@ var ErrAbortStream = errors.New("abort message stream")
|
|||
|
||||
type ResponseConstructor func() ResponseMessage
|
||||
|
||||
type RequestMessageWriter func(interface{}) error
|
||||
type RequestMessageWriter func(any) 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
|
||||
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(
|
||||
req interface{},
|
||||
req any,
|
||||
respWriter ResponseMessageWriter,
|
||||
blankResp ResponseConstructor,
|
||||
respWriterCaller func(ResponseMessageWriter) error,
|
||||
|
@ -172,7 +172,7 @@ func (s *SignService) HandleServerStreamRequest(
|
|||
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)
|
||||
|
||||
// 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:
|
||||
// - 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.
|
||||
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)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("could not sign response: %w", err)
|
||||
|
|
|
@ -19,29 +19,29 @@ func ReadNodeAttributes(dst *netmap.NodeInfo, attrs []string) error {
|
|||
for i := range attrs {
|
||||
line := replaceEscaping(attrs[i], false) // replaced escaped symbols with non-printable symbols
|
||||
|
||||
words := strings.Split(line, keyValueSeparator)
|
||||
if len(words) != 2 {
|
||||
k, v, found := strings.Cut(line, keyValueSeparator)
|
||||
if !found {
|
||||
return errors.New("missing attribute key and/or value")
|
||||
}
|
||||
|
||||
_, ok := cache[words[0]]
|
||||
_, ok := cache[k]
|
||||
if ok {
|
||||
return fmt.Errorf("duplicated keys %s", words[0])
|
||||
return fmt.Errorf("duplicated keys %s", k)
|
||||
}
|
||||
|
||||
cache[words[0]] = struct{}{}
|
||||
cache[k] = struct{}{}
|
||||
|
||||
// replace non-printable symbols with escaped symbols without escape character
|
||||
words[0] = replaceEscaping(words[0], true)
|
||||
words[1] = replaceEscaping(words[1], true)
|
||||
k = replaceEscaping(k, true)
|
||||
v = replaceEscaping(v, true)
|
||||
|
||||
if words[0] == "" {
|
||||
if k == "" {
|
||||
return errors.New("empty key")
|
||||
} else if words[1] == "" {
|
||||
} else if v == "" {
|
||||
return errors.New("empty value")
|
||||
}
|
||||
|
||||
dst.SetAttribute(words[0], words[1])
|
||||
dst.SetAttribute(k, v)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
@ -37,15 +37,15 @@ type Server struct {
|
|||
|
||||
const invalidValFmt = "invalid %s %s (%T): %v"
|
||||
|
||||
func panicOnPrmValue(n string, v interface{}) {
|
||||
func panicOnPrmValue(n string, v any) {
|
||||
panicOnValue("parameter", n, v)
|
||||
}
|
||||
|
||||
func panicOnOptValue(n string, v interface{}) {
|
||||
func panicOnOptValue(n string, v any) {
|
||||
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))
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ type pathMode struct {
|
|||
|
||||
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))
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ type DB struct {
|
|||
|
||||
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))
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ type DB struct {
|
|||
|
||||
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))
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ type Table struct {
|
|||
|
||||
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))
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue