diff --git a/README.md b/README.md index 943fcceced..a96ce8e657 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ NeoFS Nodes are organized in a peer-to-peer network that takes care of storing and distributing user's data. Any Neo user may participate in the network and -get paid for providing storage resources to other users or store his data in +get paid for providing storage resources to other users or store their data in NeoFS and pay a competitive price for it. Users can reliably store object data in the NeoFS network and have a transparent @@ -40,7 +40,7 @@ developers to integrate applications without rewriting their code. # Supported platforms -For now we only support GNU/Linux on amd64 CPUs with AVX/AVX2 instructions. More +Now, we only support GNU/Linux on amd64 CPUs with AVX/AVX2 instructions. More platforms will be officially supported after release `1.0`. The latest version of neofs-node works with neofs-contract diff --git a/cmd/neofs-adm/README.md b/cmd/neofs-adm/README.md index d2c133235e..735272e889 100644 --- a/cmd/neofs-adm/README.md +++ b/cmd/neofs-adm/README.md @@ -5,14 +5,14 @@ Admin tool provides an easier way to deploy and maintain private installation of NeoFS. Private installation provides a set of N3 consensus nodes, NeoFS Alphabet, and Storage nodes. Admin tool generates consensus keys, initializes -side chain, and provides functions to update the network and register new +the sidechain, and provides functions to update the network and register new Storage nodes. ## Build To build binary locally, use `make bin/neofs-adm` command. -For clean build inside a docker container use `make docker/bin/neofs-adm`. +For clean build inside a docker container, use `make docker/bin/neofs-adm`. Build docker image with `make image-adm`. @@ -25,18 +25,18 @@ contracts. Find them in the latest release of ### Config -Config section provides `init` command that creates configuration file for the +Config section provides `init` command that creates a configuration file for private installation deployment and updates. Config file is optional, all parameters can be passed by arguments or read from standard input (wallet passwords). Config example: ```yaml -rpc-endpoint: https://address:port # side chain RPC node endpoint +rpc-endpoint: https://address:port # sidechain RPC node endpoint alphabet-wallets: /path # path to consensus node / alphabet wallets storage network: - max_object_size: 67108864 # max size of single NeoFS object, bytes - epoch_duration: 240 # duration of NeoFS epoch in blocks, consider block generation frequency in side chain + max_object_size: 67108864 # max size of a single NeoFS object, bytes + epoch_duration: 240 # duration of a NeoFS epoch in blocks, consider block generation frequency in the sidechain basic_income_rate: 0 # basic income rate, for private consider 0 fee: audit: 0 # network audit fee, for private installation consider 0 @@ -61,11 +61,11 @@ credentials: # passwords for consensus node / alphabet wallets - `generate-alphabet` generates a set of wallets for consensus and Alphabet nodes. -- `init` initializes side chain by deploying smart contracts and +- `init` initializes the sidechain by deploying smart contracts and setting provided NeoFS network configuration. -- `generate-storage-wallet` generates wallet for the Storage node that - is ready for deployment. It also transfers a bit of side chain GAS, so this +- `generate-storage-wallet` generates a wallet for the Storage node that + is ready for deployment. It also transfers a bit of sidechain GAS, so this wallet can be used for NeoFS bootstrap. #### Network maintenance @@ -73,20 +73,20 @@ credentials: # passwords for consensus node / alphabet wallets - `force-new-epoch` increments NeoFS epoch number and executes new epoch handlers in NeoFS nodes. -- `refill-gas` transfers side chain GAS to the specified wallet. +- `refill-gas` transfers sidechain GAS to the specified wallet. - `update-contracts` updates contracts to a new version. #### Container migration -If the network has to be redeployed, these commands will migrate all container meta +If a network has to be redeployed, these commands will migrate all container meta info. These commands **do not migrate actual objects**. - `dump-containers` saves all containers and metadata registered in the container contract to a file. - `restore-containers` restores previously saved containers by their repeated registration in - container contract. + the container contract. #### Network info diff --git a/cmd/neofs-adm/docs/deploy.md b/cmd/neofs-adm/docs/deploy.md index bf2feeb57b..40f23945f2 100644 --- a/cmd/neofs-adm/docs/deploy.md +++ b/cmd/neofs-adm/docs/deploy.md @@ -1,6 +1,6 @@ # Step-by-step private NeoFS deployment -This is a short guide on how to deploy private NeoFS storage network on bare +This is a short guide on how to deploy a private NeoFS storage network on bare metal without docker images. This guide does not cover details on how to start consensus, Alphabet, or Storage nodes. This guide covers only `neofs-adm` related configuration details. @@ -14,13 +14,13 @@ To follow this guide you need: ## Step 1: Prepare network configuration -To start the network, you need a set of consensus nodes, the same number of +To start a network, you need a set of consensus nodes, the same number of Alphabet nodes and any number of Storage nodes. While the number of Storage nodes can be scaled almost infinitely, the number of consensus and Alphabet nodes can't be changed so easily right now. Consider this before going any further. -It is easier to use`neofs-adm` with predefined configuration. First, create -network configuration file. In this example, there is going to be only one +It is easier to use`neofs-adm` with a predefined configuration. First, create +a network configuration file. In this example, there is going to be only one consensus / Alphabet node in the network. ``` @@ -43,7 +43,7 @@ credentials: az: hunter2 ``` -For private installation it is recommended to set all **fees** and **basic +For private installation, it is recommended to set all **fees** and **basic income rate** to 0. As for **epoch duration**, consider consensus node block generation frequency. @@ -63,7 +63,7 @@ alphabet-wallets: /home/user/deploy/alphabet-wallets wallet[0]: hunter2 ``` -Do not lose wallet files and network config. Store it in encrypted backed up +Do not lose wallet files and network config. Store it in an encrypted backed up storage. ## Step 2: Launch consensus nodes @@ -72,7 +72,7 @@ Configure blockchain nodes with the generated wallets from the previous step. Config examples can be found in [neo-go repository](https://github.com/nspcc-dev/neo-go/tree/master/config). -Gather public keys from **all** generated wallets. We are interested in first +Gather public keys from **all** generated wallets. We are interested in the first `simple signature contract` public key. ``` @@ -90,7 +90,7 @@ NiMKabp3ddi3xShmLAXhTfbnuWb4cSJT6E (1 out of 1 multisig contract): Put the list of public keys into `ProtocolConfiguration.StandbyCommittee` section. Specify the wallet path and the password in `ApplicationConfiguration.P2PNotary` and `ApplicationConfiguration.UnlockWallet` sections. If config includes -`ProtocolConfiguration.NativeActivations` section, then add notary +`ProtocolConfiguration.NativeActivations` section, add notary contract `Notary: [0]`. ```yaml @@ -110,15 +110,15 @@ ApplicationConfiguration: Password: "hunter2" ``` -Then, launch consensus node. They should connect to each other and start +Then, launch consensus nodes. They should connect to each other and start producing blocks in consensus. You might want to deploy additional RPC nodes at this stage because Storage nodes should be connected to the chain too. -It is not recommended to use consensus node as an RPC node due to security policies +It is not recommended to use a consensus node as an RPC node due to security policies and possible overload issues. -## Step 3: Initialize side chain +## Step 3: Initialize sidechain -Use archive with compiled NeoFS contracts to initialize side chain. +Use archive with compiled NeoFS contracts to initialize the sidechain. ``` $ tar -xzvf neofs-contract-v0.11.0.tar.gz @@ -154,7 +154,7 @@ Waiting for transactions to persist... ## Step 4: Launch Alphabet nodes Configure Alphabet nodes with the wallets generated in step 1. For -`morph.validators` use list of public keys from +`morph.validators` use a list of public keys from `ProtocolConfiguration.StandbyCommittee`. ```yaml @@ -174,7 +174,7 @@ contracts: ## Step 4: Launch Storage node -Generate a new wallet for Storage node. +Generate a new wallet for a Storage node. ``` $ neofs-adm -c foo.network.yml morph generate-storage-wallet --storage-wallet ./sn01.json --initial-gas 10.0 @@ -186,7 +186,7 @@ Ngr7p8Z9S22XDH6VkUG9oXobv8zZRAWwwv (simple signature contract): 0355eccb72cd46f09a3e5237eaa0f4949cceb5ecfa5a225bd3bb9fd021c4d75b85 ``` -Configure Storage node to use this wallet. +Configure the Storage node to use this wallet. ``` node: @@ -196,7 +196,7 @@ node: password: "foobar" ``` -Storage node will be included in the network map in next NeoFS epoch. To +The storage node will be included in the network map in the next NeoFS epoch. To speed up this process, you can increment epoch counter immediately. ``` @@ -207,5 +207,5 @@ Waiting for transactions to persist... --- -After that NeoFS Storage is ready to work. You can access it directly or +After that, NeoFS Storage is ready to work. You can access it directly or with protocol gates. diff --git a/cmd/neofs-adm/docs/subnetwork-creation.md b/cmd/neofs-adm/docs/subnetwork-creation.md index fcb906fe0d..0d5e42c667 100644 --- a/cmd/neofs-adm/docs/subnetwork-creation.md +++ b/cmd/neofs-adm/docs/subnetwork-creation.md @@ -1,13 +1,13 @@ # NeoFS subnetwork creation This is a short guide on how to create NeoFS subnetworks. This guide -considers that side chain and inner ring (alphabet nodes) have already -been deployed and side chain contains deployed `subnet` contract. +considers that the sidechain and the inner ring (alphabet nodes) have already been +deployed and the sidechain contains a deployed `subnet` contract. ## Prerequisites -To follow this guide you need: -- neo-go side chain RPC endpoint; +To follow this guide, you need: +- neo-go sidechain RPC endpoint; - latest released version of [neofs-adm](https://github.com/nspcc-dev/neofs-node/releases); - wallet with NeoFS account. @@ -21,13 +21,13 @@ $ neofs-adm morph subnet create \ Create subnet request sent successfully. ID: 4223489767. ``` -**NOTE:** use `--notary` only in notary-enabled environmental. You need to -have sufficient notary deposit (not expired with enough GAS balance). This -is the only one command that requires alphabet signature and, therefore, -the only one command that needs `--notary` flag. Your subnet ID will differ +**NOTE:** use `--notary` only in a notary-enabled environment. You need to +have a sufficient notary deposit (not expired, with enough GAS balance). This +is the only command that requires an alphabet signature and, therefore, +the only command that needs `--notary` flag. Your subnet ID will differ from the example. -Default account in the wallet that was passed with `-w` flag is the owner +The default account in the wallet that has been passed with `-w` flag is the owner of the just created subnetwork. You can check if your subnetwork was created successfully: diff --git a/cmd/neofs-adm/docs/subnetwork-usage.md b/cmd/neofs-adm/docs/subnetwork-usage.md index a0bcd5783c..511fc2f209 100644 --- a/cmd/neofs-adm/docs/subnetwork-usage.md +++ b/cmd/neofs-adm/docs/subnetwork-usage.md @@ -1,24 +1,24 @@ # Managing Subnetworks This is a short guide on how to manage NeoFS subnetworks. This guide -considers that side chain and inner ring (alphabet nodes) have already -been deployed and side chain contains deployed `subnet` contract. +considers that the sidechain and the inner ring (alphabet nodes) have already been +deployed, and the sidechain contains a deployed `subnet` contract. ## Prerequisites -- neo-go side chain RPC endpoint; +- neo-go sidechain RPC endpoint; - latest released version of [neofs-adm](https://github.com/nspcc-dev/neofs-node/releases); - [created](subnetwork-creation.md) subnetwork; -- wallet with account that owns the subnetwork; +- wallet with the account that owns the subnetwork; - public key of the Storage Node; - public keys of the node and client administrators; - owner IDs of the NeoFS users. ## Add node administrator -Node administrators are the accounts that can manage (add and delete nodes) -whitelist of the nodes that could be included to the subnetwork. Only subnet -owner is allowed to add and remove node administrators from subnetwork. +Node administrators are accounts that can manage (add and delete nodes) +the whitelist of the nodes which can be included to a subnetwork. Only the subnet +owner is allowed to add and remove node administrators from the subnetwork. ```shell $ neofs-adm morph subnet admin add \ @@ -33,7 +33,7 @@ Add admin request sent successfully. Adding a node to a subnetwork means that the node becomes able to service containers that have been created in that subnetwork. Addition only changes -list of the allowed nodes. Node is not required to be bootstrapped at the +the list of the allowed nodes. Node is not required to be bootstrapped at the moment of its inclusion. ```shell @@ -45,14 +45,14 @@ $ neofs-adm morph subnet node add \ Add node request sent successfully. ``` -**NOTE:** owner of the subnetwork is also allowed to add nodes. +**NOTE:** the owner of the subnetwork is also allowed to add nodes. ## Add client administrator -Client administrators are the accounts that can manage (add and delete -nodes) whitelist of the clients that can creates containers in the -subnetwork. Only subnet owner is allowed to add and remove client -administrators from subnetwork. +Client administrators are accounts that can manage (add and delete +nodes) the whitelist of the clients that can create containers in the +subnetwork. Only the subnet owner is allowed to add and remove client +administrators from the subnetwork. ```shell $ neofs-adm morph subnet admin add \ @@ -65,8 +65,8 @@ $ neofs-adm morph subnet admin add \ Add admin request sent successfully. ``` -**NOTE:** you do not need to create group explicitly, it would be created -right after the first client admin has been added. Group ID is 4-byte +**NOTE:** you do not need to create a group explicitly, it will be created +right after the first client admin is added. Group ID is a 4-byte positive integer number. ## Add client @@ -81,17 +81,17 @@ $ neofs-adm morph subnet client add \ Add client request sent successfully. ``` -**NOTE:** owner of the subnetwork is also allowed to add clients. This is +**NOTE:** the owner of the subnetwork is also allowed to add clients. This is the only one command that accepts `ownerID`, not the public key. -Administrator can manage only his group (a group where that administrator -has been added by subnet owner). +Administrator can manage only their group (a group where that administrator +has been added by the subnet owner). # Bootstrapping Storage Node -After subnetwork [creation](subnetwork-creation.md) and inclusion node to it, the +After a subnetwork [is created](subnetwork-creation.md) and a node is included into it, the node could be bootstrapped and service subnetwork containers. -For bootstrapping you need to specify ID of the subnetwork in the node's +For bootstrapping, you need to specify the ID of the subnetwork in the node's configuration: ```yaml @@ -108,7 +108,7 @@ node: **NOTE:** specifying subnetwork that is denied for the node is not an error: that configuration value would be ignored. You do not need to specify zero (with 0 ID) subnetwork: its inclusion is implicit. On the contrary, to exclude -node from the default zero subnetwork you need to specify it explicitly: +a node from the default zero subnetwork, you need to specify it explicitly: ```yaml ... @@ -122,11 +122,11 @@ node: # Creating container in non-zero subnetwork -Creating containers without using `--subnet` flag is equivalent to the +Creating containers without using `--subnet` flag is equivalent to creating container in the zero subnetwork. -To create container in a private network your wallet must have been added to -the client whitelist by client admins or subnet owners: +To create a container in a private network, your wallet must be added to +the client whitelist by the client admins or the subnet owners: ```shell $ neofs-cli container create \ diff --git a/cmd/neofs-adm/internal/modules/morph/initialize.go b/cmd/neofs-adm/internal/modules/morph/initialize.go index 132f401716..b58701d778 100644 --- a/cmd/neofs-adm/internal/modules/morph/initialize.go +++ b/cmd/neofs-adm/internal/modules/morph/initialize.go @@ -31,12 +31,12 @@ type cache struct { type initializeContext struct { clientContext cache - // CommitteeAcc is used for retrieving committee address and verification script. + // CommitteeAcc is used for retrieving the committee address and the verification script. CommitteeAcc *wallet.Account - // ConsensusAcc is used for retrieving committee address and verification script. + // ConsensusAcc is used for retrieving the committee address and the verification script. ConsensusAcc *wallet.Account Wallets []*wallet.Wallet - // ContractWallet is a wallet for providing contract group signature. + // ContractWallet is a wallet for providing the contract group signature. ContractWallet *wallet.Wallet // Accounts contains simple signature accounts in the same order as in Wallets. Accounts []*wallet.Account diff --git a/cmd/neofs-adm/internal/modules/morph/initialize_register.go b/cmd/neofs-adm/internal/modules/morph/initialize_register.go index 29e063f153..7d7881d68d 100644 --- a/cmd/neofs-adm/internal/modules/morph/initialize_register.go +++ b/cmd/neofs-adm/internal/modules/morph/initialize_register.go @@ -18,7 +18,7 @@ import ( "github.com/nspcc-dev/neo-go/pkg/vm/stackitem" ) -// initialAlphabetNEOAmount represents total amount of GAS distributed between alphabet nodes. +// initialAlphabetNEOAmount represents the total amount of GAS distributed between alphabet nodes. const initialAlphabetNEOAmount = native.NEOTotalSupply func (c *initializeContext) registerCandidates() error { diff --git a/cmd/neofs-adm/internal/modules/morph/initialize_transfer.go b/cmd/neofs-adm/internal/modules/morph/initialize_transfer.go index 982c9da97d..4cf689ed41 100644 --- a/cmd/neofs-adm/internal/modules/morph/initialize_transfer.go +++ b/cmd/neofs-adm/internal/modules/morph/initialize_transfer.go @@ -12,9 +12,9 @@ import ( const ( gasInitialTotalSupply = 30000000 * native.GASFactor - // initialAlphabetGASAmount represents amount of GAS given to each alphabet node. + // initialAlphabetGASAmount represents the amount of GAS given to each alphabet node. initialAlphabetGASAmount = 10_000 * native.GASFactor - // initialProxyGASAmount represents amount of GAS given to proxy contract. + // initialProxyGASAmount represents the amount of GAS given to a proxy contract. initialProxyGASAmount = 50_000 * native.GASFactor ) diff --git a/cmd/neofs-adm/internal/modules/morph/internal/types.go b/cmd/neofs-adm/internal/modules/morph/internal/types.go index 501625be9d..705ae00746 100644 --- a/cmd/neofs-adm/internal/modules/morph/internal/types.go +++ b/cmd/neofs-adm/internal/modules/morph/internal/types.go @@ -8,7 +8,7 @@ import ( ) // StringifySubnetClientGroupID returns string representation of SubnetClientGroupID using MarshalText. -// Returns string with message on error. +// Returns a string with a message on error. func StringifySubnetClientGroupID(id *SubnetClientGroupID) string { text, err := id.MarshalText() if err != nil { @@ -21,14 +21,14 @@ func StringifySubnetClientGroupID(id *SubnetClientGroupID) string { // MarshalText encodes SubnetClientGroupID into text format according to NeoFS API V2 protocol: // value in base-10 integer string format. // -// Implements encoding.TextMarshaler. +// It implements encoding.TextMarshaler. func (x *SubnetClientGroupID) MarshalText() ([]byte, error) { num := x.GetValue() // NPE safe, returns zero on nil return []byte(strconv.FormatUint(uint64(num), 10)), nil } -// UnmarshalText decodes SubnetID from the text according to NeoFS API V2 protocol: +// UnmarshalText decodes the SubnetID from the text according to NeoFS API V2 protocol: // should be base-10 integer string format with bitsize = 32. // // Returns strconv.ErrRange if integer overflows uint32. @@ -47,13 +47,13 @@ func (x *SubnetClientGroupID) UnmarshalText(txt []byte) error { return nil } -// Marshal encodes SubnetClientGroupID into a binary format of NeoFS API V2 protocol +// Marshal encodes the SubnetClientGroupID into a binary format of NeoFS API V2 protocol // (Protocol Buffers with direct field order). func (x *SubnetClientGroupID) Marshal() ([]byte, error) { return proto.Marshal(x) } -// Unmarshal decodes SubnetClientGroupID from NeoFS API V2 binary format (see Marshal). Must not be called on nil. +// Unmarshal decodes the SubnetClientGroupID from NeoFS API V2 binary format (see Marshal). Must not be called on nil. func (x *SubnetClientGroupID) Unmarshal(data []byte) error { return proto.Unmarshal(data, x) } diff --git a/cmd/neofs-cli/internal/client/client.go b/cmd/neofs-cli/internal/client/client.go index 57d6489a75..4be721061b 100644 --- a/cmd/neofs-cli/internal/client/client.go +++ b/cmd/neofs-cli/internal/client/client.go @@ -25,19 +25,19 @@ type BalanceOfPrm struct { client.PrmBalanceGet } -// BalanceOfRes groups resulting values of BalanceOf operation. +// BalanceOfRes groups the resulting values of BalanceOf operation. type BalanceOfRes struct { cliRes *client.ResBalanceGet } -// Balance returns current balance. +// Balance returns the current balance. func (x BalanceOfRes) Balance() *accounting.Decimal { return x.cliRes.Amount() } -// BalanceOf requests current balance of NeoFS user. +// BalanceOf requests the current balance of a NeoFS user. // -// Returns any error prevented the operation from completing correctly in error return. +// Returns any error which prevented the operation from completing correctly in error return. func BalanceOf(prm BalanceOfPrm) (res BalanceOfRes, err error) { res.cliRes, err = prm.cli.BalanceGet(context.Background(), prm.PrmBalanceGet) @@ -50,7 +50,7 @@ type ListContainersPrm struct { client.PrmContainerList } -// ListContainersRes groups resulting values of ListContainers operation. +// ListContainersRes groups the resulting values of ListContainers operation. type ListContainersRes struct { cliRes *client.ResContainerList } @@ -60,9 +60,9 @@ func (x ListContainersRes) IDList() []cid.ID { return x.cliRes.Containers() } -// ListContainers requests list of NeoFS user's containers. +// ListContainers requests a list of NeoFS user's containers. // -// Returns any error prevented the operation from completing correctly in error return. +// Returns any error which prevented the operation from completing correctly in error return. func ListContainers(prm ListContainersPrm) (res ListContainersRes, err error) { res.cliRes, err = prm.cli.ContainerList(context.Background(), prm.PrmContainerList) @@ -75,7 +75,7 @@ type PutContainerPrm struct { client.PrmContainerPut } -// PutContainerRes groups resulting values of PutContainer operation. +// PutContainerRes groups the resulting values of PutContainer operation. type PutContainerRes struct { cliRes *client.ResContainerPut } @@ -85,14 +85,14 @@ func (x PutContainerRes) ID() *cid.ID { return x.cliRes.ID() } -// PutContainer sends request to save container in NeoFS. +// PutContainer sends a request to save the container in NeoFS. // -// Operation is asynchronous and no guaranteed even in the absence of errors. +// Operation is asynchronous and not guaranteed even in the absence of errors. // The required time is also not predictable. // // Success can be verified by reading by identifier. // -// Returns any error prevented the operation from completing correctly in error return. +// Returns any error which prevented the operation from completing correctly in error return. func PutContainer(prm PutContainerPrm) (res PutContainerRes, err error) { res.cliRes, err = prm.cli.ContainerPut(context.Background(), prm.PrmContainerPut) @@ -110,7 +110,7 @@ func (x *GetContainerPrm) SetContainer(id cid.ID) { x.cliPrm.SetContainer(id) } -// GetContainerRes groups resulting values of GetContainer operation. +// GetContainerRes groups the resulting values of GetContainer operation. type GetContainerRes struct { cliRes *client.ResContainerGet } @@ -120,9 +120,9 @@ func (x GetContainerRes) Container() *container.Container { return x.cliRes.Container() } -// GetContainer reads container from NeoFS by ID. +// GetContainer reads a container from NeoFS by ID. // -// Returns any error prevented the operation from completing correctly in error return. +// Returns any error which prevented the operation from completing correctly in error return. func GetContainer(prm GetContainerPrm) (res GetContainerRes, err error) { res.cliRes, err = prm.cli.ContainerGet(context.Background(), prm.cliPrm) @@ -135,17 +135,17 @@ type DeleteContainerPrm struct { client.PrmContainerDelete } -// DeleteContainerRes groups resulting values of DeleteContainer operation. +// DeleteContainerRes groups the resulting values of DeleteContainer operation. type DeleteContainerRes struct{} -// DeleteContainer sends request to remove container from NeoFS by ID. +// DeleteContainer sends a request to remove a container from NeoFS by ID. // -// Operation is asynchronous and no guaranteed even in the absence of errors. +// Operation is asynchronous and not guaranteed even in the absence of errors. // The required time is also not predictable. // // Success can be verified by reading by identifier. // -// Returns any error prevented the operation from completing correctly in error return. +// Returns any error which prevented the operation from completing correctly in error return. func DeleteContainer(prm DeleteContainerPrm) (res DeleteContainerRes, err error) { _, err = prm.cli.ContainerDelete(context.Background(), prm.PrmContainerDelete) @@ -158,7 +158,7 @@ type EACLPrm struct { client.PrmContainerEACL } -// EACLRes groups resulting values of EACL operation. +// EACLRes groups the resulting values of EACL operation. type EACLRes struct { cliRes *client.ResContainerEACL } @@ -170,7 +170,7 @@ func (x EACLRes) EACL() *eacl.Table { // EACL reads eACL table from NeoFS by container ID. // -// Returns any error prevented the operation from completing correctly in error return. +// Returns any error which prevented the operation from completing correctly in error return. func EACL(prm EACLPrm) (res EACLRes, err error) { res.cliRes, err = prm.cli.ContainerEACL(context.Background(), prm.PrmContainerEACL) @@ -183,17 +183,17 @@ type SetEACLPrm struct { client.PrmContainerSetEACL } -// SetEACLRes groups resulting values of SetEACL operation. +// SetEACLRes groups the resulting values of SetEACL operation. type SetEACLRes struct{} -// SetEACL requests to save eACL table in NeoFS. +// SetEACL requests to save an eACL table in NeoFS. // // Operation is asynchronous and no guaranteed even in the absence of errors. // The required time is also not predictable. // // Success can be verified by reading by container identifier. // -// Returns any error prevented the operation from completing correctly in error return. +// Returns any error which prevented the operation from completing correctly in error return. func SetEACL(prm SetEACLPrm) (res SetEACLRes, err error) { _, err = prm.cli.ContainerSetEACL(context.Background(), prm.PrmContainerSetEACL) @@ -206,7 +206,7 @@ type NetworkInfoPrm struct { client.PrmNetworkInfo } -// NetworkInfoRes groups resulting values of NetworkInfo operation. +// NetworkInfoRes groups the resulting values of NetworkInfo operation. type NetworkInfoRes struct { cliRes *client.ResNetworkInfo } @@ -218,7 +218,7 @@ func (x NetworkInfoRes) NetworkInfo() *netmap.NetworkInfo { // NetworkInfo reads information about the NeoFS network. // -// Returns any error prevented the operation from completing correctly in error return. +// Returns any error which prevented the operation from completing correctly in error return. func NetworkInfo(prm NetworkInfoPrm) (res NetworkInfoRes, err error) { res.cliRes, err = prm.cli.NetworkInfo(context.Background(), prm.PrmNetworkInfo) @@ -231,7 +231,7 @@ type NodeInfoPrm struct { client.PrmEndpointInfo } -// NodeInfoRes groups resulting values of NodeInfo operation. +// NodeInfoRes groups the resulting values of NodeInfo operation. type NodeInfoRes struct { cliRes *client.ResEndpointInfo } @@ -241,14 +241,14 @@ func (x NodeInfoRes) NodeInfo() *netmap.NodeInfo { return x.cliRes.NodeInfo() } -// LatestVersion returns latest NeoFS API version in use. +// LatestVersion returns the latest NeoFS API version in use. func (x NodeInfoRes) LatestVersion() *version.Version { return x.cliRes.LatestVersion() } // NodeInfo requests information about the remote server from NeoFS netmap. // -// Returns any error prevented the operation from completing correctly in error return. +// Returns any error which prevented the operation from completing correctly in error return. func NodeInfo(prm NodeInfoPrm) (res NodeInfoRes, err error) { res.cliRes, err = prm.cli.EndpointInfo(context.Background(), prm.PrmEndpointInfo) @@ -261,7 +261,7 @@ type CreateSessionPrm struct { client.PrmSessionCreate } -// CreateSessionRes groups resulting values of CreateSession operation. +// CreateSessionRes groups the resulting values of CreateSession operation. type CreateSessionRes struct { cliRes *client.ResSessionCreate } @@ -276,9 +276,9 @@ func (x CreateSessionRes) SessionKey() []byte { return x.cliRes.PublicKey() } -// CreateSession opens new unlimited session with the remote node. +// CreateSession opens a new unlimited session with the remote node. // -// Returns any error prevented the operation from completing correctly in error return. +// Returns any error which prevented the operation from completing correctly in error return. func CreateSession(prm CreateSessionPrm) (res CreateSessionRes, err error) { res.cliRes, err = prm.cli.SessionCreate(context.Background(), prm.PrmSessionCreate) @@ -304,7 +304,7 @@ func (x *PutObjectPrm) SetPayloadReader(rdr io.Reader) { x.rdr = rdr } -// PutObjectRes groups resulting values of PutObject operation. +// PutObjectRes groups the resulting values of PutObject operation. type PutObjectRes struct { id *oidSDK.ID } @@ -316,7 +316,7 @@ func (x PutObjectRes) ID() *oidSDK.ID { // PutObject saves the object in NeoFS network. // -// Returns any error prevented the operation from completing correctly in error return. +// Returns any error which prevented the operation from completing correctly in error return. func PutObject(prm PutObjectPrm) (*PutObjectRes, error) { var putPrm client.PrmObjectPutInit @@ -404,19 +404,19 @@ type DeleteObjectPrm struct { objectAddressPrm } -// DeleteObjectRes groups resulting values of DeleteObject operation. +// DeleteObjectRes groups the resulting values of DeleteObject operation. type DeleteObjectRes struct { addrTombstone *addressSDK.Address } -// TombstoneAddress returns address of the created object with tombstone. +// TombstoneAddress returns the address of the created object with tombstone. func (x DeleteObjectRes) TombstoneAddress() *addressSDK.Address { return x.addrTombstone } -// DeleteObject marks object to be removed from NeoFS through tombstone placement. +// DeleteObject marks an object to be removed from NeoFS through tombstone placement. // -// Returns any error prevented the operation from completing correctly in error return. +// Returns any error which prevented the operation from completing correctly in error return. func DeleteObject(prm DeleteObjectPrm) (*DeleteObjectRes, error) { var delPrm client.PrmObjectDelete @@ -467,27 +467,27 @@ type GetObjectPrm struct { headerCallback func(*object.Object) } -// SetHeaderCallback sets callback which is called on the object after the header is received, +// SetHeaderCallback sets callback which is called on the object after the header is received // but before the payload is written. func (p *GetObjectPrm) SetHeaderCallback(f func(*object.Object)) { p.headerCallback = f } -// GetObjectRes groups resulting values of GetObject operation. +// GetObjectRes groups the resulting values of GetObject operation. type GetObjectRes struct { hdr *object.Object } -// Header returns header of the request object. +// Header returns the header of the request object. func (x GetObjectRes) Header() *object.Object { return x.hdr } -// GetObject reads the object by address. +// GetObject reads an object by address. // -// Interrupts on any writer error. If successful, payload is written to writer. +// Interrupts on any writer error. If successful, payload is written to the writer. // -// Returns any error prevented the operation from completing correctly in error return. +// Returns any error which prevented the operation from completing correctly in error return. // For raw reading, returns *object.SplitInfoError error if object is virtual. func GetObject(prm GetObjectPrm) (*GetObjectRes, error) { var getPrm client.PrmObjectGet @@ -552,24 +552,24 @@ type HeadObjectPrm struct { mainOnly bool } -// SetMainOnlyFlag sets flag to get only main fields of object header in terms of NeoFS API. +// SetMainOnlyFlag sets flag to get only main fields of an object header in terms of NeoFS API. func (x *HeadObjectPrm) SetMainOnlyFlag(v bool) { x.mainOnly = v } -// HeadObjectRes groups resulting values of HeadObject operation. +// HeadObjectRes groups the resulting values of HeadObject operation. type HeadObjectRes struct { hdr *object.Object } -// Header returns requested object header. +// Header returns the requested object header. func (x HeadObjectRes) Header() *object.Object { return x.hdr } -// HeadObject reads object header by address. +// HeadObject reads an object header by address. // -// Returns any error prevented the operation from completing correctly in error return. +// Returns any error which prevented the operation from completing correctly in error return. // For raw reading, returns *object.SplitInfoError error if object is virtual. func HeadObject(prm HeadObjectPrm) (*HeadObjectRes, error) { var cliPrm client.PrmObjectHead @@ -629,7 +629,7 @@ func (x *SearchObjectsPrm) SetFilters(filters object.SearchFilters) { x.filters = filters } -// SearchObjectsRes groups resulting values of SearchObjects operation. +// SearchObjectsRes groups the resulting values of SearchObjects operation. type SearchObjectsRes struct { ids []oidSDK.ID } @@ -639,9 +639,9 @@ func (x SearchObjectsRes) IDList() []oidSDK.ID { return x.ids } -// SearchObjects selects objects from container which match the filters. +// SearchObjects selects objects from the container which match the filters. // -// Returns any error prevented the operation from completing correctly in error return. +// Returns any error which prevented the operation from completing correctly in error return. func SearchObjects(prm SearchObjectsPrm) (*SearchObjectsRes, error) { var cliPrm client.PrmObjectSearch @@ -712,7 +712,7 @@ func (x *HashPayloadRangesPrm) TZ() { x.tz = true } -// SetRanges sets list of payload ranges to hash. +// SetRanges sets a list of payload ranges to hash. func (x *HashPayloadRangesPrm) SetRanges(rngs []*object.Range) { x.rngs = rngs } @@ -722,19 +722,19 @@ func (x *HashPayloadRangesPrm) SetSalt(salt []byte) { x.salt = salt } -// HashPayloadRangesRes groups resulting values of HashPayloadRanges operation. +// HashPayloadRangesRes groups the resulting values of HashPayloadRanges operation. type HashPayloadRangesRes struct { cliRes *client.ResObjectHash } -// HashList returns list of hashes of the payload ranges keeping order. +// HashList returns a list of hashes of the payload ranges keeping order. func (x HashPayloadRangesRes) HashList() [][]byte { return x.cliRes.Checksums() } // HashPayloadRanges requests hashes (by default SHA256) of the object payload ranges. // -// Returns any error prevented the operation from completing correctly in error return. +// Returns any error which prevented the operation from completing correctly in error return. // Returns an error if number of received hashes differs with the number of requested ranges. func HashPayloadRanges(prm HashPayloadRangesPrm) (*HashPayloadRangesRes, error) { var cliPrm client.PrmObjectHash @@ -801,14 +801,14 @@ func (x *PayloadRangePrm) SetRange(rng *object.Range) { x.rng = rng } -// PayloadRangeRes groups resulting values of PayloadRange operation. +// PayloadRangeRes groups the resulting values of PayloadRange operation. type PayloadRangeRes struct{} -// PayloadRange reads object payload range from NeoFS and writes it to specified writer. +// PayloadRange reads object payload range from NeoFS and writes it to the specified writer. // // Interrupts on any writer error. // -// Returns any error prevented the operation from completing correctly in error return. +// Returns any error which prevented the operation from completing correctly in error return. // For raw reading, returns *object.SplitInfoError error if object is virtual. func PayloadRange(prm PayloadRangePrm) (*PayloadRangeRes, error) { var cliPrm client.PrmObjectRange diff --git a/cmd/neofs-cli/internal/client/doc.go b/cmd/neofs-cli/internal/client/doc.go index 73660997c8..ca96b2dd2c 100644 --- a/cmd/neofs-cli/internal/client/doc.go +++ b/cmd/neofs-cli/internal/client/doc.go @@ -5,8 +5,8 @@ // the NeoFS CLI application does not fully use the client's flexible interface. // // In this regard, this package provides functions over base API client necessary for the application. -// This allows you to concentrate the entire spectrum of the client's use in one place (this will be convenient +// This allows you to concentrate the entire spectrum of the client's use in one place (this will be convenient // both when updating the base client and for evaluating the UX of SDK library). So it is expected that all -// application packages will be limited to this package for the development of functionality requiring +// application packages will be limited to this package for the development of functionality requiring // NeoFS API communication. package internal diff --git a/cmd/neofs-cli/internal/client/prm.go b/cmd/neofs-cli/internal/client/prm.go index 35af60e94a..391e40f104 100644 --- a/cmd/neofs-cli/internal/client/prm.go +++ b/cmd/neofs-cli/internal/client/prm.go @@ -16,7 +16,7 @@ type commonPrm struct { cli *client.Client } -// SetClient sets base client for NeoFS API communication. +// SetClient sets the base client for NeoFS API communication. func (x *commonPrm) SetClient(cli *client.Client) { x.cli = cli } @@ -25,7 +25,7 @@ type containerIDPrm struct { cnrID *cid.ID } -// SetContainerID sets container identifier. +// SetContainerID sets the container identifier. func (x *containerIDPrm) SetContainerID(id *cid.ID) { x.cnrID = id } @@ -34,7 +34,7 @@ type sessionTokenPrm struct { sessionToken *session.Token } -// SetSessionToken sets token of the session within which request should be sent. +// SetSessionToken sets the token of the session within which the request should be sent. func (x *sessionTokenPrm) SetSessionToken(tok *session.Token) { x.sessionToken = tok } @@ -43,7 +43,7 @@ type bearerTokenPrm struct { bearerToken *token.BearerToken } -// SetBearerToken sets bearer token to be attached to the request. +// SetBearerToken sets the bearer token to be attached to the request. func (x *bearerTokenPrm) SetBearerToken(tok *token.BearerToken) { x.bearerToken = tok } @@ -69,7 +69,7 @@ type payloadWriterPrm struct { wrt io.Writer } -// SetPayloadWriter sets writer of the object payload. +// SetPayloadWriter sets the writer of the object payload. func (x *payloadWriterPrm) SetPayloadWriter(wrt io.Writer) { x.wrt = wrt } diff --git a/cmd/neofs-cli/modules/container.go b/cmd/neofs-cli/modules/container.go index e884352536..90c1e932dc 100644 --- a/cmd/neofs-cli/modules/container.go +++ b/cmd/neofs-cli/modules/container.go @@ -61,7 +61,7 @@ var wellKnownBasicACL = map[string]acl.BasicACL{ const sessionTokenFlag = "session" -// path to a file with encoded session token +// path to a file with an encoded session token var sessionTokenPath string var ( diff --git a/cmd/neofs-node/config/apiclient/config.go b/cmd/neofs-node/config/apiclient/config.go index 02d7b635aa..70c36652b2 100644 --- a/cmd/neofs-node/config/apiclient/config.go +++ b/cmd/neofs-node/config/apiclient/config.go @@ -13,10 +13,10 @@ const ( DialTimeoutDefault = 5 * time.Second ) -// DialTimeout returns value of "dial_timeout" config parameter +// DialTimeout returns the value of "dial_timeout" config parameter // from "apiclient" section. // -// Returns DialTimeoutDefault if value is not positive duration. +// Returns DialTimeoutDefault if the value is not positive duration. func DialTimeout(c *config.Config) time.Duration { v := config.DurationSafe(c.Sub(subsection), "dial_timeout") if v > 0 { diff --git a/cmd/neofs-node/config/calls.go b/cmd/neofs-node/config/calls.go index 2428952bc7..42ea7c67bd 100644 --- a/cmd/neofs-node/config/calls.go +++ b/cmd/neofs-node/config/calls.go @@ -4,9 +4,9 @@ import ( "strings" ) -// Sub returns subsection of the Config by name. +// Sub returns a subsection of the Config by name. // -// Returns nil if subsection if missing. +// Returns nil if subsection is missing. func (x *Config) Sub(name string) *Config { // copy path in order to prevent consequent violations ln := len(x.path) @@ -29,7 +29,7 @@ func (x *Config) Sub(name string) *Config { } } -// Value returns configuration value by name. +// Value returns the configuration value by name. // // Result can be casted to a particular type // via corresponding function (e.g. StringSlice). diff --git a/cmd/neofs-node/config/cast.go b/cmd/neofs-node/config/cast.go index 5a92675f88..2c0fa03ff6 100644 --- a/cmd/neofs-node/config/cast.go +++ b/cmd/neofs-node/config/cast.go @@ -15,10 +15,10 @@ func panicOnErr(err error) { } } -// StringSlice reads configuration value -// from c by name and casts it to []string. +// StringSlice reads a configuration value +// from c by name and casts it to a []string. // -// Panics if value can not be casted. +// Panics if the value can not be casted. func StringSlice(c *Config, name string) []string { x, err := cast.ToStringSliceE(c.Value(name)) panicOnErr(err) @@ -26,18 +26,18 @@ func StringSlice(c *Config, name string) []string { return x } -// StringSliceSafe reads configuration value -// from c by name and casts it to []string. +// StringSliceSafe reads a configuration value +// from c by name and casts it to a []string. // -// Returns nil if value can not be casted. +// Returns nil if the value can not be casted. func StringSliceSafe(c *Config, name string) []string { return cast.ToStringSlice(c.Value(name)) } -// String reads configuration value -// from c by name and casts it to string. +// String reads a configuration value +// from c by name and casts it to a string. // -// Panics if value can not be casted. +// Panics if the value can not be casted. func String(c *Config, name string) string { x, err := cast.ToStringE(c.Value(name)) panicOnErr(err) @@ -45,18 +45,18 @@ func String(c *Config, name string) string { return x } -// StringSafe reads configuration value -// from c by name and casts it to string. +// StringSafe reads a configuration value +// from c by name and casts it to a string. // -// Returns "" if value can not be casted. +// Returns "" if the value can not be casted. func StringSafe(c *Config, name string) string { return cast.ToString(c.Value(name)) } -// Duration reads configuration value +// Duration reads a configuration value // from c by name and casts it to time.Duration. // -// Panics if value can not be casted. +// Panics if the value can not be casted. func Duration(c *Config, name string) time.Duration { x, err := cast.ToDurationE(c.Value(name)) panicOnErr(err) @@ -64,18 +64,18 @@ func Duration(c *Config, name string) time.Duration { return x } -// DurationSafe reads configuration value +// DurationSafe reads a configuration value // from c by name and casts it to time.Duration. // -// Returns 0 if value can not be casted. +// Returns 0 if the value can not be casted. func DurationSafe(c *Config, name string) time.Duration { return cast.ToDuration(c.Value(name)) } -// Bool reads configuration value +// Bool reads a configuration value // from c by name and casts it to bool. // -// Panics if value can not be casted. +// Panics if the value can not be casted. func Bool(c *Config, name string) bool { x, err := cast.ToBoolE(c.Value(name)) panicOnErr(err) @@ -83,18 +83,18 @@ func Bool(c *Config, name string) bool { return x } -// BoolSafe reads configuration value +// BoolSafe reads a configuration value // from c by name and casts it to bool. // -// Returns false if value can not be casted. +// Returns false if the value can not be casted. func BoolSafe(c *Config, name string) bool { return cast.ToBool(c.Value(name)) } -// Uint32 reads configuration value +// Uint32 reads a configuration value // from c by name and casts it to uint32. // -// Panics if value can not be casted. +// Panics if the value can not be casted. func Uint32(c *Config, name string) uint32 { x, err := cast.ToUint32E(c.Value(name)) panicOnErr(err) @@ -102,18 +102,18 @@ func Uint32(c *Config, name string) uint32 { return x } -// Uint32Safe reads configuration value +// Uint32Safe reads a configuration value // from c by name and casts it to uint32. // -// Returns 0 if value can not be casted. +// Returns 0 if the value can not be casted. func Uint32Safe(c *Config, name string) uint32 { return cast.ToUint32(c.Value(name)) } -// Uint reads configuration value +// Uint reads a configuration value // from c by name and casts it to uint64. // -// Panics if value can not be casted. +// Panics if the value can not be casted. func Uint(c *Config, name string) uint64 { x, err := cast.ToUint64E(c.Value(name)) panicOnErr(err) @@ -121,18 +121,18 @@ func Uint(c *Config, name string) uint64 { return x } -// UintSafe reads configuration value +// UintSafe reads a configuration value // from c by name and casts it to uint64. // -// Returns 0 if value can not be casted. +// Returns 0 if the value can not be casted. func UintSafe(c *Config, name string) uint64 { return cast.ToUint64(c.Value(name)) } -// Int reads configuration value +// Int reads a configuration value // from c by name and casts it to int64. // -// Panics if value can not be casted. +// Panics if the value can not be casted. func Int(c *Config, name string) int64 { x, err := cast.ToInt64E(c.Value(name)) panicOnErr(err) @@ -140,15 +140,15 @@ func Int(c *Config, name string) int64 { return x } -// IntSafe reads configuration value +// IntSafe reads a configuration value // from c by name and casts it to int64. // -// Returns 0 if value can not be casted. +// Returns 0 if the value can not be casted. func IntSafe(c *Config, name string) int64 { return cast.ToInt64(c.Value(name)) } -// SizeInBytesSafe reads configuration value +// SizeInBytesSafe reads a configuration value // from c by name and casts it to size in bytes (uint64). // // The suffix can be single-letter (b, k, m, g, t) or with diff --git a/cmd/neofs-node/config/contracts/config.go b/cmd/neofs-node/config/contracts/config.go index ac0d5bbf82..cf1ac4b031 100644 --- a/cmd/neofs-node/config/contracts/config.go +++ b/cmd/neofs-node/config/contracts/config.go @@ -11,47 +11,47 @@ const ( subsection = "contracts" ) -// Netmap returns value of "netmap" config parameter +// Netmap returns the value of "netmap" config parameter // from "contracts" section. // -// Returns zero filled script hash if value is not set. -// Throws panic if value is not a 20-byte LE hex-encoded string. +// Returns zero filled script hash if the value is not set. +// Throws panic if the value is not a 20-byte LE hex-encoded string. func Netmap(c *config.Config) util.Uint160 { return contractAddress(c, "netmap") } -// Balance returns value of "balance" config parameter +// Balance returns the value of "balance" config parameter // from "contracts" section. // -// Returns zero filled script hash if value is not set. -// Throws panic if value is not a 20-byte LE hex-encoded string. +// Returns zero filled script hash if the value is not set. +// Throws panic if the value is not a 20-byte LE hex-encoded string. func Balance(c *config.Config) util.Uint160 { return contractAddress(c, "balance") } -// Container returns value of "container" config parameter +// Container returns the value of "container" config parameter // from "contracts" section. // -// Returns zero filled script hash if value is not set. -// Throws panic if value is not a 20-byte LE hex-encoded string. +// Returns zero filled script hash if the value is not set. +// Throws panic if the value is not a 20-byte LE hex-encoded string. func Container(c *config.Config) util.Uint160 { return contractAddress(c, "container") } -// Reputation returns value of "reputation" config parameter +// Reputation returnsthe value of "reputation" config parameter // from "contracts" section. // -// Returns zero filled script hash if value is not set. -// Throws panic if value is not a 20-byte LE hex-encoded string. +// Returns zero filled script hash if the value is not set. +// Throws panic if the value is not a 20-byte LE hex-encoded string. func Reputation(c *config.Config) util.Uint160 { return contractAddress(c, "reputation") } -// Proxy returns value of "proxy" config parameter +// Proxy returnsthe value of "proxy" config parameter // from "contracts" section. // -// Returns zero filled script hash if value is not set. -// Throws panic if value is not a 20-byte LE hex-encoded string. +// Returns zero filled script hash if the value is not set. +// Throws panic if the value is not a 20-byte LE hex-encoded string. func Proxy(c *config.Config) util.Uint160 { return contractAddress(c, "proxy") } diff --git a/cmd/neofs-node/config/control/config.go b/cmd/neofs-node/config/control/config.go index ec43f99110..92605728f8 100644 --- a/cmd/neofs-node/config/control/config.go +++ b/cmd/neofs-node/config/control/config.go @@ -21,10 +21,10 @@ const ( GRPCEndpointDefault = "" ) -// AuthorizedKeys parses and returns array of "authorized_keys" config +// AuthorizedKeys parses and returns an array of "authorized_keys" config // parameter from "control" section. // -// Returns empty list if not set. +// Returns an empty list if not set. func AuthorizedKeys(c *config.Config) keys.PublicKeys { strKeys := config.StringSliceSafe(c.Sub(subsection), "authorized_keys") pubs := make(keys.PublicKeys, 0, len(strKeys)) @@ -41,7 +41,7 @@ func AuthorizedKeys(c *config.Config) keys.PublicKeys { return pubs } -// GRPC returns structure that provides access to "grpc" subsection of +// GRPC returns a structure that provides access to "grpc" subsection of // "control" section. func GRPC(c *config.Config) GRPCConfig { return GRPCConfig{ @@ -49,9 +49,9 @@ func GRPC(c *config.Config) GRPCConfig { } } -// Endpoint returns value of "endpoint" config parameter. +// Endpoint returns the value of "endpoint" config parameter. // -// Returns GRPCEndpointDefault if value is not a non-empty string. +// Returns GRPCEndpointDefault if the value is not a non-empty string. func (g GRPCConfig) Endpoint() string { v := config.String(g.cfg, "endpoint") if v != "" { diff --git a/cmd/neofs-node/config/engine/config.go b/cmd/neofs-node/config/engine/config.go index 15cf14dd42..77699f3a13 100644 --- a/cmd/neofs-node/config/engine/config.go +++ b/cmd/neofs-node/config/engine/config.go @@ -11,7 +11,7 @@ const ( subsection = "storage" // ShardPoolSizeDefault is a default value of routine pool size per-shard to - // process object PUT operations in storage engine. + // process object PUT operations in a storage engine. ShardPoolSizeDefault = 20 ) @@ -47,9 +47,9 @@ func IterateShards(c *config.Config, required bool, f func(*shardconfig.Config)) } } -// ShardPoolSize returns value of "shard_pool_size" config parameter from "storage" section. +// ShardPoolSize returns the value of "shard_pool_size" config parameter from "storage" section. // -// Returns ShardPoolSizeDefault if value is not a positive number. +// Returns ShardPoolSizeDefault if the value is not a positive number. func ShardPoolSize(c *config.Config) uint32 { v := config.Uint32Safe(c.Sub(subsection), "shard_pool_size") if v > 0 { @@ -59,9 +59,9 @@ func ShardPoolSize(c *config.Config) uint32 { return ShardPoolSizeDefault } -// ShardErrorThreshold returns value of "shard_ro_error_threshold" config parameter from "storage" section. +// ShardErrorThreshold returns the value of "shard_ro_error_threshold" config parameter from "storage" section. // -// Returns 0 if the value is missing. +// Returns 0 if the the value is missing. func ShardErrorThreshold(c *config.Config) uint32 { return config.Uint32Safe(c.Sub(subsection), "shard_ro_error_threshold") } diff --git a/cmd/neofs-node/config/engine/shard/blobstor/blobovnicza/config.go b/cmd/neofs-node/config/engine/shard/blobstor/blobovnicza/config.go index f0d405789a..a854b6d62a 100644 --- a/cmd/neofs-node/config/engine/shard/blobstor/blobovnicza/config.go +++ b/cmd/neofs-node/config/engine/shard/blobstor/blobovnicza/config.go @@ -28,9 +28,9 @@ func From(c *config.Config) *Config { return (*Config)(c) } -// Size returns value of "size" config parameter. +// Size returns the value of "size" config parameter. // -// Returns SizeDefault if value is not a positive number. +// Returns SizeDefault if the value is not a positive number. func (x *Config) Size() uint64 { s := config.SizeInBytesSafe( (*config.Config)(x), @@ -44,9 +44,9 @@ func (x *Config) Size() uint64 { return SizeDefault } -// ShallowDepth returns value of "depth" config parameter. +// ShallowDepth returns the value of "depth" config parameter. // -// Returns ShallowDepthDefault if value is not a positive number. +// Returns ShallowDepthDefault if the value is not a positive number. func (x *Config) ShallowDepth() uint64 { d := config.UintSafe( (*config.Config)(x), @@ -60,9 +60,9 @@ func (x *Config) ShallowDepth() uint64 { return ShallowDepthDefault } -// ShallowWidth returns value of "width" config parameter. +// ShallowWidth returns the value of "width" config parameter. // -// Returns ShallowWidthDefault if value is not a positive number. +// Returns ShallowWidthDefault if the value is not a positive number. func (x *Config) ShallowWidth() uint64 { d := config.UintSafe( (*config.Config)(x), @@ -76,9 +76,9 @@ func (x *Config) ShallowWidth() uint64 { return ShallowWidthDefault } -// OpenedCacheSize returns value of "opened_cache_capacity" config parameter. +// OpenedCacheSize returns the value of "opened_cache_capacity" config parameter. // -// Returns OpenedCacheSizeDefault if value is not a positive number. +// Returns OpenedCacheSizeDefault if the value is not a positive number. func (x *Config) OpenedCacheSize() int { d := config.IntSafe( (*config.Config)(x), diff --git a/cmd/neofs-node/config/engine/shard/blobstor/config.go b/cmd/neofs-node/config/engine/shard/blobstor/config.go index f3e3924b0a..524f8ad756 100644 --- a/cmd/neofs-node/config/engine/shard/blobstor/config.go +++ b/cmd/neofs-node/config/engine/shard/blobstor/config.go @@ -29,9 +29,9 @@ func From(c *config.Config) *Config { return (*Config)(c) } -// Path returns value of "path" config parameter. +// Path returns the value of "path" config parameter. // -// Panics if value is not a non-empty string. +// Panics if the value is not a non-empty string. func (x *Config) Path() string { p := config.String( (*config.Config)(x), @@ -45,9 +45,9 @@ func (x *Config) Path() string { return p } -// Perm returns value of "perm" config parameter as a fs.FileMode. +// Perm returns the value of "perm" config parameter as a fs.FileMode. // -// Returns PermDefault if value is not a non-zero number. +// Returns PermDefault if the value is not a non-zero number. func (x *Config) Perm() fs.FileMode { p := config.UintSafe( (*config.Config)(x), @@ -61,9 +61,9 @@ func (x *Config) Perm() fs.FileMode { return fs.FileMode(p) } -// ShallowDepth returns value of "depth" config parameter. +// ShallowDepth returns the value of "depth" config parameter. // -// Returns ShallowDepthDefault if value is out of +// Returns ShallowDepthDefault if the value is out of // [1:fstree.MaxDepth] range. func (x *Config) ShallowDepth() int { d := config.IntSafe( @@ -78,9 +78,9 @@ func (x *Config) ShallowDepth() int { return ShallowDepthDefault } -// Compress returns value of "compress" config parameter. +// Compress returns the value of "compress" config parameter. // -// Returns false if value is not a valid bool. +// Returns false if the value is not a valid bool. func (x *Config) Compress() bool { return config.BoolSafe( (*config.Config)(x), @@ -88,18 +88,18 @@ func (x *Config) Compress() bool { ) } -// UncompressableContentTypes returns value of "compress_skip_content_types" config parameter. +// UncompressableContentTypes returns the value of "compress_skip_content_types" config parameter. // -// Returns nil if a value is missing or is invalid. +// Returns nil if a the value is missing or is invalid. func (x *Config) UncompressableContentTypes() []string { return config.StringSliceSafe( (*config.Config)(x), "compression_exclude_content_types") } -// SmallSizeLimit returns value of "small_object_size" config parameter. +// SmallSizeLimit returns the value of "small_object_size" config parameter. // -// Returns SmallSizeLimitDefault if value is not a positive number. +// Returns SmallSizeLimitDefault if the value is not a positive number. func (x *Config) SmallSizeLimit() uint64 { l := config.SizeInBytesSafe( (*config.Config)(x), diff --git a/cmd/neofs-node/config/engine/shard/config.go b/cmd/neofs-node/config/engine/shard/config.go index bb395afd6a..b6520a4a1a 100644 --- a/cmd/neofs-node/config/engine/shard/config.go +++ b/cmd/neofs-node/config/engine/shard/config.go @@ -52,9 +52,9 @@ func (x *Config) GC() *gcconfig.Config { ) } -// RefillMetabase returns value of "resync_metabase" config parameter. +// RefillMetabase returns the value of "resync_metabase" config parameter. // -// Returns false if value is not a valid bool. +// Returns false if the value is not a valid bool. func (x *Config) RefillMetabase() bool { return config.BoolSafe( (*config.Config)(x), @@ -62,9 +62,9 @@ func (x *Config) RefillMetabase() bool { ) } -// Mode return value of "mode" config parameter. +// Mode return the value of "mode" config parameter. // -// Panics if read value is not one of predefined +// Panics if read the value is not one of predefined // shard modes. func (x *Config) Mode() (m shard.Mode) { s := config.StringSafe( diff --git a/cmd/neofs-node/config/engine/shard/gc/config.go b/cmd/neofs-node/config/engine/shard/gc/config.go index 341abe2818..7547415c8e 100644 --- a/cmd/neofs-node/config/engine/shard/gc/config.go +++ b/cmd/neofs-node/config/engine/shard/gc/config.go @@ -24,10 +24,10 @@ func From(c *config.Config) *Config { return (*Config)(c) } -// RemoverBatchSize returns value of "remover_batch_size" +// RemoverBatchSize returns the value of "remover_batch_size" // config parameter. // -// Returns RemoverBatchSizeDefault if value is not a positive number. +// Returns RemoverBatchSizeDefault if the value is not a positive number. func (x *Config) RemoverBatchSize() int { s := config.IntSafe( (*config.Config)(x), @@ -41,10 +41,10 @@ func (x *Config) RemoverBatchSize() int { return RemoverBatchSizeDefault } -// RemoverSleepInterval returns value of "remover_sleep_interval" +// RemoverSleepInterval returns the value of "remover_sleep_interval" // config parameter. // -// Returns RemoverSleepIntervalDefault if value is not a positive number. +// Returns RemoverSleepIntervalDefault if the value is not a positive number. func (x *Config) RemoverSleepInterval() time.Duration { s := config.DurationSafe( (*config.Config)(x), diff --git a/cmd/neofs-node/config/engine/shard/metabase/config.go b/cmd/neofs-node/config/engine/shard/metabase/config.go index 14f6d0b290..f9b048d7dc 100644 --- a/cmd/neofs-node/config/engine/shard/metabase/config.go +++ b/cmd/neofs-node/config/engine/shard/metabase/config.go @@ -21,9 +21,9 @@ func From(c *config.Config) *Config { return (*Config)(c) } -// Path returns value of "path" config parameter. +// Path returns the value of "path" config parameter. // -// Panics if value is not a non-empty string. +// Panics if the value is not a non-empty string. func (x *Config) Path() string { p := config.String( (*config.Config)(x), @@ -37,9 +37,9 @@ func (x *Config) Path() string { return p } -// Perm returns value of "perm" config parameter as a fs.FileMode. +// Perm returns the value of "perm" config parameter as a fs.FileMode. // -// Returns PermDefault if value is not a positive number. +// Returns PermDefault if the value is not a positive number. func (x *Config) Perm() fs.FileMode { p := config.UintSafe( (*config.Config)(x), diff --git a/cmd/neofs-node/config/engine/shard/writecache/config.go b/cmd/neofs-node/config/engine/shard/writecache/config.go index 223f2d9bfd..7a9f31fe18 100644 --- a/cmd/neofs-node/config/engine/shard/writecache/config.go +++ b/cmd/neofs-node/config/engine/shard/writecache/config.go @@ -33,14 +33,14 @@ func From(c *config.Config) *Config { // Enabled returns true if write-cache is enabled and false otherwise. // -// Panics if value is not a boolean. +// Panics if the value is not a boolean. func (x *Config) Enabled() bool { return config.Bool((*config.Config)(x), "enabled") } -// Path returns value of "path" config parameter. +// Path returns the value of "path" config parameter. // -// Panics if value is not a non-empty string. +// Panics if the value is not a non-empty string. func (x *Config) Path() string { p := config.String( (*config.Config)(x), @@ -54,9 +54,9 @@ func (x *Config) Path() string { return p } -// MemSize returns value of "memcache_capacity" config parameter. +// MemSize returns the value of "memcache_capacity" config parameter. // -// Returns MemSizeDefault if value is not a positive number. +// Returns MemSizeDefault if the value is not a positive number. func (x *Config) MemSize() uint64 { s := config.SizeInBytesSafe( (*config.Config)(x), @@ -70,9 +70,9 @@ func (x *Config) MemSize() uint64 { return MemSizeDefault } -// SmallObjectSize returns value of "small_object_size" config parameter. +// SmallObjectSize returns the value of "small_object_size" config parameter. // -// Returns SmallSizeDefault if value is not a positive number. +// Returns SmallSizeDefault if the value is not a positive number. func (x *Config) SmallObjectSize() uint64 { s := config.SizeInBytesSafe( (*config.Config)(x), @@ -86,9 +86,9 @@ func (x *Config) SmallObjectSize() uint64 { return SmallSizeDefault } -// MaxObjectSize returns value of "max_object_size" config parameter. +// MaxObjectSize returns the value of "max_object_size" config parameter. // -// Returns MaxSizeDefault if value is not a positive number. +// Returns MaxSizeDefault if the value is not a positive number. func (x *Config) MaxObjectSize() uint64 { s := config.SizeInBytesSafe( (*config.Config)(x), @@ -102,9 +102,9 @@ func (x *Config) MaxObjectSize() uint64 { return MaxSizeDefault } -// WorkersNumber returns value of "workers_number" config parameter. +// WorkersNumber returns the value of "workers_number" config parameter. // -// Returns WorkersNumberDefault if value is not a positive number. +// Returns WorkersNumberDefault if the value is not a positive number. func (x *Config) WorkersNumber() int { c := config.IntSafe( (*config.Config)(x), @@ -118,9 +118,9 @@ func (x *Config) WorkersNumber() int { return WorkersNumberDefault } -// SizeLimit returns value of "capacity" config parameter. +// SizeLimit returns the value of "capacity" config parameter. // -// Returns SizeLimitDefault if value is not a positive number. +// Returns SizeLimitDefault if the value is not a positive number. func (x *Config) SizeLimit() uint64 { c := config.SizeInBytesSafe( (*config.Config)(x), diff --git a/cmd/neofs-node/config/grpc/config.go b/cmd/neofs-node/config/grpc/config.go index 1b07779443..900b428c3c 100644 --- a/cmd/neofs-node/config/grpc/config.go +++ b/cmd/neofs-node/config/grpc/config.go @@ -17,9 +17,9 @@ var ( // which provides access to gRPC server configurations. type Config config.Config -// Endpoint returns value of "endpoint" config parameter. +// Endpoint returns the value of "endpoint" config parameter. // -// Panics if value is not a non-empty string. +// Panics if the value is not a non-empty string. func (x *Config) Endpoint() string { v := config.StringSafe( (*config.Config)(x), @@ -54,9 +54,9 @@ type TLSConfig struct { cfg *config.Config } -// KeyFile returns value of "key" config parameter. +// KeyFile returns the value of "key" config parameter. // -// Panics if value is not a non-empty string. +// Panics if the value is not a non-empty string. func (tls TLSConfig) KeyFile() string { v := config.StringSafe(tls.cfg, "key") if v == "" { @@ -66,9 +66,9 @@ func (tls TLSConfig) KeyFile() string { return v } -// CertificateFile returns value of "certificate" config parameter. +// CertificateFile returns the value of "certificate" config parameter. // -// Panics if value is not a non-empty string. +// Panics if the value is not a non-empty string. func (tls TLSConfig) CertificateFile() string { v := config.StringSafe(tls.cfg, "certificate") if v == "" { diff --git a/cmd/neofs-node/config/internal/env.go b/cmd/neofs-node/config/internal/env.go index 43cd8d446e..d0f29fb824 100644 --- a/cmd/neofs-node/config/internal/env.go +++ b/cmd/neofs-node/config/internal/env.go @@ -11,7 +11,7 @@ const EnvPrefix = "neofs" // EnvSeparator is a section separator in ENV variables. const EnvSeparator = "_" -// Env returns ENV variable key for particular config parameter. +// Env returns ENV variable key for a particular config parameter. func Env(path ...string) string { return strings.ToUpper( strings.Join( diff --git a/cmd/neofs-node/config/logger/config.go b/cmd/neofs-node/config/logger/config.go index 156a50770f..1b73b76a65 100644 --- a/cmd/neofs-node/config/logger/config.go +++ b/cmd/neofs-node/config/logger/config.go @@ -10,10 +10,10 @@ const ( LevelDefault = "info" ) -// Level returns value of "level" config parameter +// Level returns the value of "level" config parameter // from "logger" section. // -// Returns LevelDefault if value is not a non-empty string. +// Returns LevelDefault if the value is not a non-empty string. func Level(c *config.Config) string { v := config.StringSafe( c.Sub("logger"), diff --git a/cmd/neofs-node/config/mainchain/config.go b/cmd/neofs-node/config/mainchain/config.go index b11d38a472..a231c0153d 100644 --- a/cmd/neofs-node/config/mainchain/config.go +++ b/cmd/neofs-node/config/mainchain/config.go @@ -13,18 +13,18 @@ const ( DialTimeoutDefault = 5 * time.Second ) -// RPCEndpoint returns list of values of "rpc_endpoint" config parameter +// RPCEndpoint returns a list of the values of "rpc_endpoint" config parameter // from "mainchain" section. // -// Returns empty list if value is not a non-empty string array. +// Returns empty list if the value is not a non-empty string array. func RPCEndpoint(c *config.Config) []string { return config.StringSliceSafe(c.Sub(subsection), "rpc_endpoint") } -// DialTimeout returns value of "dial_timeout" config parameter +// DialTimeout returns the value of "dial_timeout" config parameter // from "mainchain" section. // -// Returns DialTimeoutDefault if value is not positive duration. +// Returns DialTimeoutDefault if the value is not positive duration. func DialTimeout(c *config.Config) time.Duration { v := config.DurationSafe(c.Sub(subsection), "dial_timeout") if v > 0 { diff --git a/cmd/neofs-node/config/metrics/config.go b/cmd/neofs-node/config/metrics/config.go index 348edcb718..9d24c7479f 100644 --- a/cmd/neofs-node/config/metrics/config.go +++ b/cmd/neofs-node/config/metrics/config.go @@ -16,10 +16,10 @@ const ( AddressDefault = "" ) -// ShutdownTimeout returns value of "shutdown_timeout" config parameter +// ShutdownTimeout returns the value of "shutdown_timeout" config parameter // from "metrics" section. // -// Returns ShutdownTimeoutDefault if value is not positive duration. +// Returns ShutdownTimeoutDefault if the value is not positive duration. func ShutdownTimeout(c *config.Config) time.Duration { v := config.DurationSafe(c.Sub(subsection), "shutdown_timeout") if v > 0 { @@ -29,10 +29,10 @@ func ShutdownTimeout(c *config.Config) time.Duration { return ShutdownTimeoutDefault } -// Address returns value of "address" config parameter +// Address returns the value of "address" config parameter // from "metrics" section. // -// Returns AddressDefault if value is not set. +// Returns AddressDefault if the value is not set. func Address(c *config.Config) string { v := config.StringSafe(c.Sub(subsection), "address") if v != "" { diff --git a/cmd/neofs-node/config/morph/config.go b/cmd/neofs-node/config/morph/config.go index 2a177b66f2..481b7791a3 100644 --- a/cmd/neofs-node/config/morph/config.go +++ b/cmd/neofs-node/config/morph/config.go @@ -24,7 +24,7 @@ const ( MaxConnPerHostDefault = 10 ) -// RPCEndpoint returns list of values of "rpc_endpoint" config parameter +// RPCEndpoint returns list of the values of "rpc_endpoint" config parameter // from "morph" section. // // Throws panic if list is empty. @@ -37,10 +37,10 @@ func RPCEndpoint(c *config.Config) []string { return v } -// DialTimeout returns value of "dial_timeout" config parameter +// DialTimeout returns the value of "dial_timeout" config parameter // from "morph" section. // -// Returns DialTimeoutDefault if value is not positive duration. +// Returns DialTimeoutDefault if the value is not positive duration. func DialTimeout(c *config.Config) time.Duration { v := config.DurationSafe(c.Sub(subsection), "dial_timeout") if v > 0 { @@ -50,7 +50,7 @@ func DialTimeout(c *config.Config) time.Duration { return DialTimeoutDefault } -// DisableCache returns value of "disable_cache" config parameter +// DisableCache returns the value of "disable_cache" config parameter // from "morph" section. func DisableCache(c *config.Config) bool { return config.BoolSafe(c.Sub(subsection), "disable_cache") diff --git a/cmd/neofs-node/config/node/config.go b/cmd/neofs-node/config/node/config.go index 75a69ef026..d43a6ef5e5 100644 --- a/cmd/neofs-node/config/node/config.go +++ b/cmd/neofs-node/config/node/config.go @@ -45,12 +45,12 @@ const ( NotificationTimeoutDefault = 5 * time.Second ) -// Key returns value of "key" config parameter +// Key returns the value of "key" config parameter // from "node" section. // -// If value is not set, fallbacks to Wallet section. +// If the value is not set, fallbacks to Wallet section. // -// Panics if value is incorrect filename of binary encoded private key. +// Panics if the value is incorrect filename of binary encoded private key. func Key(c *config.Config) *keys.PrivateKey { v := config.StringSafe(c.Sub(subsection), "key") if v == "" { @@ -73,7 +73,7 @@ func Key(c *config.Config) *keys.PrivateKey { return key } -// Wallet returns value of node private key from "node" section. +// Wallet returns the value of a node private key from "node" section. // // Panics if section contains invalid values. func Wallet(c *config.Config) *keys.PrivateKey { @@ -103,10 +103,10 @@ func (x stringAddressGroup) NumberOfAddresses() int { return len(x) } -// BootstrapAddresses returns value of "addresses" config parameter +// BootstrapAddresses returns the value of "addresses" config parameter // from "node" section as network.AddressGroup. // -// Panics if value is not a string list of valid NeoFS network addresses. +// Panics if the value is not a string list of valid NeoFS network addresses. func BootstrapAddresses(c *config.Config) (addr network.AddressGroup) { v := config.StringSlice(c.Sub(subsection), "addresses") @@ -136,10 +136,10 @@ func Attributes(c *config.Config) (attrs []string) { return } -// Relay returns value of "relay" config parameter +// Relay returns the value of "relay" config parameter // from "node" section. // -// Returns false if value is not set. +// Returns false if the value is not set. func Relay(c *config.Config) bool { return config.BoolSafe(c.Sub(subsection), "relay") } @@ -152,9 +152,9 @@ func PersistentSessions(c *config.Config) PersistentSessionsConfig { } } -// Path returns value of "path" config parameter. +// Path returns the value of "path" config parameter. // -// Returns PersistentStatePathDefault if value is not a non-empty string. +// Returns PersistentStatePathDefault if the value is not a non-empty string. func (p PersistentSessionsConfig) Path() string { return config.String(p.cfg, "path") } @@ -167,9 +167,9 @@ func PersistentState(c *config.Config) PersistentStateConfig { } } -// Path returns value of "path" config parameter. +// Path returns the value of "path" config parameter. // -// Returns PersistentStatePathDefault if value is not a non-empty string. +// Returns PersistentStatePathDefault if the value is not a non-empty string. func (p PersistentStateConfig) Path() string { v := config.String(p.cfg, "path") if v != "" { @@ -188,16 +188,16 @@ func (x *SubnetConfig) Init(root config.Config) { *x = SubnetConfig(*root.Sub(subsection).Sub("subnet")) } -// ExitZero returns value of "exit_zero" config parameter as bool. -// Returns false if value can not be cast. +// ExitZero returns the value of "exit_zero" config parameter as bool. +// Returns false if the value can not be cast. func (x SubnetConfig) ExitZero() bool { return config.BoolSafe((*config.Config)(&x), "exit_zero") } -// IterateSubnets casts value of "entries" config parameter to string slice, +// IterateSubnets casts the value of "entries" config parameter to string slice, // iterates over all of its elements and passes them to f. // -// Does nothing if value can not be cast to string slice. +// Does nothing if the value can not be cast to string slice. func (x SubnetConfig) IterateSubnets(f func(string)) { ids := config.StringSliceSafe((*config.Config)(&x), "entries") @@ -214,34 +214,34 @@ func Notification(c *config.Config) NotificationConfig { } } -// Enabled returns value of "enabled" config parameter from "notification" +// Enabled returns the value of "enabled" config parameter from "notification" // subsection of "node" section. // -// Returns false if value is not presented. +// Returns false if the value is not presented. func (n NotificationConfig) Enabled() bool { return config.BoolSafe(n.cfg, "enabled") } -// DefaultTopic returns value of "default_topic" config parameter from +// DefaultTopic returns the value of "default_topic" config parameter from // "notification" subsection of "node" section. // -// Returns empty string if value is not presented. +// Returns empty string if the value is not presented. func (n NotificationConfig) DefaultTopic() string { return config.StringSafe(n.cfg, "default_topic") } -// Endpoint returns value of "endpoint" config parameter from "notification" +// Endpoint returns the value of "endpoint" config parameter from "notification" // subsection of "node" section. // -// Returns empty string if value is not presented. +// Returns empty string if the value is not presented. func (n NotificationConfig) Endpoint() string { return config.StringSafe(n.cfg, "endpoint") } -// Timeout returns value of "timeout" config parameter from "notification" +// Timeout returns the value of "timeout" config parameter from "notification" // subsection of "node" section. // -// Returns NotificationTimeoutDefault if value is not positive. +// Returns NotificationTimeoutDefault if the value is not positive. func (n NotificationConfig) Timeout() time.Duration { v := config.DurationSafe(n.cfg, "timeout") if v > 0 { @@ -251,26 +251,26 @@ func (n NotificationConfig) Timeout() time.Duration { return NotificationTimeoutDefault } -// CertPath returns value of "certificate_path" config parameter from "notification" +// CertPath returns the value of "certificate_path" config parameter from "notification" // subsection of "node" section. // -// Returns empty string if value is not presented. +// Returns empty string if the value is not presented. func (n NotificationConfig) CertPath() string { return config.StringSafe(n.cfg, "certificate") } -// KeyPath returns value of "key_path" config parameter from +// KeyPath returns the value of "key_path" config parameter from // "notification" subsection of "node" section. // -// Returns empty string if value is not presented. +// Returns empty string if the value is not presented. func (n NotificationConfig) KeyPath() string { return config.StringSafe(n.cfg, "key") } -// CAPath returns value of "ca_path" config parameter from +// CAPath returns the value of "ca_path" config parameter from // "notification" subsection of "node" section. // -// Returns empty string if value is not presented. +// Returns empty string if the value is not presented. func (n NotificationConfig) CAPath() string { return config.StringSafe(n.cfg, "ca") } diff --git a/cmd/neofs-node/config/object/config.go b/cmd/neofs-node/config/object/config.go index 465cab7f9f..1460f130c3 100644 --- a/cmd/neofs-node/config/object/config.go +++ b/cmd/neofs-node/config/object/config.go @@ -28,9 +28,9 @@ func Put(c *config.Config) PutConfig { } } -// PoolSizeRemote returns value of "pool_size_remote" config parameter. +// PoolSizeRemote returns the value of "pool_size_remote" config parameter. // -// Returns PutPoolSizeDefault if value is not positive number. +// Returns PutPoolSizeDefault if the value is not a positive number. func (g PutConfig) PoolSizeRemote() int { v := config.Int(g.cfg, "pool_size_remote") if v > 0 { diff --git a/cmd/neofs-node/config/opts.go b/cmd/neofs-node/config/opts.go index 871d9c959b..f7f7685f71 100644 --- a/cmd/neofs-node/config/opts.go +++ b/cmd/neofs-node/config/opts.go @@ -8,10 +8,10 @@ func defaultOpts() *opts { return new(opts) } -// Option allows to set optional parameter of the Config. +// Option allows to set an optional parameter of the Config. type Option func(*opts) -// WithConfigFile returns option to set system path +// WithConfigFile returns an option to set the system path // to the configuration file. func WithConfigFile(path string) Option { return func(o *opts) { diff --git a/cmd/neofs-node/config/policer/config.go b/cmd/neofs-node/config/policer/config.go index 14fea7eab2..5e61175554 100644 --- a/cmd/neofs-node/config/policer/config.go +++ b/cmd/neofs-node/config/policer/config.go @@ -13,10 +13,10 @@ const ( HeadTimeoutDefault = 5 * time.Second ) -// HeadTimeout returns value of "head_timeout" config parameter +// HeadTimeout returns the value of "head_timeout" config parameter // from "policer" section. // -// Returns HeadTimeoutDefault if value is not positive duration. +// Returns HeadTimeoutDefault if the value is not positive duration. func HeadTimeout(c *config.Config) time.Duration { v := config.DurationSafe(c.Sub(subsection), "head_timeout") if v > 0 { diff --git a/cmd/neofs-node/config/profiler/config.go b/cmd/neofs-node/config/profiler/config.go index 08fe65bf5a..4d565c60d2 100644 --- a/cmd/neofs-node/config/profiler/config.go +++ b/cmd/neofs-node/config/profiler/config.go @@ -16,10 +16,10 @@ const ( AddressDefault = "" ) -// ShutdownTimeout returns value of "shutdown_timeout" config parameter +// ShutdownTimeout returns the value of "shutdown_timeout" config parameter // from "profiler" section. // -// Returns ShutdownTimeoutDefault if value is not positive duration. +// Returns ShutdownTimeoutDefault if the value is not positive duration. func ShutdownTimeout(c *config.Config) time.Duration { v := config.DurationSafe(c.Sub(subsection), "shutdown_timeout") if v > 0 { @@ -29,10 +29,10 @@ func ShutdownTimeout(c *config.Config) time.Duration { return ShutdownTimeoutDefault } -// Address returns value of "address" config parameter +// Address returns the value of "address" config parameter // from "profiler" section. // -// Returns AddressDefault if value is not set. +// Returns AddressDefault if the value is not set. func Address(c *config.Config) string { v := config.StringSafe(c.Sub(subsection), "address") if v != "" { diff --git a/cmd/neofs-node/config/replicator/config.go b/cmd/neofs-node/config/replicator/config.go index 3cf10a4b1a..af3e43ef1d 100644 --- a/cmd/neofs-node/config/replicator/config.go +++ b/cmd/neofs-node/config/replicator/config.go @@ -13,10 +13,10 @@ const ( PutTimeoutDefault = 5 * time.Second ) -// PutTimeout returns value of "put_timeout" config parameter +// PutTimeout returns the value of "put_timeout" config parameter // from "replicator" section. // -// Returns PutTimeoutDefault if value is not positive duration. +// Returns PutTimeoutDefault if the value is not positive duration. func PutTimeout(c *config.Config) time.Duration { v := config.DurationSafe(c.Sub(subsection), "put_timeout") if v > 0 { diff --git a/cmd/neofs-node/config/test/config.go b/cmd/neofs-node/config/test/config.go index 947a437d95..44474315c4 100644 --- a/cmd/neofs-node/config/test/config.go +++ b/cmd/neofs-node/config/test/config.go @@ -11,7 +11,7 @@ import ( func fromFile(path string) *config.Config { var p config.Prm - os.Clearenv() // ENVs have priority over config files so we do this in tests + os.Clearenv() // ENVs have priority over config files, so we do this in tests return config.New(p, config.WithConfigFile(path), diff --git a/cmd/neofs-node/morph.go b/cmd/neofs-node/morph.go index ec00a1646e..6f0f023e77 100644 --- a/cmd/neofs-node/morph.go +++ b/cmd/neofs-node/morph.go @@ -21,10 +21,10 @@ import ( const ( newEpochNotification = "NewEpoch" - // notaryDepositExtraBlocks is amount of extra blocks to overlap two deposits, + // notaryDepositExtraBlocks is the amount of extra blocks to overlap two deposits, // we do that to make sure that there won't be any blocks without deposited - // assets in notary contract; make sure it is bigger than any extra rounding - // value in notary client. + // assets in a notary contract; make sure it is bigger than any extra rounding + // value in a notary client. notaryDepositExtraBlocks = 300 // amount of tries(blocks) before notary deposit timeout. diff --git a/cmd/neofs-node/reputation/common/remote.go b/cmd/neofs-node/reputation/common/remote.go index e7005ba9b7..95fb834da6 100644 --- a/cmd/neofs-node/reputation/common/remote.go +++ b/cmd/neofs-node/reputation/common/remote.go @@ -15,16 +15,16 @@ type clientCache interface { Get(client.NodeInfo) (client.Client, error) } -// clientKeyRemoteProvider must provide remote writer and take into account -// that requests must be sent via passed api client and must be signed with -// passed private key. +// clientKeyRemoteProvider must provide a remote writer and take into account +// that requests must be sent via the passed api client and must be signed with +// the passed private key. type clientKeyRemoteProvider interface { WithClient(client.Client) reputationcommon.WriterProvider } -// remoteTrustProvider is implementation of reputation RemoteWriterProvider interface. -// It caches clients, checks if it is the end of the route and checks either current -// node is remote target or not. +// remoteTrustProvider is an implementation of reputation RemoteWriterProvider interface. +// It caches clients, checks if it is the end of the route and checks either the current +// node is a remote target or not. // // remoteTrustProvider requires to be provided with clientKeyRemoteProvider. type remoteTrustProvider struct { diff --git a/cmd/neofs-node/reputation/common/util.go b/cmd/neofs-node/reputation/common/util.go index a0a8a2946f..0e34f34f59 100644 --- a/cmd/neofs-node/reputation/common/util.go +++ b/cmd/neofs-node/reputation/common/util.go @@ -27,7 +27,7 @@ func (NopReputationWriter) Close() error { return nil } -// OnlyKeyRemoteServerInfo if implementation of reputation.ServerInfo +// OnlyKeyRemoteServerInfo is an implementation of reputation.ServerInfo // interface but with only public key data. type OnlyKeyRemoteServerInfo struct { Key []byte diff --git a/cmd/neofs-node/reputation/intermediate/calculator.go b/cmd/neofs-node/reputation/intermediate/calculator.go index 9b7d58a6e7..64fb6abcbb 100644 --- a/cmd/neofs-node/reputation/intermediate/calculator.go +++ b/cmd/neofs-node/reputation/intermediate/calculator.go @@ -11,7 +11,7 @@ import ( eigentrustctrl "github.com/nspcc-dev/neofs-node/pkg/services/reputation/eigentrust/controller" ) -// InitialTrustSource is implementation of the +// InitialTrustSource is an implementation of the // reputation/eigentrust/calculator's InitialTrustSource interface. type InitialTrustSource struct { NetMap netmap.Source @@ -19,7 +19,7 @@ type InitialTrustSource struct { var ErrEmptyNetMap = errors.New("empty NepMap") -// InitialTrust returns `initialTrust` as initial trust value. +// InitialTrust returns `initialTrust` as an initial trust value. func (i InitialTrustSource) InitialTrust(reputation.PeerID) (reputation.TrustValue, error) { nm, err := i.NetMap.GetNetMap(1) if err != nil { @@ -34,13 +34,13 @@ func (i InitialTrustSource) InitialTrust(reputation.PeerID) (reputation.TrustVal return reputation.TrustOne.Div(nodeCount), nil } -// DaughtersTrustCalculator wraps EigenTrust calculator and implements +// DaughtersTrustCalculator wraps EigenTrust calculator and implements the // eigentrust/calculator's DaughtersTrustCalculator interface. type DaughtersTrustCalculator struct { Calculator *eigencalc.Calculator } -// Calculate converts and passes values to wrapped calculator. +// Calculate converts and passes values to the wrapped calculator. func (c *DaughtersTrustCalculator) Calculate(ctx eigentrustctrl.IterationContext) { calcPrm := eigencalc.CalculatePrm{} epochIteration := eigentrust.EpochIteration{} diff --git a/cmd/neofs-node/reputation/intermediate/consumers.go b/cmd/neofs-node/reputation/intermediate/consumers.go index 0e55f83698..7ad35facb2 100644 --- a/cmd/neofs-node/reputation/intermediate/consumers.go +++ b/cmd/neofs-node/reputation/intermediate/consumers.go @@ -14,16 +14,16 @@ import ( var ErrIncorrectContextPanicMsg = "could not write intermediate trust: passed context incorrect" -// ConsumerStorageWriterProvider is implementation of reputation.WriterProvider +// ConsumerStorageWriterProvider is an implementation of the reputation.WriterProvider // interface that provides ConsumerTrustWriter writer. type ConsumerStorageWriterProvider struct { Log *logger.Logger Storage *consumerstorage.Storage } -// ConsumerTrustWriter is implementation of reputation.Writer interface -// that writes passed consumer's Trust values to Consumer storage. After writing -// that values can be used in eigenTrust algorithm's iterations. +// ConsumerTrustWriter is an implementation of the reputation.Writer interface +// that writes passed consumer's Trust values to the Consumer storage. After writing +// that, values can be used in eigenTrust algorithm's iterations. type ConsumerTrustWriter struct { log *logger.Logger storage *consumerstorage.Storage diff --git a/cmd/neofs-node/reputation/intermediate/contract.go b/cmd/neofs-node/reputation/intermediate/contract.go index 6f88c7b8bc..d23b453242 100644 --- a/cmd/neofs-node/reputation/intermediate/contract.go +++ b/cmd/neofs-node/reputation/intermediate/contract.go @@ -43,7 +43,7 @@ func NewFinalWriterProvider(prm FinalWriterProviderPrm, opts ...FinalWriterOptio } } -// FinalWriterProvider is implementation of reputation.eigentrust.calculator +// FinalWriterProvider is an implementation of the reputation.eigentrust.calculator // IntermediateWriterProvider interface. It inits FinalWriter. type FinalWriterProvider struct { prm FinalWriterProviderPrm @@ -60,7 +60,7 @@ func (fwp FinalWriterProvider) InitIntermediateWriter( }, nil } -// FinalWriter is implementation of reputation.eigentrust.calculator IntermediateWriter +// FinalWriter is an implementation of the reputation.eigentrust.calculator IntermediateWriter // interface that writes GlobalTrust to contract directly. type FinalWriter struct { privatKey *ecdsa.PrivateKey diff --git a/cmd/neofs-node/reputation/intermediate/daughters.go b/cmd/neofs-node/reputation/intermediate/daughters.go index 514126c99d..6b4821d438 100644 --- a/cmd/neofs-node/reputation/intermediate/daughters.go +++ b/cmd/neofs-node/reputation/intermediate/daughters.go @@ -10,16 +10,16 @@ import ( "go.uber.org/zap" ) -// DaughterStorageWriterProvider is implementation of reputation.WriterProvider +// DaughterStorageWriterProvider is an implementation of the reputation.WriterProvider // interface that provides DaughterTrustWriter writer. type DaughterStorageWriterProvider struct { Log *logger.Logger Storage *daughters.Storage } -// DaughterTrustWriter is implementation of reputation.Writer interface +// DaughterTrustWriter is an implementation of the reputation.Writer interface // that writes passed daughter's Trust values to Daughter storage. After writing -// that values can be used in eigenTrust algorithm's iterations. +// that, values can be used in eigenTrust algorithm's iterations. type DaughterTrustWriter struct { log *logger.Logger storage *daughters.Storage diff --git a/cmd/neofs-node/reputation/intermediate/remote.go b/cmd/neofs-node/reputation/intermediate/remote.go index 5d312e2b32..5f8129f390 100644 --- a/cmd/neofs-node/reputation/intermediate/remote.go +++ b/cmd/neofs-node/reputation/intermediate/remote.go @@ -87,7 +87,7 @@ type RemoteTrustWriter struct { log *logger.Logger } -// Write sends trust value to remote node via ReputationService.AnnounceIntermediateResult RPC. +// Write sends a trust value to a remote node via ReputationService.AnnounceIntermediateResult RPC. func (rtp *RemoteTrustWriter) Write(t reputation.Trust) error { epoch := rtp.eiCtx.Epoch() i := rtp.eiCtx.I() diff --git a/cmd/neofs-node/reputation/intermediate/storage.go b/cmd/neofs-node/reputation/intermediate/storage.go index b15fdc379d..2f02d0548d 100644 --- a/cmd/neofs-node/reputation/intermediate/storage.go +++ b/cmd/neofs-node/reputation/intermediate/storage.go @@ -10,14 +10,14 @@ import ( "github.com/nspcc-dev/neofs-node/pkg/services/reputation/eigentrust/storage/daughters" ) -// DaughterTrustIteratorProvider is implementation of the +// DaughterTrustIteratorProvider is an implementation of the // reputation/eigentrust/calculator's DaughterTrustIteratorProvider interface. type DaughterTrustIteratorProvider struct { DaughterStorage *daughters.Storage ConsumerStorage *consumerstorage.Storage } -// InitDaughterIterator returns iterator over received +// InitDaughterIterator returns an iterator over the received // local trusts for ctx.Epoch() epoch from daughter p. func (ip *DaughterTrustIteratorProvider) InitDaughterIterator(ctx eigentrustcalc.Context, p reputation.PeerID) (eigentrustcalc.TrustIterator, error) { @@ -34,7 +34,7 @@ func (ip *DaughterTrustIteratorProvider) InitDaughterIterator(ctx eigentrustcalc return daughterIterator, nil } -// InitAllDaughtersIterator returns iterator over all +// InitAllDaughtersIterator returns an iterator over all // daughters of the current node(manager) and all local // trusts received from them for ctx.Epoch() epoch. func (ip *DaughterTrustIteratorProvider) InitAllDaughtersIterator( @@ -49,7 +49,7 @@ func (ip *DaughterTrustIteratorProvider) InitAllDaughtersIterator( return iter, nil } -// InitConsumersIterator returns iterator over all daughters +// InitConsumersIterator returns an iterator over all daughters // of the current node(manager) and all their consumers' local // trusts for ctx.Epoch() epoch and ctx.I() iteration. func (ip *DaughterTrustIteratorProvider) InitConsumersIterator( diff --git a/cmd/neofs-node/reputation/internal/client/client.go b/cmd/neofs-node/reputation/internal/client/client.go index 1fcaf5b6ea..6f845ce2dc 100644 --- a/cmd/neofs-node/reputation/internal/client/client.go +++ b/cmd/neofs-node/reputation/internal/client/client.go @@ -15,7 +15,7 @@ type commonPrm struct { ctx context.Context } -// SetClient sets base client for NeoFS API communication. +// SetClient sets the base client for NeoFS API communication. // // Required parameter. func (x *commonPrm) SetClient(cli coreclient.Client) { @@ -36,24 +36,24 @@ type AnnounceLocalPrm struct { cliPrm client.PrmAnnounceLocalTrust } -// SetEpoch sets epoch in which the trust was assessed. +// SetEpoch sets the epoch in which the trust was assessed. func (x *AnnounceLocalPrm) SetEpoch(epoch uint64) { x.cliPrm.SetEpoch(epoch) } -// SetTrusts sets list of local trust values. +// SetTrusts sets a list of local trust values. func (x *AnnounceLocalPrm) SetTrusts(ts []reputation.Trust) { x.cliPrm.SetValues(ts) } -// AnnounceLocalRes groups resulting values of AnnounceLocal operation. +// AnnounceLocalRes groups the resulting values of AnnounceLocal operation. type AnnounceLocalRes struct{} // AnnounceLocal sends estimations of local trust to the remote node. // // Client, context and key must be set. // -// Returns any error prevented the operation from completing correctly in error return. +// Returns any error which prevented the operation from completing correctly in error return. func AnnounceLocal(prm AnnounceLocalPrm) (res AnnounceLocalRes, err error) { var cliRes *client.ResAnnounceLocalTrust @@ -73,30 +73,30 @@ type AnnounceIntermediatePrm struct { cliPrm client.PrmAnnounceIntermediateTrust } -// SetEpoch sets number of the epoch when the trust calculation's iteration was executed. +// SetEpoch sets the number of the epoch when the trust calculation's iteration was executed. func (x *AnnounceIntermediatePrm) SetEpoch(epoch uint64) { x.cliPrm.SetEpoch(epoch) } -// SetIteration sets number of the iteration of the trust calculation algorithm. +// SetIteration sets the number of the iteration of the trust calculation algorithm. func (x *AnnounceIntermediatePrm) SetIteration(iter uint32) { x.cliPrm.SetIteration(iter) } -// SetTrust sets current global trust value computed at the iteration. +// SetTrust sets the current global trust value computed at the iteration. func (x *AnnounceIntermediatePrm) SetTrust(t reputation.PeerToPeerTrust) { x.cliPrm.SetCurrentValue(t) } -// AnnounceIntermediateRes groups resulting values of AnnounceIntermediate operation. +// AnnounceIntermediateRes groups the resulting values of AnnounceIntermediate operation. type AnnounceIntermediateRes struct{} -// AnnounceIntermediate sends global trust value calculated at the specified iteration +// AnnounceIntermediate sends the global trust value calculated at the specified iteration // and epoch to to the remote node. // // Client, context and key must be set. // -// Returns any error prevented the operation from completing correctly in error return. +// Returns any error which prevented the operation from completing correctly in error return. func AnnounceIntermediate(prm AnnounceIntermediatePrm) (res AnnounceIntermediateRes, err error) { var cliRes *client.ResAnnounceIntermediateTrust diff --git a/cmd/neofs-node/reputation/internal/client/doc.go b/cmd/neofs-node/reputation/internal/client/doc.go index 2c6365d7b8..f7823563d8 100644 --- a/cmd/neofs-node/reputation/internal/client/doc.go +++ b/cmd/neofs-node/reputation/internal/client/doc.go @@ -4,8 +4,8 @@ // the Reputation service does not fully use the client's flexible interface. // // In this regard, this package provides functions over base API client necessary for the application. -// This allows you to concentrate the entire spectrum of the client's use in one place (this will be convenient -// both when updating the base client and for evaluating the UX of SDK library). So it is expected that all -// Reputation service packages will be limited to this package for the development of functionality requiring +// This allows you to concentrate the entire spectrum of the client's use in one place (this will be convenient +// both when updating the base client and for evaluating the UX of SDK library). So, it is expected that all +// Reputation service packages will be limited to this package for the development of functionality requiring // NeoFS API communication. package internal diff --git a/cmd/neofs-node/reputation/ticker/fixed.go b/cmd/neofs-node/reputation/ticker/fixed.go index 4f73d4b542..5403882d50 100644 --- a/cmd/neofs-node/reputation/ticker/fixed.go +++ b/cmd/neofs-node/reputation/ticker/fixed.go @@ -8,7 +8,7 @@ import ( // IterationHandler is a callback of a certain block advance. type IterationHandler func() -// IterationsTicker represents fixed tick number block timer. +// IterationsTicker represents a fixed tick number block timer. // // It can tick the blocks and perform certain actions // on block time intervals. @@ -25,12 +25,12 @@ type IterationsTicker struct { // NewIterationsTicker creates a new IterationsTicker. // -// It guaranties that handler would be called the +// It guaranties that a handler would be called the // specified amount of times in the specified amount -// of blocks. After the last meaningful Tick IterationsTicker +// of blocks. After the last meaningful Tick, IterationsTicker // becomes no-op timer. // -// Returns error only if times is greater than totalBlocks. +// Returns an error only if times is greater than totalBlocks. func NewIterationsTicker(totalBlocks uint64, times uint64, h IterationHandler) (*IterationsTicker, error) { period := totalBlocks / times diff --git a/config/mainnet/README.md b/config/mainnet/README.md index db11ce0632..5b21508c4e 100644 --- a/config/mainnet/README.md +++ b/config/mainnet/README.md @@ -1,17 +1,17 @@ # N3 Mainnet Storage node configuration -Here is the template for simple storage node configuration in N3 Mainnet. +Here is a template for simple storage node configuration in N3 Mainnet. Make sure to specify correct values instead of `<...>` placeholders. -Do not change `contracts` section. Run latest neofs-node release with -fixed config `neofs-node -c config.yml` +Do not change `contracts` section. Run the latest neofs-node release with +the fixed config `neofs-node -c config.yml` -To use NeoFS in the Mainnet you need to deposit assets to NeoFS contract. +To use NeoFS in the Mainnet, you need to deposit assets to NeoFS contract. The contract sript hash is `2cafa46838e8b564468ebd868dcafdd99dce6221` (N3 address `NNxVrKjLsRkWsmGgmuNXLcMswtxTGaNQLk`) ## Tips -Use `grpcs://` scheme in announced address if you enable TLS in grpc server. +Use `grpcs://` scheme in the announced address if you enable TLS in grpc server. ```yaml node: addresses: diff --git a/config/testnet/README.md b/config/testnet/README.md index fef384aa56..42e966ff6b 100644 --- a/config/testnet/README.md +++ b/config/testnet/README.md @@ -1,7 +1,7 @@ # N3 Testnet Storage node configuration There is a prepared configuration for NeoFS Storage Node deployment in -N3 Testnet. The easiest way to deploy Storage Node is to use prepared +N3 Testnet. The easiest way to deploy a Storage Node is to use the prepared docker image and run it with docker-compose. ## Build image @@ -19,20 +19,20 @@ Successfully tagged nspccdev/neofs-storage-testnet:0.25.1 ## Deploy node -To run storage node in N3 Testnet environment you should deposit GAS assets, +To run a storage node in N3 Testnet environment, you should deposit GAS assets, update docker-compose file and start the node. ### Deposit -Storage Node owner should deposit GAS to NeoFS smart contract. It generates a -bit of side chain GAS in node's wallet. Side chain GAS used to send bootstrap tx. +The Storage Node owner should deposit GAS to NeoFS smart contract. It generates a +bit of sidechain GAS in the node's wallet. Sidechain GAS is used to send bootstrap tx. -First obtain GAS in N3 Testnet chain. You can do that with +First, obtain GAS in N3 Testnet chain. You can do that with [faucet](https://neowish.ngd.network) service. -Then make a deposit by transferring GAS to NeoFS contract in N3 Testnet. +Then, make a deposit by transferring GAS to NeoFS contract in N3 Testnet. You can provide scripthash in the `data` argument of transfer tx to make a -deposit to specified account. Otherwise, deposit is made to tx sender. +deposit to a specified account. Otherwise, deposit is made to the tx sender. NeoFS contract scripthash in N3 Testnet is `b65d8243ac63983206d17e5221af0653a7266fa1`, so the address is `NadZ8YfvkddivcFFkztZgfwxZyKf1acpRF`. @@ -49,7 +49,7 @@ neo-go wallet nep17 transfer -w wallet.json -r https://rpc01.testnet.n3.nspcc.ru ### Configure -Then configure `node_config.env` file. Change endpoints values. Both +Next, configure `node_config.env` file. Change endpoints values. Both should contain your **public** IP. ``` @@ -79,8 +79,8 @@ Subdivision: [SPE] Sankt-Peterburg Coordinates: 59.53, 30.15 ``` -It is recommended to pass node's key as a file. To do so convert your wallet -WIF to 32-byte hex (via `neofs-cli` for example) and save it to file. +It is recommended to pass the node's key as a file. To do so, convert your wallet +WIF to 32-byte hex (via `neofs-cli` for example) and save it to a file. ``` // Print WIF in a 32-byte hex format @@ -96,7 +96,7 @@ ScriptHash3.0BE dc4b0b44d01c16667880062e2fd4508f9939fedf $ echo '11ab917cd99170cb8d0d48e78fca317564e6b3aaff7f7058952d6175cdca0f56' | xxd -r -p > my_wallet.key ``` -Then specify path to this file in `docker-compose.yml` +Then, specify the path to this file in `docker-compose.yml` ```yaml volumes: - neofs_storage:/storage @@ -105,8 +105,8 @@ Then specify path to this file in `docker-compose.yml` NeoFS objects will be stored on your machine. By default, docker-compose -configured to store objects in named docker volume `neofs_storage`. You can -specify directory on the filesystem to store objects there. +is configured to store objects in named docker volume `neofs_storage`. You can +specify a directory on the filesystem to store objects there. ```yaml volumes: @@ -116,12 +116,12 @@ specify directory on the filesystem to store objects there. ### Start -Run node with `docker-compose up` command and stop it with `docker-compose down`. +Run the node with `docker-compose up` command and stop it with `docker-compose down`. ### Debug -To print node logs use `docker logs neofs-testnet`. To print debug messages in -log, setup log level to debug with this env: +To print node logs, use `docker logs neofs-testnet`. To print debug messages in +log, set up log level to debug with this env: ```yaml environment: diff --git a/docs/release-instruction.md b/docs/release-instruction.md index 02280ed557..c5856537b2 100644 --- a/docs/release-instruction.md +++ b/docs/release-instruction.md @@ -19,8 +19,8 @@ describing the most significant changes done in this release. Add and changes. Describe each change in detail with a reference to GitHub issues if possible. -Update supported version of neofs-contract in `README.md` if there were -changes between releases. +Update the supported version of neofs-contract in `README.md` if there were +changes in releases. ## Tag the release @@ -64,4 +64,4 @@ Close corresponding vX.Y.Z GitHub milestone. Prepare pull-request for [neofs-devenv](https://github.com/nspcc-dev/neofs-devenv). -Rebuild NeoFS LOCODE database via CLI `util locode generate` command (if needed). \ No newline at end of file +Rebuild NeoFS LOCODE database via CLI `util locode generate` command (if needed). diff --git a/pkg/core/client/client.go b/pkg/core/client/client.go index 4eafebfdcd..1a85749b2e 100644 --- a/pkg/core/client/client.go +++ b/pkg/core/client/client.go @@ -35,31 +35,31 @@ type MultiAddressClient interface { RawForAddress(network.Address, func(cli *rawclient.Client) error) error } -// NodeInfo groups information about NeoFS storage node needed for Client construction. +// NodeInfo groups information about a NeoFS storage node needed for Client construction. type NodeInfo struct { addrGroup network.AddressGroup key []byte } -// SetAddressGroup sets group of network addresses. +// SetAddressGroup sets a group of network addresses. func (x *NodeInfo) SetAddressGroup(v network.AddressGroup) { x.addrGroup = v } -// AddressGroup returns group of network addresses. +// AddressGroup returns a group of network addresses. func (x NodeInfo) AddressGroup() network.AddressGroup { return x.addrGroup } -// SetPublicKey sets public key in a binary format. +// SetPublicKey sets a public key in a binary format. // // Argument must not be mutated. func (x *NodeInfo) SetPublicKey(v []byte) { x.key = v } -// PublicKey returns public key in a binary format. +// PublicKey returns a public key in a binary format. // // Result must not be mutated. func (x *NodeInfo) PublicKey() []byte { diff --git a/pkg/core/client/util.go b/pkg/core/client/util.go index 0d464c84be..fa0c0225ec 100644 --- a/pkg/core/client/util.go +++ b/pkg/core/client/util.go @@ -33,7 +33,7 @@ func NodeInfoFromRawNetmapElement(dst *NodeInfo, info interface { return nil } -// NodeInfoFromNetmapElement fills NodeInfo structure from the interface of parsed netmap member's descriptor. +// NodeInfoFromNetmapElement fills NodeInfo structure from the interface of the parsed netmap member's descriptor. // // Args must not be nil. func NodeInfoFromNetmapElement(dst *NodeInfo, info interface { @@ -43,7 +43,7 @@ func NodeInfoFromNetmapElement(dst *NodeInfo, info interface { nodeInfoFromKeyAddr(dst, info.PublicKey(), info.Addresses()) } -// AssertKeyResponseCallback returns client response callback which checks if the response was signed by expected key. +// AssertKeyResponseCallback returns client response callback which checks if the response was signed by the expected key. // Returns ErrWrongPublicKey in case of key mismatch. func AssertKeyResponseCallback(expectedKey []byte) func(client.ResponseMetaInfo) error { return func(info client.ResponseMetaInfo) error { diff --git a/pkg/core/container/delete.go b/pkg/core/container/delete.go index 341645b759..700d349f20 100644 --- a/pkg/core/container/delete.go +++ b/pkg/core/container/delete.go @@ -15,36 +15,36 @@ type RemovalWitness struct { token *session.Token } -// ContainerID returns identifier of the container +// ContainerID returns the identifier of the container // to be removed. func (x RemovalWitness) ContainerID() *cid.ID { return x.cid } -// SetContainerID sets identifier of the container +// SetContainerID sets the identifier of the container // to be removed. func (x *RemovalWitness) SetContainerID(id *cid.ID) { x.cid = id } -// Signature returns signature of the container identifier. +// Signature returns the signature of the container identifier. func (x RemovalWitness) Signature() []byte { return x.sig } -// SetSignature sets signature of the container identifier. +// SetSignature sets a signature of the container identifier. func (x *RemovalWitness) SetSignature(sig []byte) { x.sig = sig } -// SessionToken returns token of the session within -// which container was removed. +// SessionToken returns the token of the session within +// which the container was removed. func (x RemovalWitness) SessionToken() *session.Token { return x.token } -// SetSessionToken sets token of the session within -// which container was removed. +// SetSessionToken sets the token of the session within +// which the container was removed. func (x *RemovalWitness) SetSessionToken(tok *session.Token) { x.token = tok } diff --git a/pkg/core/container/fmt.go b/pkg/core/container/fmt.go index b50ea12fe1..05e40aa35c 100644 --- a/pkg/core/container/fmt.go +++ b/pkg/core/container/fmt.go @@ -18,7 +18,7 @@ var ( // CheckFormat conducts an initial check of the v2 container data. // // It is expected that if a container fails this test, -// it will not be inner-ring approved. +// it will not be approved by the inner ring. func CheckFormat(c *container.Container) error { if c.PlacementPolicy() == nil { return errNilPolicy diff --git a/pkg/core/container/storage.go b/pkg/core/container/storage.go index 3d8b87c2f2..ef0a484122 100644 --- a/pkg/core/container/storage.go +++ b/pkg/core/container/storage.go @@ -11,23 +11,23 @@ import ( // Source is an interface that wraps // basic container receiving method. type Source interface { - // Get reads the container from the storage by identifier. - // It returns the pointer to requested container and any error encountered. + // Get reads the container from the storage by its identifier. + // It returns the pointer to the requested container and any error encountered. // // Get must return exactly one non-nil value. - // Get must return an error of type apistatus.ContainerNotFound if the container is not in storage. + // Get must return an error of type apistatus.ContainerNotFound if the container is not in the storage. // // Implementations must not retain the container pointer and modify // the container through it. Get(*cid.ID) (*container.Container, error) } -// IsErrNotFound checks if error returned by Source.Get corresponds -// to missing container. +// IsErrNotFound checks if the error returned by Source.Get corresponds +// to the missing container. func IsErrNotFound(err error) bool { return errors.As(err, new(apistatus.ContainerNotFound)) } // ErrEACLNotFound is returned by eACL storage implementations when -// requested eACL table is not in storage. +// the requested eACL table is not in the storage. var ErrEACLNotFound = errors.New("extended ACL table is not set for this container") diff --git a/pkg/core/netmap/keys.go b/pkg/core/netmap/keys.go index 5ad175b324..29cb2dc943 100644 --- a/pkg/core/netmap/keys.go +++ b/pkg/core/netmap/keys.go @@ -1,7 +1,7 @@ package netmap -// AnnouncedKeys is an interface of utility for working with announced public keys of the storage nodes. +// AnnouncedKeys is an interface of utility for working with the announced public keys of the storage nodes. type AnnouncedKeys interface { - // Checks if key was announced by local node. + // Checks if the key was announced by a local node. IsLocalKey(key []byte) bool } diff --git a/pkg/core/netmap/state.go b/pkg/core/netmap/state.go index 8947416e9b..9b5b441a10 100644 --- a/pkg/core/netmap/state.go +++ b/pkg/core/netmap/state.go @@ -1,7 +1,7 @@ package netmap -// State groups current system state parameters. +// State groups the current system state parameters. type State interface { - // CurrentEpoch returns number of current NeoFS epoch. + // CurrentEpoch returns the number of the current NeoFS epoch. CurrentEpoch() uint64 } diff --git a/pkg/core/netmap/storage.go b/pkg/core/netmap/storage.go index dec110eb57..2ef469edc9 100644 --- a/pkg/core/netmap/storage.go +++ b/pkg/core/netmap/storage.go @@ -8,18 +8,18 @@ import ( // basic network map receiving method. type Source interface { // GetNetMap reads the diff-th past network map from the storage. - // Calling with zero diff returns latest network map. - // It returns the pointer to requested network map and any error encountered. + // Calling with zero diff returns the latest network map. + // It returns the pointer to the requested network map and any error encountered. // // GetNetMap must return exactly one non-nil value. - // GetNetMap must return ErrNotFound if the network map is not in storage. + // GetNetMap must return ErrNotFound if the network map is not in the storage. // // Implementations must not retain the network map pointer and modify // the network map through it. GetNetMap(diff uint64) (*netmap.Netmap, error) // GetNetMapByEpoch reads network map by the epoch number from the storage. - // It returns the pointer to requested network map and any error encountered. + // It returns the pointer to the requested network map and any error encountered. // // Must return exactly one non-nil value. // @@ -27,19 +27,19 @@ type Source interface { // the network map through it. GetNetMapByEpoch(epoch uint64) (*netmap.Netmap, error) - // Epoch reads current epoch from the storage. - // It returns number of the current epoch and any error encountered. + // Epoch reads the current epoch from the storage. + // It returns thw number of the current epoch and any error encountered. // // Must return exactly one non-default value. Epoch() (uint64, error) } -// GetLatestNetworkMap requests and returns latest network map from storage. +// GetLatestNetworkMap requests and returns the latest network map from the storage. func GetLatestNetworkMap(src Source) (*netmap.Netmap, error) { return src.GetNetMap(0) } -// GetPreviousNetworkMap requests and returns previous from latest network map from storage. +// GetPreviousNetworkMap requests and returns previous from the latest network map from the storage. func GetPreviousNetworkMap(src Source) (*netmap.Netmap, error) { return src.GetNetMap(1) } diff --git a/pkg/core/object/fmt.go b/pkg/core/object/fmt.go index a48290aaf4..1c2dc4fa1f 100644 --- a/pkg/core/object/fmt.go +++ b/pkg/core/object/fmt.go @@ -19,12 +19,12 @@ import ( "github.com/nspcc-dev/neofs-sdk-go/storagegroup" ) -// FormatValidator represents object format validator. +// FormatValidator represents an object format validator. type FormatValidator struct { *cfg } -// FormatValidatorOption represents FormatValidator constructor option. +// FormatValidatorOption represents a FormatValidator constructor option. type FormatValidatorOption func(*cfg) type cfg struct { @@ -37,7 +37,7 @@ type cfg struct { // DeleteHandler is an interface of delete queue processor. type DeleteHandler interface { - // DeleteObjects objects places objects to removal queue. + // DeleteObjects places objects to a removal queue. // // Returns apistatus.LockNonRegularObject if at least one object // is locked. @@ -85,7 +85,7 @@ func NewFormatValidator(opts ...FormatValidatorOption) *FormatValidator { // Does not validate payload checksum and content. // If unprepared is true, only fields set by user are validated. // -// Returns nil error if object has valid structure. +// Returns nil error if the object has valid structure. func (v *FormatValidator) Validate(obj *object.Object, unprepared bool) error { if obj == nil { return errNilObject @@ -153,7 +153,7 @@ func (v *FormatValidator) checkOwnerKey(id *owner.ID, key []byte) error { return nil } -// ValidateContent validates payload content according to object type. +// ValidateContent validates payload content according to the object type. func (v *FormatValidator) ValidateContent(o *object.Object) error { switch o.Type() { case object.TypeRegular: @@ -169,7 +169,7 @@ func (v *FormatValidator) ValidateContent(o *object.Object) error { return fmt.Errorf("(%T) could not unmarshal tombstone content: %w", v, err) } - // check if tombstone has the same expiration in body and header + // check if the tombstone has the same expiration in the body and the header exp, err := expirationEpochAttribute(o) if err != nil { return err @@ -179,7 +179,7 @@ func (v *FormatValidator) ValidateContent(o *object.Object) error { return errTombstoneExpiration } - // mark all objects from tombstone body as removed in storage engine + // mark all objects from the tombstone body as removed in the storage engine cid := o.ContainerID() idList := tombstone.Members() addrList := make([]*addressSDK.Address, 0, len(idList)) @@ -226,7 +226,7 @@ func (v *FormatValidator) ValidateContent(o *object.Object) error { return errors.New("missing locked members") } - // mark all objects from lock list as locked in storage engine + // mark all objects from lock list as locked in the storage engine locklist := make([]oid.ID, num) lock.ReadMembers(locklist) @@ -303,7 +303,7 @@ func (v *FormatValidator) checkAttributes(obj *object.Object) error { var errIncorrectOwner = errors.New("incorrect object owner") func (v *FormatValidator) checkOwner(obj *object.Object) error { - // TODO: use appropriate functionality after neofs-api-go#352 + // TODO: use an appropriate functionality after neofs-api-go#352 if len(obj.OwnerID().ToV2().GetValue()) != owner.NEO3WalletSize { return errIncorrectOwner } @@ -311,21 +311,21 @@ func (v *FormatValidator) checkOwner(obj *object.Object) error { return nil } -// WithNetState returns options to set network state interface. +// WithNetState returns options to set the network state interface. func WithNetState(netState netmap.State) FormatValidatorOption { return func(c *cfg) { c.netState = netState } } -// WithDeleteHandler returns option to set delete queue processor. +// WithDeleteHandler returns an option to set delete queue processor. func WithDeleteHandler(v DeleteHandler) FormatValidatorOption { return func(c *cfg) { c.deleteHandler = v } } -// WithLocker returns option to set object lock storage. +// WithLocker returns an option to set object lock storage. func WithLocker(v Locker) FormatValidatorOption { return func(c *cfg) { c.locker = v diff --git a/pkg/core/object/object.go b/pkg/core/object/object.go index dda5705dd5..7ff0ed5762 100644 --- a/pkg/core/object/object.go +++ b/pkg/core/object/object.go @@ -5,7 +5,7 @@ import ( addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address" ) -// AddressOf returns address of the object. +// AddressOf returns the address of the object. func AddressOf(obj *object.Object) *addressSDK.Address { if obj != nil { addr := addressSDK.NewAddress() diff --git a/pkg/innerring/config/config.go b/pkg/innerring/config/config.go index 0c22478695..5cb74affda 100644 --- a/pkg/innerring/config/config.go +++ b/pkg/innerring/config/config.go @@ -2,11 +2,11 @@ package config /* Config package contains GlobalConfig structure that implements config -reader from both local and global configurations. Most of the time inner ring -does not need this, as for application it has static config with timeouts, -caches sizes etc. However there are routines that use global configuration +reader from both local and global configurations. Most of the time the inner ring +does not need this; as for application, it has static config with timeouts, +caches sizes etc. However, there are routines that use global configuration values that can be changed in runtime, e.g. basic income rate. Local -configuration value overrides global one so it is easy to debug and test +configuration value overrides the global one so it is easy to debug and test in different environments. Implemented as a part of https://github.com/nspcc-dev/neofs-node/issues/363 diff --git a/pkg/innerring/fetcher.go b/pkg/innerring/fetcher.go index b6c9cbe15e..480225dc3d 100644 --- a/pkg/innerring/fetcher.go +++ b/pkg/innerring/fetcher.go @@ -46,13 +46,13 @@ type IrFetcherWithoutNotary struct { } // InnerRingKeys fetches list of innerring keys from NeoFSAlphabet -// role in side chain. +// role in the sidechain. func (fN IrFetcherWithNotary) InnerRingKeys() (keys.PublicKeys, error) { return fN.cli.NeoFSAlphabetList() } // InnerRingKeys fetches list of innerring keys from netmap contract -// in side chain. +// in the sidechain. func (f IrFetcherWithoutNotary) InnerRingKeys() (keys.PublicKeys, error) { return f.nm.GetInnerRingList() } diff --git a/pkg/innerring/internal/client/client.go b/pkg/innerring/internal/client/client.go index f10342a47a..d64de58007 100644 --- a/pkg/innerring/internal/client/client.go +++ b/pkg/innerring/internal/client/client.go @@ -24,12 +24,12 @@ type Client struct { c clientcore.Client } -// WrapBasicClient wraps client.Client instance to use it for NeoFS API RPC. +// WrapBasicClient wraps a client.Client instance to use it for NeoFS API RPC. func (x *Client) WrapBasicClient(c clientcore.Client) { x.c = c } -// SetPrivateKey sets private key to sign RPC requests. +// SetPrivateKey sets a private key to sign RPC requests. func (x *Client) SetPrivateKey(key *ecdsa.PrivateKey) { x.key = key } @@ -41,17 +41,17 @@ type SearchSGPrm struct { cnrID *cid.ID } -// SetContainerID sets ID of the container to search for storage groups. +// SetContainerID sets the ID of the container to search for storage groups. func (x *SearchSGPrm) SetContainerID(id *cid.ID) { x.cnrID = id } -// SearchSGRes groups resulting values of SearchSG operation. +// SearchSGRes groups the resulting values of SearchSG operation. type SearchSGRes struct { cliRes []oid.ID } -// IDList returns list of IDs of storage groups in container. +// IDList returns a list of IDs of storage groups in the container. func (x SearchSGRes) IDList() []oid.ID { return x.cliRes } @@ -60,7 +60,7 @@ var sgFilter = storagegroup.SearchQuery() // SearchSG lists objects of storage group type in the container. // -// Returns any error prevented the operation from completing correctly in error return. +// Returns any error which prevented the operation from completing correctly in error return. func (x Client) SearchSG(prm SearchSGPrm) (*SearchSGRes, error) { var cliPrm client.PrmObjectSearch @@ -109,19 +109,19 @@ type GetObjectPrm struct { getObjectPrm } -// GetObjectRes groups resulting values of GetObject operation. +// GetObjectRes groups the resulting values of GetObject operation. type GetObjectRes struct { obj *object.Object } -// Object returns received object. +// Object returns the received object. func (x GetObjectRes) Object() *object.Object { return x.obj } // GetObject reads the object by address. // -// Returns any error prevented the operation from completing correctly in error return. +// Returns any error which prevented the operation from completing correctly in error return. func (x Client) GetObject(prm GetObjectPrm) (*GetObjectRes, error) { var cliPrm client.PrmObjectGet @@ -185,20 +185,20 @@ func (x *HeadObjectPrm) SetTTL(ttl uint32) { x.local = ttl < 2 } -// HeadObjectRes groups resulting values of HeadObject operation. +// HeadObjectRes groups the resulting values of HeadObject operation. type HeadObjectRes struct { hdr *object.Object } -// Header returns received object header. +// Header returns the received object header. func (x HeadObjectRes) Header() *object.Object { return x.hdr } // HeadObject reads short object header by address. // -// Returns any error prevented the operation from completing correctly in error return. -// For raw requests, returns *object.SplitInfoError error if requested object is virtual. +// Returns any error which prevented the operation from completing correctly in error return. +// For raw requests, returns *object.SplitInfoError error if the requested object is virtual. func (x Client) HeadObject(prm HeadObjectPrm) (*HeadObjectRes, error) { var cliPrm client.PrmObjectHead @@ -239,9 +239,9 @@ func (x Client) HeadObject(prm HeadObjectPrm) (*HeadObjectRes, error) { }, nil } -// GetObjectPayload reads object by address from NeoFS via Client and returns its payload. +// GetObjectPayload reads an object by address from NeoFS via Client and returns its payload. // -// Returns any error prevented the operation from completing correctly in error return. +// Returns any error which prevented the operation from completing correctly in error return. func GetObjectPayload(ctx context.Context, c Client, addr *addressSDK.Address) ([]byte, error) { var prm GetObjectPrm @@ -275,12 +275,12 @@ func headObject(ctx context.Context, c Client, addr *addressSDK.Address, raw boo return obj.Header(), nil } -// GetRawObjectHeaderLocally reads raw short object header from server's local storage by address via Client. +// GetRawObjectHeaderLocally reads the raw short object header from the server's local storage by address via Client. func GetRawObjectHeaderLocally(ctx context.Context, c Client, addr *addressSDK.Address) (*object.Object, error) { return headObject(ctx, c, addr, true, 1) } -// GetObjectHeaderFromContainer reads short object header by address via Client with TTL = 10 +// GetObjectHeaderFromContainer reads the short object header by address via Client with TTL = 10 // for deep traversal of the container. func GetObjectHeaderFromContainer(ctx context.Context, c Client, addr *addressSDK.Address) (*object.Object, error) { return headObject(ctx, c, addr, false, 10) @@ -298,12 +298,12 @@ func (x *HashPayloadRangePrm) SetRange(rng *object.Range) { x.rng = rng } -// HashPayloadRangeRes groups resulting values of HashPayloadRange operation. +// HashPayloadRangeRes groups the resulting values of HashPayloadRange operation. type HashPayloadRangeRes struct { h []byte } -// Hash returns hash of the object payload range. +// Hash returns the hash of the object payload range. func (x HashPayloadRangeRes) Hash() []byte { return x.h } @@ -311,7 +311,7 @@ func (x HashPayloadRangeRes) Hash() []byte { // HashPayloadRange requests to calculate Tillich-Zemor hash of the payload range of the object // from the remote server's local storage. // -// Returns any error prevented the operation from completing correctly in error return. +// Returns any error which prevented the operation from completing correctly in error return. func (x Client) HashPayloadRange(prm HashPayloadRangePrm) (res HashPayloadRangeRes, err error) { var cliPrm client.PrmObjectHash @@ -348,7 +348,7 @@ func (x Client) HashPayloadRange(prm HashPayloadRangePrm) (res HashPayloadRangeR // HashObjectRange reads Tillich-Zemor hash of the object payload range by address // from the remote server's local storage via Client. // -// Returns any error prevented the operation from completing correctly in error return. +// Returns any error which prevented the operation from completing correctly in error return. func HashObjectRange(ctx context.Context, c Client, addr *addressSDK.Address, rng *object.Range) ([]byte, error) { var prm HashPayloadRangePrm diff --git a/pkg/innerring/internal/client/doc.go b/pkg/innerring/internal/client/doc.go index 8596c66d6d..491e480269 100644 --- a/pkg/innerring/internal/client/doc.go +++ b/pkg/innerring/internal/client/doc.go @@ -4,9 +4,9 @@ // However, although it encapsulates a useful piece of business logic (e.g. the signature mechanism), // the IR application does not fully use the client's flexible interface. // -// In this regard, this package represents an abstraction - a type-wrapper over the base client. -// The type provides the minimum interface necessary for the application, and also allows you to concentrate +// In this regard, this package represents an abstraction -- a type-wrapper over the base client. +// The type provides the minimum interface necessary for the application and also allows you to concentrate // the entire spectrum of the client's use in one place (this will be convenient both when updating the base client -// and for evaluating the UX of SDK library). So it is expected that all application packages will be limited +// and for evaluating the UX of SDK library). So, it is expected that all application packages will be limited // to this package for the development of functionality requiring NeoFS API communication. package neofsapiclient diff --git a/pkg/innerring/processors/alphabet/processor.go b/pkg/innerring/processors/alphabet/processor.go index 376fbba289..2642a860f2 100644 --- a/pkg/innerring/processors/alphabet/processor.go +++ b/pkg/innerring/processors/alphabet/processor.go @@ -21,16 +21,16 @@ type ( // Contracts is an interface of the storage // of the alphabet contract addresses. Contracts interface { - // GetByIndex must return address of the + // GetByIndex must return the address of the // alphabet contract by index of the glagolitic // letter (e.g 0 for Az, 40 for Izhitsa). // - // Must return false if index does not - // match to any alphabet contract. + // Must return false if the index does not + // match any alphabet contract. GetByIndex(int) (util.Uint160, bool) } - // Processor of events produced for alphabet contracts in sidechain. + // Processor of events produced for alphabet contracts in the sidechain. Processor struct { log *zap.Logger pool *ants.Pool @@ -53,7 +53,7 @@ type ( } ) -// New creates neofs mainnet contract processor instance. +// New creates a neofs mainnet contract processor instance. func New(p *Params) (*Processor, error) { switch { case p.Log == nil: diff --git a/pkg/innerring/processors/audit/events.go b/pkg/innerring/processors/audit/events.go index 32ebe7bcf8..4fb106122c 100644 --- a/pkg/innerring/processors/audit/events.go +++ b/pkg/innerring/processors/audit/events.go @@ -1,11 +1,11 @@ package audit -// Start is a event to start new round of data audit. +// Start is an event to start a new round of data audit. type Start struct { epoch uint64 } -// MorphEvent implements Event interface. +// MorphEvent implements the Event interface. func (a Start) MorphEvent() {} func NewAuditStartEvent(epoch uint64) Start { diff --git a/pkg/innerring/processors/audit/handlers.go b/pkg/innerring/processors/audit/handlers.go index 9ba7bdcd95..38c2acd7d3 100644 --- a/pkg/innerring/processors/audit/handlers.go +++ b/pkg/innerring/processors/audit/handlers.go @@ -12,7 +12,7 @@ func (ap *Processor) handleNewAuditRound(ev event.Event) { ap.log.Info("new round of audit", zap.Uint64("epoch", epoch)) - // send event to the worker pool + // send an event to the worker pool err := ap.pool.Submit(func() { ap.processStartAudit(epoch) }) if err != nil { diff --git a/pkg/innerring/processors/audit/processor.go b/pkg/innerring/processors/audit/processor.go index 2a5bba454e..475b0288a6 100644 --- a/pkg/innerring/processors/audit/processor.go +++ b/pkg/innerring/processors/audit/processor.go @@ -33,7 +33,7 @@ type ( Reset() int } - // Processor of events related with data audit. + // Processor of events related to data audit. Processor struct { log *zap.Logger pool *ants.Pool @@ -77,22 +77,22 @@ func (x SearchSGPrm) Context() context.Context { return x.ctx } -// CID returns identifier of the container to search SG in. +// CID returns the identifier of the container to search SG in. func (x SearchSGPrm) CID() *cid.ID { return x.id } -// NodeInfo returns information about storage node to communicate with. +// NodeInfo returns information about a storage node to communicate with. func (x SearchSGPrm) NodeInfo() client.NodeInfo { return x.info } -// SearchSGDst groups target values which Processor expects from SG searching to process. +// SearchSGDst groups the target values which Processor expects from SG searching to process. type SearchSGDst struct { ids []oidSDK.ID } -// WriteIDList writes list of identifiers of storage group objects stored in the container. +// WriteIDList writes a list of identifiers of storage group objects stored in the container. func (x *SearchSGDst) WriteIDList(ids []oidSDK.ID) { x.ids = ids } @@ -112,8 +112,8 @@ type epochAuditReporter struct { } // ProcessorPoolSize limits pool size for audit Processor. Processor manages -// audit tasks and fills queue for next epoch. This process must not be interrupted -// by new audit epoch, so we limit pool size for processor to one. +// audit tasks and fills queue for the next epoch. This process must not be interrupted +// by a new audit epoch, so we limit the pool size for the processor to one. const ProcessorPoolSize = 1 // New creates audit processor instance. diff --git a/pkg/innerring/processors/balance/handlers.go b/pkg/innerring/processors/balance/handlers.go index 9403a5b898..7c7784b625 100644 --- a/pkg/innerring/processors/balance/handlers.go +++ b/pkg/innerring/processors/balance/handlers.go @@ -14,7 +14,7 @@ func (bp *Processor) handleLock(ev event.Event) { zap.String("type", "lock"), zap.String("value", hex.EncodeToString(lock.ID()))) - // send event to the worker pool + // send an event to the worker pool err := bp.pool.Submit(func() { bp.processLock(&lock) }) if err != nil { diff --git a/pkg/innerring/processors/balance/processor.go b/pkg/innerring/processors/balance/processor.go index 3e24800825..7784d214c3 100644 --- a/pkg/innerring/processors/balance/processor.go +++ b/pkg/innerring/processors/balance/processor.go @@ -22,7 +22,7 @@ type ( ToFixed8(int64) int64 } - // Processor of events produced by balance contract in morph chain. + // Processor of events produced by balance contract in the morphchain. Processor struct { log *zap.Logger pool *ants.Pool @@ -45,7 +45,7 @@ const ( lockNotification = "Lock" ) -// New creates balance contract processor instance. +// New creates a balance contract processor instance. func New(p *Params) (*Processor, error) { switch { case p.Log == nil: diff --git a/pkg/innerring/processors/container/handlers.go b/pkg/innerring/processors/container/handlers.go index f23195f275..494c1cf871 100644 --- a/pkg/innerring/processors/container/handlers.go +++ b/pkg/innerring/processors/container/handlers.go @@ -17,7 +17,7 @@ func (cp *Processor) handlePut(ev event.Event) { zap.String("type", "container put"), zap.String("id", base58.Encode(id[:]))) - // send event to the worker pool + // send an event to the worker pool err := cp.pool.Submit(func() { cp.processContainerPut(put) }) if err != nil { @@ -33,7 +33,7 @@ func (cp *Processor) handleDelete(ev event.Event) { zap.String("type", "container delete"), zap.String("id", base58.Encode(del.ContainerID()))) - // send event to the worker pool + // send an event to the worker pool err := cp.pool.Submit(func() { cp.processContainerDelete(&del) }) if err != nil { @@ -50,7 +50,7 @@ func (cp *Processor) handleSetEACL(ev event.Event) { zap.String("type", "set EACL"), ) - // send event to the worker pool + // send an event to the worker pool err := cp.pool.Submit(func() { cp.processSetEACL(e) diff --git a/pkg/innerring/processors/container/process_container.go b/pkg/innerring/processors/container/process_container.go index 91a3c7651a..345796a496 100644 --- a/pkg/innerring/processors/container/process_container.go +++ b/pkg/innerring/processors/container/process_container.go @@ -38,8 +38,8 @@ type putContainerContext struct { name, zone string // from container structure } -// Process new container from the user by checking container sanity -// and sending approve tx back to morph. +// Process a new container from the user by checking the container sanity +// and sending approve tx back to the morph. func (cp *Processor) processContainerPut(put putEvent) { if !cp.alphabetState.IsAlphabet() { cp.log.Info("non alphabet mode, ignore container put") diff --git a/pkg/innerring/processors/container/process_eacl.go b/pkg/innerring/processors/container/process_eacl.go index 11c86f98a7..f246f31fa8 100644 --- a/pkg/innerring/processors/container/process_eacl.go +++ b/pkg/innerring/processors/container/process_eacl.go @@ -78,7 +78,7 @@ func (cp *Processor) checkSetEACL(e container.SetEACL) error { } } - // statement below is a little hack, but if we write token from event to container, + // statement below is a little hack, but if we write a token from an event to the container, // checkKeyOwnership method will work just as it should: // * tok == nil => we will check if key is a container owner's key // * tok != nil => we will check if token was signed correctly (context is checked at the statement above) diff --git a/pkg/innerring/processors/container/processor.go b/pkg/innerring/processors/container/processor.go index 875fbebba0..cd03e202d1 100644 --- a/pkg/innerring/processors/container/processor.go +++ b/pkg/innerring/processors/container/processor.go @@ -20,7 +20,7 @@ type ( IsAlphabet() bool } - // Processor of events produced by container contract in morph chain. + // Processor of events produced by container contract in the sidechain. Processor struct { log *zap.Logger pool *ants.Pool @@ -48,7 +48,7 @@ type ( // NetworkState is an interface of a component // that provides access to network state. type NetworkState interface { - // Epoch must return number of the current epoch. + // Epoch must return the number of the current epoch. // // Must return any error encountered // which did not allow reading the value. @@ -62,7 +62,7 @@ const ( setEACLNotification = "setEACL" ) -// New creates container contract processor instance. +// New creates a container contract processor instance. func New(p *Params) (*Processor, error) { switch { case p.Log == nil: diff --git a/pkg/innerring/processors/governance/list.go b/pkg/innerring/processors/governance/list.go index c85a764c26..0f561deb10 100644 --- a/pkg/innerring/processors/governance/list.go +++ b/pkg/innerring/processors/governance/list.go @@ -14,11 +14,11 @@ var ( errEmptySidechain = errors.New("sidechain list is empty") ) -// newAlphabetList returns updated list of sidechain keys with no more than 1\3 -// of new keys from mainnet list. Function returns `errEmptySidechain` if -// sidechain list is empty. Function returns `errNotEnoughKeys` if mainnet -// list contains less keys than sidechain list. Function returns (nil, nil) if -// mainnet list contains all keys from sidechain list. +// newAlphabetList returns an updated list of sidechain keys with no more than 1\3 +// of new keys from the mainnet list. The function returns `errEmptySidechain` if +// the sidechain list is empty. The function returns `errNotEnoughKeys` if the mainnet +// list contains less keys than the sidechain list. The function returns (nil, nil) if +// the mainnet list contains all keys from the sidechain list. // // Sorts passed slices. func newAlphabetList(sidechain, mainnet keys.PublicKeys) (keys.PublicKeys, error) { @@ -84,8 +84,8 @@ func newAlphabetList(sidechain, mainnet keys.PublicKeys) (keys.PublicKeys, error } // updateInnerRing function removes `before` keys from `innerRing` and adds -// `after` keys in the list. If length of `before` and `after` is not the same -// then function returns errNotEqualLen +// `after` keys in the list. If the length of `before` and `after` is not the same, +// the function returns errNotEqualLen func updateInnerRing(innerRing, before, after keys.PublicKeys) (keys.PublicKeys, error) { lnBefore := len(before) if lnBefore != len(after) { diff --git a/pkg/innerring/processors/governance/process_update.go b/pkg/innerring/processors/governance/process_update.go index e3fce3f106..c6836ba385 100644 --- a/pkg/innerring/processors/governance/process_update.go +++ b/pkg/innerring/processors/governance/process_update.go @@ -60,14 +60,14 @@ func (gp *Processor) processAlphabetSync(txHash util.Uint256) { Hash: &txHash, } - // 1. Vote to side chain committee via alphabet contracts. + // 1. Vote to sidechain committee via alphabet contracts. err = gp.voter.VoteForSidechainValidator(votePrm) if err != nil { gp.log.Error("can't vote for side chain committee", zap.String("error", err.Error())) } - // 2. Update NeoFSAlphabet role in side chain. + // 2. Update NeoFSAlphabet role in the sidechain. innerRing, err := gp.irFetcher.InnerRingKeys() if err != nil { gp.log.Error("can't fetch inner ring list from side chain", @@ -109,7 +109,7 @@ func (gp *Processor) processAlphabetSync(txHash util.Uint256) { } if !gp.notaryDisabled { - // 3. Update notary role in side chain. + // 3. Update notary role in the sidechain. updPrm := client.UpdateNotaryListPrm{} @@ -123,7 +123,7 @@ func (gp *Processor) processAlphabetSync(txHash util.Uint256) { } } - // 4. Update NeoFS contract in main net. + // 4. Update NeoFS contract in the mainnet. epoch := gp.epochState.EpochCounter() buf := make([]byte, 8) diff --git a/pkg/innerring/processors/governance/processor.go b/pkg/innerring/processors/governance/processor.go index f61686e811..3ac382892b 100644 --- a/pkg/innerring/processors/governance/processor.go +++ b/pkg/innerring/processors/governance/processor.go @@ -16,9 +16,9 @@ import ( "go.uber.org/zap" ) -// ProcessorPoolSize limits pool size for governance Processor. Processor manages +// ProcessorPoolSize limits the pool size for governance Processor. Processor manages // governance sync tasks. This process must not be interrupted by other sync -// operation, so we limit pool size for processor to one. +// operation, so we limit the pool size for the processor to one. const ProcessorPoolSize = 1 type ( @@ -91,7 +91,7 @@ type ( } ) -// New creates balance contract processor instance. +// New creates a balance contract processor instance. func New(p *Params) (*Processor, error) { switch { case p.Log == nil: diff --git a/pkg/innerring/processors/neofs/process_assets.go b/pkg/innerring/processors/neofs/process_assets.go index 7e26c1a4f6..0684d5abfc 100644 --- a/pkg/innerring/processors/neofs/process_assets.go +++ b/pkg/innerring/processors/neofs/process_assets.go @@ -8,12 +8,12 @@ import ( ) const ( - // lockAccountLifeTime defines amount of epochs when lock account is valid. + // lockAccountLifeTime defines the amount of epochs when lock account is valid. lockAccountLifetime uint64 = 20 ) -// Process deposit event by invoking balance contract and sending native -// gas in morph chain. +// Process deposit event by invoking a balance contract and sending native +// gas in the sidechain. func (np *Processor) processDeposit(deposit *neofsEvent.Deposit) { if !np.alphabetState.IsAlphabet() { np.log.Info("non alphabet mode, ignore deposit") @@ -26,7 +26,7 @@ func (np *Processor) processDeposit(deposit *neofsEvent.Deposit) { prm.SetAmount(np.converter.ToBalancePrecision(deposit.Amount())) prm.SetID(deposit.ID()) - // send transferX to balance contract + // send transferX to a balance contract err := np.balanceClient.Mint(prm) if err != nil { np.log.Error("can't transfer assets to balance contract", zap.Error(err)) @@ -35,7 +35,7 @@ func (np *Processor) processDeposit(deposit *neofsEvent.Deposit) { curEpoch := np.epochState.EpochCounter() receiver := deposit.To() - // check if receiver already received some mint GAS emissions + // check if the receiver has already received some mint GAS emissions // we should lock there even though LRU cache is already thread save // we lock there because GAS transfer AND cache update must be atomic np.mintEmitLock.Lock() @@ -52,7 +52,7 @@ func (np *Processor) processDeposit(deposit *neofsEvent.Deposit) { } // get gas balance of the node - // before gas transfer check if the balance is greater than threshold + // before gas transfer check if the balance is greater than the threshold balance, err := np.morphClient.GasBalance() if err != nil { np.log.Error("can't get gas balance of the node", zap.Error(err)) @@ -78,7 +78,7 @@ func (np *Processor) processDeposit(deposit *neofsEvent.Deposit) { np.mintEmitCache.Add(receiver.String(), curEpoch) } -// Process withdraw event by locking assets in balance account. +// Process withdraw event by locking assets in the balance account. func (np *Processor) processWithdraw(withdraw *neofsEvent.Withdraw) { if !np.alphabetState.IsAlphabet() { np.log.Info("non alphabet mode, ignore withdraw") @@ -108,8 +108,8 @@ func (np *Processor) processWithdraw(withdraw *neofsEvent.Withdraw) { } } -// Process cheque event by transferring assets from lock account back to -// reserve account. +// Process cheque event by transferring assets from the lock account back to +// the reserve account. func (np *Processor) processCheque(cheque *neofsEvent.Cheque) { if !np.alphabetState.IsAlphabet() { np.log.Info("non alphabet mode, ignore cheque") diff --git a/pkg/innerring/processors/neofs/process_config.go b/pkg/innerring/processors/neofs/process_config.go index d39fb85899..d816853600 100644 --- a/pkg/innerring/processors/neofs/process_config.go +++ b/pkg/innerring/processors/neofs/process_config.go @@ -6,8 +6,8 @@ import ( "go.uber.org/zap" ) -// Process config event by setting configuration value from main chain in -// side chain. +// Process config event by setting configuration value from the mainchain in +// the sidechain. func (np *Processor) processConfig(config *neofsEvent.Config) { if !np.alphabetState.IsAlphabet() { np.log.Info("non alphabet mode, ignore config") diff --git a/pkg/innerring/processors/netmap/handlers.go b/pkg/innerring/processors/netmap/handlers.go index c2a1b50c46..fea72672ef 100644 --- a/pkg/innerring/processors/netmap/handlers.go +++ b/pkg/innerring/processors/netmap/handlers.go @@ -14,7 +14,7 @@ func (np *Processor) HandleNewEpochTick(ev event.Event) { _ = ev.(timerEvent.NewEpochTick) np.log.Info("tick", zap.String("type", "epoch")) - // send event to the worker pool + // send an event to the worker pool err := np.pool.Submit(func() { np.processNewEpochTick() }) if err != nil { @@ -30,7 +30,7 @@ func (np *Processor) handleNewEpoch(ev event.Event) { zap.String("type", "new epoch"), zap.Uint64("value", epochEvent.EpochNumber())) - // send event to the worker pool + // send an event to the worker pool err := np.pool.Submit(func() { np.processNewEpoch(epochEvent) @@ -49,7 +49,7 @@ func (np *Processor) handleAddPeer(ev event.Event) { zap.String("type", "add peer"), ) - // send event to the worker pool + // send an event to the worker pool err := np.pool.Submit(func() { np.processAddPeer(newPeer) diff --git a/pkg/innerring/processors/netmap/internal_events.go b/pkg/innerring/processors/netmap/internal_events.go index 17db375dbd..7ff6b40d57 100644 --- a/pkg/innerring/processors/netmap/internal_events.go +++ b/pkg/innerring/processors/netmap/internal_events.go @@ -6,17 +6,17 @@ import "github.com/nspcc-dev/neo-go/pkg/util" type netmapCleanupTick struct { epoch uint64 - // txHash is used in notary environmental + // txHash is used in notary environment // for calculating unique but same for // all notification receivers values. txHash util.Uint256 } -// TxHash returns hash of the TX that triggers +// TxHash returns the hash of the TX that triggers // synchronization process. func (s netmapCleanupTick) TxHash() util.Uint256 { return s.txHash } -// MorphEvent implements Event interface. +// MorphEvent implements the Event interface. func (netmapCleanupTick) MorphEvent() {} diff --git a/pkg/innerring/processors/netmap/nodevalidation/locode/calls.go b/pkg/innerring/processors/netmap/nodevalidation/locode/calls.go index 414592d452..1d386cc78c 100644 --- a/pkg/innerring/processors/netmap/nodevalidation/locode/calls.go +++ b/pkg/innerring/processors/netmap/nodevalidation/locode/calls.go @@ -14,13 +14,13 @@ var errMissingRequiredAttr = errors.New("missing required attribute in DB record // and adds a group of related attributes. // // If n contains at least one of the LOCODE-derived attributes, -// an error returns. +// an error is returned. // // If n contains UN-LOCODE attribute and its value does not -// match the UN/LOCODE format, an error returns. +// match the UN/LOCODE format, an error is returned. // // New attributes are formed from the record of DB instance (Prm). -// If DB entry R was found w/o errors, then new attributes are: +// If DB entry R was found w/o errors, new attributes are: // * CountryCode: R.CountryCode().String(); // * Country: R.CountryName(); // * Location: Record.LocationName(); @@ -32,7 +32,7 @@ var errMissingRequiredAttr = errors.New("missing required attribute in DB record func (v *Validator) VerifyAndUpdate(n *netmap.NodeInfo) error { mAttr := uniqueAttributes(n.Attributes()) - // check if derived attributes are presented + // check if the derived attributes are presented for attrKey := range v.mAttr { if _, ok := mAttr[attrKey]; ok { return fmt.Errorf("attribute derived from %s is presented: %s", diff --git a/pkg/innerring/processors/netmap/nodevalidation/locode/validator.go b/pkg/innerring/processors/netmap/nodevalidation/locode/validator.go index 2061686508..38e47c81a2 100644 --- a/pkg/innerring/processors/netmap/nodevalidation/locode/validator.go +++ b/pkg/innerring/processors/netmap/nodevalidation/locode/validator.go @@ -16,11 +16,11 @@ type Prm struct { DB DB } -// Validator is an utility that verifies and updates +// Validator is a utility that verifies and updates // node attributes associated with its geographical location // (LOCODE). // -// For correct operation, Validator must be created +// For correct operation, the Validator must be created // using the constructor (New) based on the required parameters // and optional components. After successful creation, // the Validator is immediately ready to work through API. diff --git a/pkg/innerring/processors/netmap/nodevalidation/maddress/validator.go b/pkg/innerring/processors/netmap/nodevalidation/maddress/validator.go index 8f0c0f7863..8c351f70a6 100644 --- a/pkg/innerring/processors/netmap/nodevalidation/maddress/validator.go +++ b/pkg/innerring/processors/netmap/nodevalidation/maddress/validator.go @@ -3,7 +3,7 @@ package maddress // Validator is an utility that verifies node // multiaddress. // -// For correct operation, Validator must be created +// For correct operation, the Validator must be created // using the constructor (New). After successful creation, // the Validator is immediately ready to work through API. type Validator struct{} diff --git a/pkg/innerring/processors/settlement/audit/calculate.go b/pkg/innerring/processors/settlement/audit/calculate.go index 486f5b5f3a..344d942a1e 100644 --- a/pkg/innerring/processors/settlement/audit/calculate.go +++ b/pkg/innerring/processors/settlement/audit/calculate.go @@ -17,7 +17,7 @@ import ( "go.uber.org/zap" ) -// CalculatePrm groups required parameters of +// CalculatePrm groups the required parameters of // Calculator.CalculateForEpoch call. type CalculatePrm struct { // Number of epoch to perform the calculation. diff --git a/pkg/innerring/processors/settlement/audit/calculator.go b/pkg/innerring/processors/settlement/audit/calculator.go index 69932ec6b1..f460798b58 100644 --- a/pkg/innerring/processors/settlement/audit/calculator.go +++ b/pkg/innerring/processors/settlement/audit/calculator.go @@ -5,7 +5,7 @@ import ( "go.uber.org/zap" ) -// Calculator represents component for calculating payments +// Calculator represents a component for calculating payments // based on data audit results and sending remittances to the chain. type Calculator struct { prm *CalculatorPrm @@ -26,7 +26,7 @@ func defaultOptions() *options { } } -// NewCalculator creates, initializes and returns new Calculator instance. +// NewCalculator creates, initializes and returns a new Calculator instance. func NewCalculator(p *CalculatorPrm, opts ...CalculatorOption) *Calculator { o := defaultOptions() @@ -40,7 +40,7 @@ func NewCalculator(p *CalculatorPrm, opts ...CalculatorOption) *Calculator { } } -// WithLogger returns option to specify logging component. +// WithLogger returns an option to specify the logging component. func WithLogger(l *logger.Logger) CalculatorOption { return func(o *options) { o.log = l diff --git a/pkg/innerring/processors/settlement/basic/collect.go b/pkg/innerring/processors/settlement/basic/collect.go index b9a946a058..562e38ad03 100644 --- a/pkg/innerring/processors/settlement/basic/collect.go +++ b/pkg/innerring/processors/settlement/basic/collect.go @@ -73,9 +73,9 @@ func (inc *IncomeSettlementContext) Collect() { common.TransferAssets(inc.exchange, txTable, common.BasicIncomeCollectionDetails(inc.epoch)) } -// avgEstimation returns estimation value for single container. Right now it -// simply calculates average of all announcements, however it can be smarter and -// base result on reputation of announcers and clever math. +// avgEstimation returns estimation value for a single container. Right now it +// simply calculates an average of all announcements, however it can be smarter and +// base the result on reputation of the announcers and clever math. func (inc *IncomeSettlementContext) avgEstimation(e *cntClient.Estimations) (avg uint64) { if len(e.Values) == 0 { return 0 diff --git a/pkg/innerring/processors/subnet/delete.go b/pkg/innerring/processors/subnet/delete.go index e27d68093e..1a2ac49a68 100644 --- a/pkg/innerring/processors/subnet/delete.go +++ b/pkg/innerring/processors/subnet/delete.go @@ -6,21 +6,21 @@ import ( subnetid "github.com/nspcc-dev/neofs-sdk-go/subnet/id" ) -// Delete represents notification about NeoFS subnet removal. +// Delete represents a notification about NeoFS subnet removal. // Generated by a contract when intending to delete a subnet. type Delete interface { - // Contains ID of the subnet to be removed. + // Contains the ID of the subnet to be removed. eventWithID } // DeleteValidator asserts intent to remove a subnet. type DeleteValidator struct{} -// Assert processes the attempt to remove a subnet. Approves the removal through nil return. +// Assert processes the attempt to remove a subnet. It approves the removal through nil return. // // All read errors of Delete are forwarded. // -// Returns an error on: +// It returns an error on: // * zero subnet creation; // * empty ID or different from the one wired into info; // * empty owner ID or different from the one wired into info. diff --git a/pkg/innerring/processors/subnet/put.go b/pkg/innerring/processors/subnet/put.go index 5676446dcf..bb109172be 100644 --- a/pkg/innerring/processors/subnet/put.go +++ b/pkg/innerring/processors/subnet/put.go @@ -9,34 +9,34 @@ import ( subnetid "github.com/nspcc-dev/neofs-sdk-go/subnet/id" ) -// Put represents notification about NeoFS subnet creation. +// Put represents a notification about NeoFS subnet creation. // Generated by a contract when intending to create a subnet. type Put interface { - // Contains ID of the subnet to be created. + // Contains the ID of the subnet to be created. eventWithID - // ReadCreator reads user ID of the subnet creator. - // Returns an error if ID is missing. + // ReadCreator reads the user ID of the subnet creator. + // Returns an error if the ID is missing. ReadCreator(id *owner.ID) error - // ReadInfo reads information about subnet to be created. + // ReadInfo reads information about a subnet to be created. ReadInfo(info *subnet.Info) error } // PutValidator asserts intent to create a subnet. type PutValidator struct{} -// errDiffOwner is returned when subnet owners differ. +// errDiffOwner is returned when the subnet owners differ. var errDiffOwner = errors.New("diff subnet owners") -// errDiffID is returned when subnet IDs differ. +// errDiffID is returned when the subnet IDs differ. var errDiffID = errors.New("diff subnet IDs") -// Assert processes the attempt to create a subnet. Approves the creation through nil return. +// Assert processes the attempt to create a subnet. It approves the creation through nil return. // // All read errors of Put are forwarded. // -// Returns an error on: +// It returns an error on: // * zero subnet creation; // * empty ID or different from the one wired into info; // * empty owner ID or different from the one wired into info. @@ -68,12 +68,12 @@ func (x PutValidator) Assert(event Put) error { return fmt.Errorf("read info: %w", err) } - // check if explicit ID equals to the one from info + // check if the explicit ID equals to the one from info if !subnet.IDEquals(info, id) { return errDiffID } - // check if explicit creator equals to the one from info + // check if the explicit creator equals to the one from info if !subnet.IsOwner(info, creator) { return errDiffOwner } diff --git a/pkg/innerring/state.go b/pkg/innerring/state.go index e079c68d1b..3b4c2551ce 100644 --- a/pkg/innerring/state.go +++ b/pkg/innerring/state.go @@ -139,13 +139,13 @@ func (s *Server) voteForSidechainValidator(prm governance.VoteValidatorPrm) erro } // VoteForSidechainValidator calls vote method on alphabet contracts with -// provided list of keys. +// the provided list of keys. func (s *Server) VoteForSidechainValidator(prm governance.VoteValidatorPrm) error { sort.Sort(prm.Validators) return s.voteForSidechainValidator(prm) } -// WriteReport composes audit result structure from audit report +// WriteReport composes the audit result structure from the audit report // and sends it to Audit contract. func (s *Server) WriteReport(r *audit.Report) error { res := r.Result() @@ -157,9 +157,9 @@ func (s *Server) WriteReport(r *audit.Report) error { return s.auditClient.PutAuditResult(prm) } -// ResetEpochTimer resets block timer that produces events to update epoch -// counter in netmap contract. Used to synchronize this even production -// based on block with notification of last epoch. +// ResetEpochTimer resets the block timer that produces events to update epoch +// counter in the netmap contract. It is used to synchronize this even production +// based on the block with a notification of the last epoch. func (s *Server) ResetEpochTimer(h uint32) error { s.epochTimer.Tick(h) return s.epochTimer.Reset() @@ -169,7 +169,7 @@ func (s *Server) setHealthStatus(hs control.HealthStatus) { s.healthStatus.Store(hs) } -// HealthStatus returns current health status of IR application. +// HealthStatus returns the current health status of the IR application. func (s *Server) HealthStatus() control.HealthStatus { return s.healthStatus.Load().(control.HealthStatus) } diff --git a/pkg/innerring/subnet.go b/pkg/innerring/subnet.go index 45c12b1959..cd0ddada06 100644 --- a/pkg/innerring/subnet.go +++ b/pkg/innerring/subnet.go @@ -36,8 +36,8 @@ type subnetConfig struct { queueSize uint32 } -// makes IR server to catch Subnet notifications from sidechain listener, -// and to release corresponding processing queue on stop. +// makes IR server to catch Subnet notifications from the sidechain listener, +// and to release the corresponding processing queue on stop. func (s *Server) initSubnet(cfg subnetConfig) { s.registerStarter(func() error { var err error @@ -92,11 +92,11 @@ const ( notarySubnetCreateEvName = "put" ) -// makes IR server to listen notifications of Subnet contract. +// makes the IR server to listen to notifications of Subnet contract. // All required resources must be initialized before (initSubnet). -// Works in one of two modes (configured): notary and non-notary. +// It works in one of two modes (configured): notary and non-notary. // -// All handlers are executed only if local node is an alphabet one. +// All handlers are executed only if the local node is an alphabet one. // // Events (notary): // * put (parser: subnetevents.ParseNotaryPut, handler: catchSubnetCreation); @@ -183,15 +183,15 @@ type putSubnetEvent struct { ev subnetevents.Put } -// ReadID unmarshals subnet ID from a binary NeoFS API protocol's format. +// ReadID unmarshals the subnet ID from a binary NeoFS API protocol's format. func (x putSubnetEvent) ReadID(id *subnetid.ID) error { return id.Unmarshal(x.ev.ID()) } var errMissingSubnetOwner = errors.New("missing subnet owner") -// ReadCreator unmarshals subnet creator from a binary NeoFS API protocol's format. -// Returns an error if byte array is empty. +// ReadCreator unmarshals the subnet creator from a binary NeoFS API protocol's format. +// Returns an error if the byte array is empty. func (x putSubnetEvent) ReadCreator(id *owner.ID) error { data := x.ev.Owner() @@ -210,12 +210,12 @@ func (x putSubnetEvent) ReadCreator(id *owner.ID) error { return nil } -// ReadInfo unmarshal subnet info from a binary NeoFS API protocol's format. +// ReadInfo unmarshal the subnet info from a binary NeoFS API protocol's format. func (x putSubnetEvent) ReadInfo(info *subnet.Info) error { return info.Unmarshal(x.ev.Info()) } -// handleSubnetCreation handles event of subnet creation parsed via subnetevents.ParsePut. +// handleSubnetCreation handles an event of subnet creation parsed via subnetevents.ParsePut. // // Validates the event using irsubnet.PutValidator. Logs message about (dis)agreement. func (s *Server) handleSubnetCreation(e event.Event) { @@ -260,7 +260,7 @@ func (s *Server) handleSubnetCreation(e event.Event) { } } -// catchSubnetRemoval catches event of subnet removal from listener and queues the processing. +// catchSubnetRemoval catches an event of subnet removal from listener and queues the processing. func (s *Server) catchSubnetRemoval(e event.Event) { err := s.subnetHandler.workerPool.Submit(func() { s.handleSubnetRemoval(e) diff --git a/pkg/local_object_storage/blobovnicza/blobovnicza.go b/pkg/local_object_storage/blobovnicza/blobovnicza.go index dd8dbbba51..e89e1b30b8 100644 --- a/pkg/local_object_storage/blobovnicza/blobovnicza.go +++ b/pkg/local_object_storage/blobovnicza/blobovnicza.go @@ -55,7 +55,7 @@ func defaultCfg() *cfg { } } -// New creates and returns new Blobovnicza instance. +// New creates and returns a new Blobovnicza instance. func New(opts ...Option) *Blobovnicza { c := defaultCfg() @@ -76,7 +76,7 @@ func WithPath(path string) Option { } } -// WithPermissions returns option to specify permission bits +// WithPermissions returns an option to specify permission bits // of Blobovnicza's system path. func WithPermissions(perm fs.FileMode) Option { return func(c *cfg) { @@ -84,7 +84,7 @@ func WithPermissions(perm fs.FileMode) Option { } } -// WithObjectSizeLimit returns option to specify maximum size +// WithObjectSizeLimit returns an option to specify the maximum size // of the objects stored in Blobovnicza. func WithObjectSizeLimit(lim uint64) Option { return func(c *cfg) { @@ -92,7 +92,7 @@ func WithObjectSizeLimit(lim uint64) Option { } } -// WithFullSizeLimit returns option to set maximum sum size +// WithFullSizeLimit returns an option to set the maximum sum size // of all stored objects. func WithFullSizeLimit(lim uint64) Option { return func(c *cfg) { @@ -100,14 +100,14 @@ func WithFullSizeLimit(lim uint64) Option { } } -// WithLogger returns option to specify Blobovnicza's logger. +// WithLogger returns an option to specify Blobovnicza's logger. func WithLogger(l *logger.Logger) Option { return func(c *cfg) { c.log = l.With(zap.String("component", "Blobovnicza")) } } -// ReadOnly returns option to open Blobovnicza in read-only mode. +// ReadOnly returns an option to open Blobovnicza in read-only mode. func ReadOnly() Option { return func(c *cfg) { c.boltOptions.ReadOnly = true diff --git a/pkg/local_object_storage/blobovnicza/control.go b/pkg/local_object_storage/blobovnicza/control.go index 759325f1cd..51e872e221 100644 --- a/pkg/local_object_storage/blobovnicza/control.go +++ b/pkg/local_object_storage/blobovnicza/control.go @@ -9,9 +9,9 @@ import ( "go.uber.org/zap" ) -// Open opens an internal database at configured path with configured permissions. +// Open opens an internal database at the configured path with the configured permissions. // -// If the database file does not exist then it will be created automatically. +// If the database file does not exist, it will be created automatically. func (b *Blobovnicza) Open() error { b.log.Debug("creating directory for BoltDB", zap.String("path", b.path), @@ -39,7 +39,7 @@ func (b *Blobovnicza) Open() error { // Init initializes internal database structure. // -// If Blobovnicza is already initialized, then no action is taken. +// If Blobovnicza is already initialized, no action is taken. // // Should not be called in read-only configuration. func (b *Blobovnicza) Init() error { diff --git a/pkg/local_object_storage/blobovnicza/delete.go b/pkg/local_object_storage/blobovnicza/delete.go index 3dd4cde7cb..9a4dbe9299 100644 --- a/pkg/local_object_storage/blobovnicza/delete.go +++ b/pkg/local_object_storage/blobovnicza/delete.go @@ -12,16 +12,16 @@ type DeletePrm struct { addr *addressSDK.Address } -// DeleteRes groups resulting values of Delete operation. +// DeleteRes groups the resulting values of Delete operation. type DeleteRes struct { } -// SetAddress sets address of the requested object. +// SetAddress sets the address of the requested object. func (p *DeletePrm) SetAddress(addr *addressSDK.Address) { p.addr = addr } -// Delete removes object from Blobovnicza by address. +// Delete removes an object from Blobovnicza by address. // // Returns any error encountered that // did not allow to completely delete the object. diff --git a/pkg/local_object_storage/blobovnicza/errors.go b/pkg/local_object_storage/blobovnicza/errors.go index 1d749b268a..58a01e551f 100644 --- a/pkg/local_object_storage/blobovnicza/errors.go +++ b/pkg/local_object_storage/blobovnicza/errors.go @@ -6,8 +6,8 @@ import ( apistatus "github.com/nspcc-dev/neofs-sdk-go/client/status" ) -// IsErrNotFound checks if error returned by Blobovnicza Get/Delete method -// corresponds to missing object. +// IsErrNotFound checks if the error returned by Blobovnicza Get/Delete method +// corresponds to the missing object. func IsErrNotFound(err error) bool { return errors.As(err, new(apistatus.ObjectNotFound)) } diff --git a/pkg/local_object_storage/blobovnicza/get.go b/pkg/local_object_storage/blobovnicza/get.go index d15dd5598f..e7e7577768 100644 --- a/pkg/local_object_storage/blobovnicza/get.go +++ b/pkg/local_object_storage/blobovnicza/get.go @@ -13,12 +13,12 @@ type GetPrm struct { addr *addressSDK.Address } -// GetRes groups resulting values of Get operation. +// GetRes groups the resulting values of Get operation. type GetRes struct { obj []byte } -// SetAddress sets address of the requested object. +// SetAddress sets the address of the requested object. func (p *GetPrm) SetAddress(addr *addressSDK.Address) { p.addr = addr } @@ -28,12 +28,12 @@ func (p *GetRes) Object() []byte { return p.obj } -// Get reads the object from Blobovnicza by address. +// Get reads an object from Blobovnicza by address. // // Returns any error encountered that // did not allow to completely read the object. // -// Returns an error of type apistatus.ObjectNotFound if requested object is not +// Returns an error of type apistatus.ObjectNotFound if the requested object is not // presented in Blobovnicza. func (b *Blobovnicza) Get(prm *GetPrm) (*GetRes, error) { var ( diff --git a/pkg/local_object_storage/blobovnicza/id.go b/pkg/local_object_storage/blobovnicza/id.go index b3cd78af0b..79c30a2102 100644 --- a/pkg/local_object_storage/blobovnicza/id.go +++ b/pkg/local_object_storage/blobovnicza/id.go @@ -3,7 +3,7 @@ package blobovnicza // ID represents Blobovnicza identifier. type ID []byte -// NewIDFromBytes constructs ID from byte slice. +// NewIDFromBytes constructs an ID from a byte slice. func NewIDFromBytes(v []byte) *ID { return (*ID)(&v) } diff --git a/pkg/local_object_storage/blobovnicza/iterate.go b/pkg/local_object_storage/blobovnicza/iterate.go index e50705b640..79b3771d2e 100644 --- a/pkg/local_object_storage/blobovnicza/iterate.go +++ b/pkg/local_object_storage/blobovnicza/iterate.go @@ -106,7 +106,7 @@ func (x *IteratePrm) IgnoreErrors() { x.ignoreErrors = true } -// IterateRes groups resulting values of Iterate operation. +// IterateRes groups the resulting values of Iterate operation. type IterateRes struct { } diff --git a/pkg/local_object_storage/blobovnicza/put.go b/pkg/local_object_storage/blobovnicza/put.go index 30a3c7bd66..3a001bc4c6 100644 --- a/pkg/local_object_storage/blobovnicza/put.go +++ b/pkg/local_object_storage/blobovnicza/put.go @@ -15,17 +15,17 @@ type PutPrm struct { objData []byte } -// PutRes groups resulting values of Put operation. +// PutRes groups the resulting values of Put operation. type PutRes struct { } -// ErrFull is returned returned when trying to save an +// ErrFull is returned when trying to save an // object to a filled blobovnicza. var ErrFull = errors.New("blobovnicza is full") var errNilAddress = errors.New("object address is nil") -// SetAddress sets address of saving object. +// SetAddress sets the address of the saving object. func (p *PutPrm) SetAddress(addr *addressSDK.Address) { p.addr = addr } @@ -35,7 +35,7 @@ func (p *PutPrm) SetMarshaledObject(data []byte) { p.objData = data } -// Put saves object in Blobovnicza. +// Put saves an object in Blobovnicza. // // If binary representation of the object is not set, // it is calculated via Marshal method. diff --git a/pkg/local_object_storage/blobstor/blobovnicza.go b/pkg/local_object_storage/blobstor/blobovnicza.go index 94f5610ea7..b09d50ff5a 100644 --- a/pkg/local_object_storage/blobstor/blobovnicza.go +++ b/pkg/local_object_storage/blobstor/blobovnicza.go @@ -19,7 +19,7 @@ import ( "go.uber.org/zap" ) -// represents storage of the "small" objects. +// represents the storage of the "small" objects. // // Each object is stored in Blobovnicza's (B-s). // B-s are structured in a multilevel directory hierarchy @@ -44,7 +44,7 @@ import ( // Elements of the deepest level are B-s. // B-s are allocated dynamically. At each moment of the time there is // an active B (ex. A), set of already filled B-s (ex. F) and -// list of not yet initialized B-s (ex. X). After filling the active B +// a list of not yet initialized B-s (ex. X). After filling the active B // it becomes full, and next B becomes initialized and active. // // Active B and some of the full B-s are cached (LRU). All cached diff --git a/pkg/local_object_storage/blobstor/control.go b/pkg/local_object_storage/blobstor/control.go index c046fba4c7..151e356002 100644 --- a/pkg/local_object_storage/blobstor/control.go +++ b/pkg/local_object_storage/blobstor/control.go @@ -9,7 +9,7 @@ func (b *BlobStor) Open() error { // Init initializes internal data structures and system resources. // -// If BlobStor is already initialized, then no action is taken. +// If BlobStor is already initialized, no action is taken. func (b *BlobStor) Init() error { b.log.Debug("initializing...") diff --git a/pkg/local_object_storage/blobstor/delete_big.go b/pkg/local_object_storage/blobstor/delete_big.go index b3b500d366..3532d70b43 100644 --- a/pkg/local_object_storage/blobstor/delete_big.go +++ b/pkg/local_object_storage/blobstor/delete_big.go @@ -13,10 +13,10 @@ type DeleteBigPrm struct { address } -// DeleteBigRes groups resulting values of DeleteBig operation. +// DeleteBigRes groups the resulting values of DeleteBig operation. type DeleteBigRes struct{} -// DeleteBig removes object from shallow dir of BLOB storage. +// DeleteBig removes an object from shallow dir of BLOB storage. // // Returns any error encountered that did not allow // to completely remove the object. diff --git a/pkg/local_object_storage/blobstor/delete_small.go b/pkg/local_object_storage/blobstor/delete_small.go index 7de368a7a0..e98e85f89e 100644 --- a/pkg/local_object_storage/blobstor/delete_small.go +++ b/pkg/local_object_storage/blobstor/delete_small.go @@ -6,10 +6,10 @@ type DeleteSmallPrm struct { rwBlobovniczaID } -// DeleteSmallRes groups resulting values of DeleteSmall operation. +// DeleteSmallRes groups the resulting values of DeleteSmall operation. type DeleteSmallRes struct{} -// DeleteSmall removes object from blobovnicza of BLOB storage. +// DeleteSmall removes an object from blobovnicza of BLOB storage. // // If blobovnicza ID is not set or set to nil, BlobStor tries to // find and remove object from any blobovnicza. diff --git a/pkg/local_object_storage/blobstor/exists.go b/pkg/local_object_storage/blobstor/exists.go index 79f95e6f37..7496bcaad5 100644 --- a/pkg/local_object_storage/blobstor/exists.go +++ b/pkg/local_object_storage/blobstor/exists.go @@ -15,7 +15,7 @@ type ExistsPrm struct { address } -// ExistsRes groups resulting values of Exists operation. +// ExistsRes groups the resulting values of Exists operation. type ExistsRes struct { exists bool } @@ -25,7 +25,7 @@ func (r ExistsRes) Exists() bool { return r.exists } -// Exists checks if object is presented in BLOB storage. +// Exists checks if the object is presented in BLOB storage. // // Returns any error encountered that did not allow // to completely check object existence. diff --git a/pkg/local_object_storage/blobstor/fstree/fstree.go b/pkg/local_object_storage/blobstor/fstree/fstree.go index 062373b6d0..e4f8dccffc 100644 --- a/pkg/local_object_storage/blobstor/fstree/fstree.go +++ b/pkg/local_object_storage/blobstor/fstree/fstree.go @@ -15,7 +15,7 @@ import ( oidSDK "github.com/nspcc-dev/neofs-sdk-go/object/id" ) -// FSTree represents object storage as filesystem tree. +// FSTree represents an object storage as a filesystem tree. type FSTree struct { Info @@ -160,7 +160,7 @@ func (t *FSTree) treePath(addr *addressSDK.Address) string { return filepath.Join(dirs...) } -// Delete removes object with the specified address from storage. +// Delete removes the object with the specified address from the storage. func (t *FSTree) Delete(addr *addressSDK.Address) error { p, err := t.Exists(addr) if err != nil { @@ -170,7 +170,7 @@ func (t *FSTree) Delete(addr *addressSDK.Address) error { return os.Remove(p) } -// Exists returns path to file with object contents if it exists in storage +// Exists returns the path to the file with object contents if it exists in the storage // and an error otherwise. func (t *FSTree) Exists(addr *addressSDK.Address) (string, error) { p := t.treePath(addr) @@ -183,7 +183,7 @@ func (t *FSTree) Exists(addr *addressSDK.Address) (string, error) { return p, err } -// Put puts object in storage. +// Put puts an object in the storage. func (t *FSTree) Put(addr *addressSDK.Address, data []byte) error { p := t.treePath(addr) @@ -211,7 +211,7 @@ func (t *FSTree) PutStream(addr *addressSDK.Address, handler func(*os.File) erro return handler(f) } -// Get returns object from storage by address. +// Get returns an object from the storage by address. func (t *FSTree) Get(addr *addressSDK.Address) ([]byte, error) { p := t.treePath(addr) diff --git a/pkg/local_object_storage/blobstor/get_big.go b/pkg/local_object_storage/blobstor/get_big.go index 450879d6f7..55767b9743 100644 --- a/pkg/local_object_storage/blobstor/get_big.go +++ b/pkg/local_object_storage/blobstor/get_big.go @@ -14,7 +14,7 @@ type GetBigPrm struct { address } -// GetBigRes groups resulting values of GetBig operation. +// GetBigRes groups the resulting values of GetBig operation. type GetBigRes struct { roObject } @@ -24,7 +24,7 @@ type GetBigRes struct { // Returns any error encountered that // did not allow to completely read the object. // -// Returns an error of type apistatus.ObjectNotFound if requested object is not +// Returns an error of type apistatus.ObjectNotFound if the requested object is not // presented in shallow dir. func (b *BlobStor) GetBig(prm *GetBigPrm) (*GetBigRes, error) { // get compressed object data diff --git a/pkg/local_object_storage/blobstor/get_range_big.go b/pkg/local_object_storage/blobstor/get_range_big.go index 236b41cfb1..9adddacda5 100644 --- a/pkg/local_object_storage/blobstor/get_range_big.go +++ b/pkg/local_object_storage/blobstor/get_range_big.go @@ -16,7 +16,7 @@ type GetRangeBigPrm struct { rwRange } -// GetRangeBigRes groups resulting values of GetRangeBig operation. +// GetRangeBigRes groups the resulting values of GetRangeBig operation. type GetRangeBigRes struct { rangeData } @@ -26,7 +26,7 @@ type GetRangeBigRes struct { // Returns any error encountered that // did not allow to completely read the object payload range. // -// Returns ErrRangeOutOfBounds if requested object range is out of bounds. +// Returns ErrRangeOutOfBounds if the requested object range is out of bounds. // Returns an error of type apistatus.ObjectNotFound if object is missing. func (b *BlobStor) GetRangeBig(prm *GetRangeBigPrm) (*GetRangeBigRes, error) { // get compressed object data diff --git a/pkg/local_object_storage/blobstor/get_range_small.go b/pkg/local_object_storage/blobstor/get_range_small.go index 1b4eb1e3c5..94220fb2f9 100644 --- a/pkg/local_object_storage/blobstor/get_range_small.go +++ b/pkg/local_object_storage/blobstor/get_range_small.go @@ -7,7 +7,7 @@ type GetRangeSmallPrm struct { rwBlobovniczaID } -// GetRangeSmallRes groups resulting values of GetRangeSmall operation. +// GetRangeSmallRes groups the resulting values of GetRangeSmall operation. type GetRangeSmallRes struct { rangeData } @@ -20,8 +20,8 @@ type GetRangeSmallRes struct { // Returns any error encountered that // did not allow to completely read the object payload range. // -// Returns ErrRangeOutOfBounds if requested object range is out of bounds. -// Returns an error of type apistatus.ObjectNotFound if requested object is missing in blobovnicza(s). +// Returns ErrRangeOutOfBounds if the requested object range is out of bounds. +// Returns an error of type apistatus.ObjectNotFound if the requested object is missing in blobovnicza(s). func (b *BlobStor) GetRangeSmall(prm *GetRangeSmallPrm) (*GetRangeSmallRes, error) { return b.blobovniczas.getRange(prm) } diff --git a/pkg/local_object_storage/blobstor/get_small.go b/pkg/local_object_storage/blobstor/get_small.go index f906992afa..231d022990 100644 --- a/pkg/local_object_storage/blobstor/get_small.go +++ b/pkg/local_object_storage/blobstor/get_small.go @@ -6,20 +6,20 @@ type GetSmallPrm struct { rwBlobovniczaID } -// GetSmallRes groups resulting values of GetSmall operation. +// GetSmallRes groups the resulting values of GetSmall operation. type GetSmallRes struct { roObject } // GetSmall reads the object from blobovnicza of BLOB storage by address. // -// If blobovnicza ID is not set or set to nil, BlobStor tries to get object +// If blobovnicza ID is not set or set to nil, BlobStor tries to get the object // from any blobovnicza. // // Returns any error encountered that // did not allow to completely read the object. // -// Returns an error of type apistatus.ObjectNotFound if requested object is missing in blobovnicza(s). +// Returns an error of type apistatus.ObjectNotFound if the requested object is missing in blobovnicza(s). func (b *BlobStor) GetSmall(prm *GetSmallPrm) (*GetSmallRes, error) { return b.blobovniczas.get(prm) } diff --git a/pkg/local_object_storage/blobstor/iterate.go b/pkg/local_object_storage/blobstor/iterate.go index b28806e046..134fafc287 100644 --- a/pkg/local_object_storage/blobstor/iterate.go +++ b/pkg/local_object_storage/blobstor/iterate.go @@ -16,13 +16,13 @@ type IterationElement struct { blzID *blobovnicza.ID } -// ObjectData returns stored object in a binary representation. +// ObjectData returns the stored object in a binary representation. func (x IterationElement) ObjectData() []byte { return x.data } -// BlobovniczaID returns identifier of Blobovnicza in which object is stored. -// Returns nil if object isn't in Blobovnicza. +// BlobovniczaID returns the identifier of Blobovnicza in which object is stored. +// Returns nil if the object isn't in Blobovnicza. func (x IterationElement) BlobovniczaID() *blobovnicza.ID { return x.blzID } @@ -36,7 +36,7 @@ type IteratePrm struct { ignoreErrors bool } -// IterateRes groups resulting values of Iterate operation. +// IterateRes groups the resulting values of Iterate operation. type IterateRes struct{} // SetIterationHandler sets the action to be performed on each iteration. diff --git a/pkg/local_object_storage/blobstor/put.go b/pkg/local_object_storage/blobstor/put.go index 86fcdad50d..a7c9e6fa11 100644 --- a/pkg/local_object_storage/blobstor/put.go +++ b/pkg/local_object_storage/blobstor/put.go @@ -17,7 +17,7 @@ type PutPrm struct { rwObject } -// PutRes groups resulting values of Put operation. +// PutRes groups the resulting values of Put operation. type PutRes struct { roBlobovniczaID } @@ -40,8 +40,8 @@ func (b *BlobStor) Put(prm *PutPrm) (*PutRes, error) { return b.PutRaw(object.AddressOf(prm.obj), data, b.NeedsCompression(prm.obj)) } -// NeedsCompression returns true if object should be compressed. -// For object to be compressed 2 conditions must hold: +// NeedsCompression returns true if the object should be compressed. +// For an object to be compressed 2 conditions must hold: // 1. Compression is enabled in settings. // 2. Object MIME Content-Type is allowed for compression. func (b *BlobStor) NeedsCompression(obj *objectSDK.Object) bool { @@ -71,7 +71,7 @@ func (b *BlobStor) NeedsCompression(obj *objectSDK.Object) bool { return b.compressionEnabled } -// PutRaw saves already marshaled object in BLOB storage. +// PutRaw saves an already marshaled object in BLOB storage. func (b *BlobStor) PutRaw(addr *addressSDK.Address, data []byte, compress bool) (*PutRes, error) { big := b.isBig(data) diff --git a/pkg/local_object_storage/engine/container.go b/pkg/local_object_storage/engine/container.go index d2ac4c4808..43da38af05 100644 --- a/pkg/local_object_storage/engine/container.go +++ b/pkg/local_object_storage/engine/container.go @@ -19,12 +19,12 @@ type ContainerSizeRes struct { // ListContainersPrm groups parameters of ListContainers operation. type ListContainersPrm struct{} -// ListContainersRes groups resulting values of ListContainers operation. +// ListContainersRes groups the resulting values of ListContainers operation. type ListContainersRes struct { containers []*cid.ID } -// SetContainerID sets identifier of the container to estimate the size. +// SetContainerID sets the identifier of the container to estimate the size. func (p *ContainerSizePrm) SetContainerID(cid *cid.ID) { p.cid = cid } @@ -34,12 +34,12 @@ func (r ContainerSizeRes) Size() uint64 { return r.size } -// Containers returns list of identifiers of the containers in which local objects are stored. +// Containers returns a list of identifiers of the containers in which local objects are stored. func (r ListContainersRes) Containers() []*cid.ID { return r.containers } -// ContainerSize returns sum of estimation container sizes among all shards. +// ContainerSize returns the sum of estimation container sizes among all shards. // // Returns an error if executions are blocked (see BlockExecution). func (e *StorageEngine) ContainerSize(prm ContainerSizePrm) (res *ContainerSizeRes, err error) { @@ -88,7 +88,7 @@ func (e *StorageEngine) containerSize(prm ContainerSizePrm) (*ContainerSizeRes, return &res, nil } -// ListContainers returns unique container IDs presented in the engine objects. +// ListContainers returns a unique container IDs presented in the engine objects. // // Returns an error if executions are blocked (see BlockExecution). func (e *StorageEngine) ListContainers(_ ListContainersPrm) (res *ListContainersRes, err error) { @@ -100,7 +100,7 @@ func (e *StorageEngine) ListContainers(_ ListContainersPrm) (res *ListContainers return } -// ListContainers calls ListContainers method on engine to get unique container IDs presented in the engine objects. +// ListContainers calls ListContainers method on engine to get a unique container IDs presented in the engine objects. func ListContainers(e *StorageEngine) ([]*cid.ID, error) { var prm ListContainersPrm diff --git a/pkg/local_object_storage/engine/delete.go b/pkg/local_object_storage/engine/delete.go index f3b1dcba4a..cafd528f73 100644 --- a/pkg/local_object_storage/engine/delete.go +++ b/pkg/local_object_storage/engine/delete.go @@ -13,7 +13,7 @@ type DeletePrm struct { addr []*addressSDK.Address } -// DeleteRes groups resulting values of Delete operation. +// DeleteRes groups the resulting values of Delete operation. type DeleteRes struct{} // WithAddresses is a Delete option to set the addresses of the objects to delete. diff --git a/pkg/local_object_storage/engine/engine.go b/pkg/local_object_storage/engine/engine.go index f40f158c5b..19b877ce66 100644 --- a/pkg/local_object_storage/engine/engine.go +++ b/pkg/local_object_storage/engine/engine.go @@ -32,7 +32,7 @@ type shardWrapper struct { *shard.Shard } -// reportShardError checks that amount of errors doesn't exceed configured threshold. +// reportShardError checks that the amount of errors doesn't exceed the configured threshold. // If it does, shard is set to read-only mode. func (e *StorageEngine) reportShardError( sh hashedShard, diff --git a/pkg/local_object_storage/engine/get.go b/pkg/local_object_storage/engine/get.go index 3e0b13390f..adfa8d94c2 100644 --- a/pkg/local_object_storage/engine/get.go +++ b/pkg/local_object_storage/engine/get.go @@ -16,7 +16,7 @@ type GetPrm struct { addr *addressSDK.Address } -// GetRes groups resulting values of Get operation. +// GetRes groups the resulting values of Get operation. type GetRes struct { obj *objectSDK.Object } @@ -42,8 +42,8 @@ func (r *GetRes) Object() *objectSDK.Object { // Returns any error encountered that // did not allow to completely read the object part. // -// Returns an error of type apistatus.ObjectNotFound if requested object is missing in local storage. -// Returns an error of type apistatus.ObjectAlreadyRemoved if object has been marked as removed. +// Returns an error of type apistatus.ObjectNotFound if the requested object is missing in local storage. +// Returns an error of type apistatus.ObjectAlreadyRemoved if the object has been marked as removed. // // Returns an error if executions are blocked (see BlockExecution). func (e *StorageEngine) Get(prm *GetPrm) (res *GetRes, err error) { diff --git a/pkg/local_object_storage/engine/head.go b/pkg/local_object_storage/engine/head.go index 0a91a5ae8b..4adc1801ae 100644 --- a/pkg/local_object_storage/engine/head.go +++ b/pkg/local_object_storage/engine/head.go @@ -16,7 +16,7 @@ type HeadPrm struct { raw bool } -// HeadRes groups resulting values of Head operation. +// HeadRes groups the resulting values of Head operation. type HeadRes struct { head *objectSDK.Object } @@ -33,7 +33,7 @@ func (p *HeadPrm) WithAddress(addr *addressSDK.Address) *HeadPrm { } // WithRaw is a Head option to set raw flag value. If flag is unset, then Head -// returns header of virtual object, otherwise it returns SplitInfo of virtual +// returns the header of the virtual object, otherwise it returns SplitInfo of the virtual // object. func (p *HeadPrm) WithRaw(raw bool) *HeadPrm { if p != nil { @@ -55,8 +55,8 @@ func (r *HeadRes) Header() *objectSDK.Object { // Returns any error encountered that // did not allow to completely read the object header. // -// Returns an error of type apistatus.ObjectNotFound if requested object is missing in local storage. -// Returns an error of type apistatus.ObjectAlreadyRemoved if requested object was inhumed. +// Returns an error of type apistatus.ObjectNotFound if the requested object is missing in local storage. +// Returns an error of type apistatus.ObjectAlreadyRemoved if the requested object was inhumed. // // Returns an error if executions are blocked (see BlockExecution). func (e *StorageEngine) Head(prm *HeadPrm) (res *HeadRes, err error) { diff --git a/pkg/local_object_storage/engine/inhume.go b/pkg/local_object_storage/engine/inhume.go index c42e83c0dc..bab202e98a 100644 --- a/pkg/local_object_storage/engine/inhume.go +++ b/pkg/local_object_storage/engine/inhume.go @@ -20,7 +20,7 @@ type InhumePrm struct { // InhumeRes encapsulates results of inhume operation. type InhumeRes struct{} -// WithTarget sets list of objects that should be inhumed and tombstone address +// WithTarget sets a list of objects that should be inhumed and tombstone address // as the reason for inhume operation. // // tombstone should not be nil, addr should not be empty. @@ -34,7 +34,7 @@ func (p *InhumePrm) WithTarget(tombstone *addressSDK.Address, addrs ...*addressS return p } -// MarkAsGarbage marks object to be physically removed from local storage. +// MarkAsGarbage marks an object to be physically removed from local storage. // // Should not be called along with WithTarget. func (p *InhumePrm) MarkAsGarbage(addrs ...*addressSDK.Address) *InhumePrm { @@ -48,8 +48,8 @@ func (p *InhumePrm) MarkAsGarbage(addrs ...*addressSDK.Address) *InhumePrm { var errInhumeFailure = errors.New("inhume operation failed") -// Inhume calls metabase. Inhume method to mark object as removed. It won't be -// removed physically from shard until `Delete` operation. +// Inhume calls metabase. Inhume method to mark an object as removed. It won't be +// removed physically from the shard until `Delete` operation. // // Allows inhuming non-locked objects only. Returns apistatus.ObjectLocked // if at least one object is locked. diff --git a/pkg/local_object_storage/engine/list.go b/pkg/local_object_storage/engine/list.go index 5966a887ee..9bdcbcf5ed 100644 --- a/pkg/local_object_storage/engine/list.go +++ b/pkg/local_object_storage/engine/list.go @@ -7,8 +7,8 @@ import ( addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address" ) -// ErrEndOfListing is returned from object listing with cursor -// when storage can't return any more objects after provided +// ErrEndOfListing is returned from an object listing with cursor +// when the storage can't return any more objects after the provided // cursor. Use nil cursor object to start listing again. var ErrEndOfListing = shard.ErrEndOfListing @@ -24,14 +24,14 @@ type ListWithCursorPrm struct { cursor *Cursor } -// WithCount sets maximum amount of addresses that ListWithCursor should return. +// WithCount sets the maximum amount of addresses that ListWithCursor should return. func (p *ListWithCursorPrm) WithCount(count uint32) *ListWithCursorPrm { p.count = count return p } -// WithCursor sets cursor for ListWithCursor operation. For initial request -// ignore this param or use nil value. For consecutive requests, use value +// WithCursor sets a cursor for ListWithCursor operation. For initial request +// ignore this param or use nil value. For consecutive requests, use value // from ListWithCursorRes. func (p *ListWithCursorPrm) WithCursor(cursor *Cursor) *ListWithCursorPrm { p.cursor = cursor @@ -54,9 +54,9 @@ func (l ListWithCursorRes) Cursor() *Cursor { return l.cursor } -// ListWithCursor lists physical objects available in engine starting -// from cursor. Includes regular,tombstone and storage group objects. -// Does not include inhumed objects. Use cursor value from response +// ListWithCursor lists physical objects available in the engine starting +// from the cursor. It includes regular, tombstone and storage group objects. +// Does not include inhumed objects. Use cursor value from the response // for consecutive requests. // // Returns ErrEndOfListing if there are no more objects to return or count diff --git a/pkg/local_object_storage/engine/put.go b/pkg/local_object_storage/engine/put.go index ef6a01f2af..daf6ec7b79 100644 --- a/pkg/local_object_storage/engine/put.go +++ b/pkg/local_object_storage/engine/put.go @@ -14,7 +14,7 @@ type PutPrm struct { obj *objectSDK.Object } -// PutRes groups resulting values of Put operation. +// PutRes groups the resulting values of Put operation. type PutRes struct{} var errPutShard = errors.New("could not put object to any shard") @@ -37,7 +37,7 @@ func (p *PutPrm) WithObject(obj *objectSDK.Object) *PutPrm { // // Returns an error if executions are blocked (see BlockExecution). // -// Returns an error of type apistatus.ObjectAlreadyRemoved if object has been marked as removed. +// Returns an error of type apistatus.ObjectAlreadyRemoved if the object has been marked as removed. func (e *StorageEngine) Put(prm *PutPrm) (res *PutRes, err error) { err = e.execIfNotBlocked(func() error { res, err = e.put(prm) diff --git a/pkg/local_object_storage/engine/range.go b/pkg/local_object_storage/engine/range.go index 992015b464..982b2a2bc4 100644 --- a/pkg/local_object_storage/engine/range.go +++ b/pkg/local_object_storage/engine/range.go @@ -19,7 +19,7 @@ type RngPrm struct { addr *addressSDK.Address } -// RngRes groups resulting values of GetRange operation. +// RngRes groups the resulting values of GetRange operation. type RngRes struct { obj *objectSDK.Object } @@ -59,9 +59,9 @@ func (r *RngRes) Object() *objectSDK.Object { // Returns any error encountered that // did not allow to completely read the object part. // -// Returns an error of type apistatus.ObjectNotFound if requested object is missing in local storage. -// Returns an error of type apistatus.ObjectAlreadyRemoved if requested object is inhumed. -// Returns ErrRangeOutOfBounds if requested object range is out of bounds. +// Returns an error of type apistatus.ObjectNotFound if the requested object is missing in local storage. +// Returns an error of type apistatus.ObjectAlreadyRemoved if the requested object is inhumed. +// Returns ErrRangeOutOfBounds if the requested object range is out of bounds. // // Returns an error if executions are blocked (see BlockExecution). func (e *StorageEngine) GetRange(prm *RngPrm) (res *RngRes, err error) { diff --git a/pkg/local_object_storage/engine/select.go b/pkg/local_object_storage/engine/select.go index 71cd741895..7146c5bc59 100644 --- a/pkg/local_object_storage/engine/select.go +++ b/pkg/local_object_storage/engine/select.go @@ -16,7 +16,7 @@ type SelectPrm struct { filters object.SearchFilters } -// SelectRes groups resulting values of Select operation. +// SelectRes groups the resulting values of Select operation. type SelectRes struct { addrList []*addressSDK.Address } diff --git a/pkg/local_object_storage/metabase/delete.go b/pkg/local_object_storage/metabase/delete.go index bdc2848470..689c9fc13e 100644 --- a/pkg/local_object_storage/metabase/delete.go +++ b/pkg/local_object_storage/metabase/delete.go @@ -18,7 +18,7 @@ type DeletePrm struct { addrs []*addressSDK.Address } -// DeleteRes groups resulting values of Delete operation. +// DeleteRes groups the resulting values of Delete operation. type DeleteRes struct{} // WithAddresses is a Delete option to set the addresses of the objects to delete. diff --git a/pkg/local_object_storage/metabase/exists.go b/pkg/local_object_storage/metabase/exists.go index 1c163dfe76..ed7f6c4ed2 100644 --- a/pkg/local_object_storage/metabase/exists.go +++ b/pkg/local_object_storage/metabase/exists.go @@ -16,7 +16,7 @@ type ExistsPrm struct { addr *addressSDK.Address } -// ExistsRes groups resulting values of Exists operation. +// ExistsRes groups the resulting values of Exists operation. type ExistsRes struct { exists bool } diff --git a/pkg/local_object_storage/metabase/get.go b/pkg/local_object_storage/metabase/get.go index decc8d122e..fe74254a19 100644 --- a/pkg/local_object_storage/metabase/get.go +++ b/pkg/local_object_storage/metabase/get.go @@ -16,7 +16,7 @@ type GetPrm struct { raw bool } -// GetRes groups resulting values of Get operation. +// GetRes groups the resulting values of Get operation. type GetRes struct { hdr *objectSDK.Object } diff --git a/pkg/local_object_storage/metabase/inhume.go b/pkg/local_object_storage/metabase/inhume.go index 66e1c425cb..c9256bdc72 100644 --- a/pkg/local_object_storage/metabase/inhume.go +++ b/pkg/local_object_storage/metabase/inhume.go @@ -21,7 +21,7 @@ type InhumePrm struct { // InhumeRes encapsulates results of Inhume operation. type InhumeRes struct{} -// WithAddresses sets list of object addresses that should be inhumed. +// WithAddresses sets a list of object addresses that should be inhumed. func (p *InhumePrm) WithAddresses(addrs ...*addressSDK.Address) *InhumePrm { if p != nil { p.target = addrs diff --git a/pkg/local_object_storage/metabase/movable.go b/pkg/local_object_storage/metabase/movable.go index 00b8d937a2..6f83720540 100644 --- a/pkg/local_object_storage/metabase/movable.go +++ b/pkg/local_object_storage/metabase/movable.go @@ -12,7 +12,7 @@ type ToMoveItPrm struct { addr *addressSDK.Address } -// ToMoveItRes groups resulting values of ToMoveIt operation. +// ToMoveItRes groups the resulting values of ToMoveIt operation. type ToMoveItRes struct{} // WithAddress sets address of the object to move into another shard. @@ -29,7 +29,7 @@ type DoNotMovePrm struct { addr *addressSDK.Address } -// DoNotMoveRes groups resulting values of DoNotMove operation. +// DoNotMoveRes groups the resulting values of DoNotMove operation. type DoNotMoveRes struct{} // WithAddress sets address of the object to prevent moving into another shard. @@ -44,7 +44,7 @@ func (p *DoNotMovePrm) WithAddress(addr *addressSDK.Address) *DoNotMovePrm { // MovablePrm groups the parameters of Movable operation. type MovablePrm struct{} -// MovableRes groups resulting values of Movable operation. +// MovableRes groups the resulting values of Movable operation. type MovableRes struct { addrList []*addressSDK.Address } diff --git a/pkg/local_object_storage/metabase/put.go b/pkg/local_object_storage/metabase/put.go index 8239010cfa..527ece1e43 100644 --- a/pkg/local_object_storage/metabase/put.go +++ b/pkg/local_object_storage/metabase/put.go @@ -30,7 +30,7 @@ type PutPrm struct { id *blobovnicza.ID } -// PutRes groups resulting values of Put operation. +// PutRes groups the resulting values of Put operation. type PutRes struct{} // WithObject is a Put option to set object to save. diff --git a/pkg/local_object_storage/metabase/select.go b/pkg/local_object_storage/metabase/select.go index b765a7884c..2431ddb46f 100644 --- a/pkg/local_object_storage/metabase/select.go +++ b/pkg/local_object_storage/metabase/select.go @@ -32,7 +32,7 @@ type SelectPrm struct { filters object.SearchFilters } -// SelectRes groups resulting values of Select operation. +// SelectRes groups the resulting values of Select operation. type SelectRes struct { addrList []*addressSDK.Address } diff --git a/pkg/local_object_storage/metabase/small.go b/pkg/local_object_storage/metabase/small.go index a4da3b8d04..99a32a096c 100644 --- a/pkg/local_object_storage/metabase/small.go +++ b/pkg/local_object_storage/metabase/small.go @@ -12,7 +12,7 @@ type IsSmallPrm struct { addr *addressSDK.Address } -// IsSmallRes groups resulting values of IsSmall operation. +// IsSmallRes groups the resulting values of IsSmall operation. type IsSmallRes struct { id *blobovnicza.ID } diff --git a/pkg/local_object_storage/shard/delete.go b/pkg/local_object_storage/shard/delete.go index 76499d4b35..b75b459c85 100644 --- a/pkg/local_object_storage/shard/delete.go +++ b/pkg/local_object_storage/shard/delete.go @@ -14,7 +14,7 @@ type DeletePrm struct { addr []*addressSDK.Address } -// DeleteRes groups resulting values of Delete operation. +// DeleteRes groups the resulting values of Delete operation. type DeleteRes struct{} // WithAddresses is a Delete option to set the addresses of the objects to delete. diff --git a/pkg/local_object_storage/shard/exists.go b/pkg/local_object_storage/shard/exists.go index 11b85356c1..94123856e6 100644 --- a/pkg/local_object_storage/shard/exists.go +++ b/pkg/local_object_storage/shard/exists.go @@ -12,7 +12,7 @@ type ExistsPrm struct { addr *addressSDK.Address } -// ExistsRes groups resulting values of Exists operation. +// ExistsRes groups the resulting values of Exists operation. type ExistsRes struct { ex bool } diff --git a/pkg/local_object_storage/shard/get.go b/pkg/local_object_storage/shard/get.go index 42e92c453c..f8910e8b1e 100644 --- a/pkg/local_object_storage/shard/get.go +++ b/pkg/local_object_storage/shard/get.go @@ -25,7 +25,7 @@ type GetPrm struct { skipMeta bool } -// GetRes groups resulting values of Get operation. +// GetRes groups the resulting values of Get operation. type GetRes struct { obj *objectSDK.Object hasMeta bool @@ -64,8 +64,8 @@ func (r *GetRes) HasMeta() bool { // Returns any error encountered that // did not allow to completely read the object part. // -// Returns an error of type apistatus.ObjectNotFound if requested object is missing in shard. -// Returns an error of type apistatus.ObjectAlreadyRemoved if requested object has been marked as removed in shard. +// Returns an error of type apistatus.ObjectNotFound if the requested object is missing in shard. +// Returns an error of type apistatus.ObjectAlreadyRemoved if the requested object has been marked as removed in shard. func (s *Shard) Get(prm *GetPrm) (*GetRes, error) { var big, small storFetcher diff --git a/pkg/local_object_storage/shard/head.go b/pkg/local_object_storage/shard/head.go index d8761bfe38..4a86a265f5 100644 --- a/pkg/local_object_storage/shard/head.go +++ b/pkg/local_object_storage/shard/head.go @@ -15,7 +15,7 @@ type HeadPrm struct { raw bool } -// HeadRes groups resulting values of Head operation. +// HeadRes groups the resulting values of Head operation. type HeadRes struct { obj *objectSDK.Object } @@ -52,7 +52,7 @@ func (r *HeadRes) Object() *objectSDK.Object { // Returns any error encountered. // // Returns an error of type apistatus.ObjectNotFound if object is missing in Shard. -// Returns an error of type apistatus.ObjectAlreadyRemoved if requested object has been marked as removed in shard. +// Returns an error of type apistatus.ObjectAlreadyRemoved if the requested object has been marked as removed in shard. func (s *Shard) Head(prm *HeadPrm) (*HeadRes, error) { // object can be saved in write-cache (if enabled) or in metabase diff --git a/pkg/local_object_storage/shard/inhume.go b/pkg/local_object_storage/shard/inhume.go index 2b4247cfc5..683a77f94c 100644 --- a/pkg/local_object_storage/shard/inhume.go +++ b/pkg/local_object_storage/shard/inhume.go @@ -17,7 +17,7 @@ type InhumePrm struct { // InhumeRes encapsulates results of inhume operation. type InhumeRes struct{} -// WithTarget sets list of objects that should be inhumed and tombstone address +// WithTarget sets a list of objects that should be inhumed and tombstone address // as the reason for inhume operation. // // tombstone should not be nil, addr should not be empty. diff --git a/pkg/local_object_storage/shard/put.go b/pkg/local_object_storage/shard/put.go index f7f50d7ce4..8636b2844e 100644 --- a/pkg/local_object_storage/shard/put.go +++ b/pkg/local_object_storage/shard/put.go @@ -14,7 +14,7 @@ type PutPrm struct { obj *object.Object } -// PutRes groups resulting values of Put operation. +// PutRes groups the resulting values of Put operation. type PutRes struct{} // WithObject is a Put option to set object to save. diff --git a/pkg/local_object_storage/shard/range.go b/pkg/local_object_storage/shard/range.go index 4549166258..2aca6b4e17 100644 --- a/pkg/local_object_storage/shard/range.go +++ b/pkg/local_object_storage/shard/range.go @@ -18,7 +18,7 @@ type RngPrm struct { skipMeta bool } -// RngRes groups resulting values of GetRange operation. +// RngRes groups the resulting values of GetRange operation. type RngRes struct { obj *object.Object hasMeta bool @@ -68,9 +68,9 @@ func (r *RngRes) HasMeta() bool { // Returns any error encountered that // did not allow to completely read the object part. // -// Returns ErrRangeOutOfBounds if requested object range is out of bounds. -// Returns an error of type apistatus.ObjectNotFound if requested object is missing. -// Returns an error of type apistatus.ObjectAlreadyRemoved if requested object has been marked as removed in shard. +// Returns ErrRangeOutOfBounds if the requested object range is out of bounds. +// Returns an error of type apistatus.ObjectNotFound if the requested object is missing. +// Returns an error of type apistatus.ObjectAlreadyRemoved if the requested object has been marked as removed in shard. func (s *Shard) GetRange(prm *RngPrm) (*RngRes, error) { var big, small storFetcher diff --git a/pkg/local_object_storage/shard/select.go b/pkg/local_object_storage/shard/select.go index 3311543c3f..662829d5d0 100644 --- a/pkg/local_object_storage/shard/select.go +++ b/pkg/local_object_storage/shard/select.go @@ -15,7 +15,7 @@ type SelectPrm struct { filters object.SearchFilters } -// SelectRes groups resulting values of Select operation. +// SelectRes groups the resulting values of Select operation. type SelectRes struct { addrList []*addressSDK.Address } diff --git a/pkg/local_object_storage/writecache/get.go b/pkg/local_object_storage/writecache/get.go index 7e1f80ce18..838eee70fe 100644 --- a/pkg/local_object_storage/writecache/get.go +++ b/pkg/local_object_storage/writecache/get.go @@ -9,7 +9,7 @@ import ( // Get returns object from write-cache. // -// Returns an error of type apistatus.ObjectNotFound if requested object is missing in write-cache. +// Returns an error of type apistatus.ObjectNotFound if the requested object is missing in write-cache. func (c *cache) Get(addr *addressSDK.Address) (*objectSDK.Object, error) { saddr := addr.String() @@ -52,7 +52,7 @@ func (c *cache) Get(addr *addressSDK.Address) (*objectSDK.Object, error) { // Head returns object header from write-cache. // -// Returns an error of type apistatus.ObjectNotFound if requested object is missing in write-cache. +// Returns an error of type apistatus.ObjectNotFound if the requested object is missing in write-cache. func (c *cache) Head(addr *addressSDK.Address) (*objectSDK.Object, error) { obj, err := c.Get(addr) if err != nil { @@ -65,7 +65,7 @@ func (c *cache) Head(addr *addressSDK.Address) (*objectSDK.Object, error) { // Get fetches object from the underlying database. // Key should be a stringified address. // -// Returns an error of type apistatus.ObjectNotFound if requested object is missing in db. +// Returns an error of type apistatus.ObjectNotFound if the requested object is missing in db. func Get(db *bbolt.DB, key []byte) ([]byte, error) { var value []byte err := db.View(func(tx *bbolt.Tx) error { diff --git a/pkg/morph/client/client.go b/pkg/morph/client/client.go index 990941cbbf..dc4829f425 100644 --- a/pkg/morph/client/client.go +++ b/pkg/morph/client/client.go @@ -398,7 +398,7 @@ func (c *Client) TxHeight(h util.Uint256) (res uint32, err error) { } // NeoFSAlphabetList returns keys that stored in NeoFS Alphabet role. Main chain -// stores alphabet node keys of inner ring there, however side chain stores both +// stores alphabet node keys of inner ring there, however the sidechain stores both // alphabet and non alphabet node keys of inner ring. func (c *Client) NeoFSAlphabetList() (res keys.PublicKeys, err error) { c.switchLock.RLock() diff --git a/pkg/morph/client/neofs/bind.go b/pkg/morph/client/neofs/bind.go index ef50fc0c48..4a89e3c380 100644 --- a/pkg/morph/client/neofs/bind.go +++ b/pkg/morph/client/neofs/bind.go @@ -24,7 +24,7 @@ func (x *commonBindArgs) SetScriptHash(v []byte) { x.scriptHash = v } -// SetKeys sets list of public keys in a binary format. +// SetKeys sets a list of public keys in a binary format. func (x *commonBindArgs) SetKeys(v [][]byte) { x.keys = v } diff --git a/pkg/morph/client/neofsid/addrm_keys.go b/pkg/morph/client/neofsid/addrm_keys.go index cd0deb239a..7e3032e63f 100644 --- a/pkg/morph/client/neofsid/addrm_keys.go +++ b/pkg/morph/client/neofsid/addrm_keys.go @@ -23,7 +23,7 @@ func (x *CommonBindPrm) SetOwnerID(v []byte) { x.ownerID = v } -// SetKeys sets list of public keys in a binary format. +// SetKeys sets a list of public keys in a binary format. func (x *CommonBindPrm) SetKeys(v [][]byte) { x.keys = v } diff --git a/pkg/morph/client/nns.go b/pkg/morph/client/nns.go index c6bd57f550..63b47be0b0 100644 --- a/pkg/morph/client/nns.go +++ b/pkg/morph/client/nns.go @@ -16,7 +16,7 @@ import ( ) const ( - nnsContractID = 1 // NNS contract must be deployed first in side chain + nnsContractID = 1 // NNS contract must be deployed first in the sidechain // NNSAuditContractName is a name of the audit contract in NNS. NNSAuditContractName = "audit.neofs" diff --git a/pkg/morph/client/notary.go b/pkg/morph/client/notary.go index 2f4aac4299..58e733e3d8 100644 --- a/pkg/morph/client/notary.go +++ b/pkg/morph/client/notary.go @@ -229,7 +229,7 @@ type UpdateNotaryListPrm struct { hash util.Uint256 } -// SetList sets list of the new notary role keys. +// SetList sets a list of the new notary role keys. func (u *UpdateNotaryListPrm) SetList(list keys.PublicKeys) { u.list = list } @@ -276,7 +276,7 @@ type UpdateAlphabetListPrm struct { hash util.Uint256 } -// SetList sets list of the new alphabet role keys. +// SetList sets a list of the new alphabet role keys. func (u *UpdateAlphabetListPrm) SetList(list keys.PublicKeys) { u.list = list } @@ -288,7 +288,7 @@ func (u *UpdateAlphabetListPrm) SetHash(hash util.Uint256) { } // UpdateNeoFSAlphabetList updates list of alphabet nodes in designate contract. -// As for side chain list should contain all inner ring nodes. +// As for sidechain list should contain all inner ring nodes. // Requires committee multi signature. // // This function must be invoked with notary enabled otherwise it throws panic. diff --git a/pkg/morph/client/subnet/admin.go b/pkg/morph/client/subnet/admin.go index a0376b822d..832c40a0df 100644 --- a/pkg/morph/client/subnet/admin.go +++ b/pkg/morph/client/subnet/admin.go @@ -45,7 +45,7 @@ func (x *ManageAdminsPrm) SetGroup(id []byte) { x.group = id } -// ManageAdminsRes groups resulting values of node administer methods of Subnet contract. +// ManageAdminsRes groups the resulting values of node administer methods of Subnet contract. type ManageAdminsRes struct{} // ManageAdmins manages admin list of the NeoFS subnet through Subnet contract calls. diff --git a/pkg/morph/client/subnet/clients.go b/pkg/morph/client/subnet/clients.go index ce6b840e57..3d0ed4ed05 100644 --- a/pkg/morph/client/subnet/clients.go +++ b/pkg/morph/client/subnet/clients.go @@ -21,7 +21,7 @@ func (x *UserAllowedPrm) SetClient(id []byte) { x.args[1] = id } -// UserAllowedRes groups resulting values of UserAllowed method of Subnet contract. +// UserAllowedRes groups the resulting values of UserAllowed method of Subnet contract. type UserAllowedRes struct { result bool } @@ -87,7 +87,7 @@ func (x *ManageClientsPrm) SetClient(id []byte) { x.args[2] = id } -// ManageClientsRes groups resulting values of client management methods of Subnet contract. +// ManageClientsRes groups the resulting values of client management methods of Subnet contract. type ManageClientsRes struct{} // ManageClients manages client list of the NeoFS subnet through Subnet contract calls. diff --git a/pkg/morph/client/subnet/delete.go b/pkg/morph/client/subnet/delete.go index d74b1d992c..6fed72f9f5 100644 --- a/pkg/morph/client/subnet/delete.go +++ b/pkg/morph/client/subnet/delete.go @@ -23,7 +23,7 @@ func (x *DeletePrm) SetID(id []byte) { x.args[0] = id } -// DeleteRes groups resulting values of Delete method of Subnet contract. +// DeleteRes groups the resulting values of Delete method of Subnet contract. type DeleteRes struct{} // Delete removes subnet though the call of the corresponding method of the Subnet contract. diff --git a/pkg/morph/client/subnet/get.go b/pkg/morph/client/subnet/get.go index 103afc123d..7fcefc760c 100644 --- a/pkg/morph/client/subnet/get.go +++ b/pkg/morph/client/subnet/get.go @@ -16,7 +16,7 @@ func (x *GetPrm) SetID(id []byte) { x.args[0] = id } -// GetRes groups resulting values of Get method of Subnet contract. +// GetRes groups the resulting values of Get method of Subnet contract. type GetRes struct { info []byte } diff --git a/pkg/morph/client/subnet/node.go b/pkg/morph/client/subnet/node.go index e3ae479539..14afbd47ce 100644 --- a/pkg/morph/client/subnet/node.go +++ b/pkg/morph/client/subnet/node.go @@ -23,7 +23,7 @@ func (x *NodeAllowedPrm) SetNode(id []byte) { x.args[1] = id } -// NodeAllowedRes groups resulting values of NodeAllowed method of Subnet contract. +// NodeAllowedRes groups the resulting values of NodeAllowed method of Subnet contract. type NodeAllowedRes struct { result bool } diff --git a/pkg/morph/client/subnet/nodes.go b/pkg/morph/client/subnet/nodes.go index 87841e258e..79e8463790 100644 --- a/pkg/morph/client/subnet/nodes.go +++ b/pkg/morph/client/subnet/nodes.go @@ -27,7 +27,7 @@ func (x *ManageNodesPrm) SetNode(id []byte) { x.args[1] = id } -// ManageNodesRes groups resulting values of node management methods of Subnet contract. +// ManageNodesRes groups the resulting values of node management methods of Subnet contract. type ManageNodesRes struct{} // ManageNodes manages node list of the NeoFS subnet through Subnet contract calls. diff --git a/pkg/morph/client/subnet/put.go b/pkg/morph/client/subnet/put.go index 8a9df68144..d2736613a7 100644 --- a/pkg/morph/client/subnet/put.go +++ b/pkg/morph/client/subnet/put.go @@ -33,7 +33,7 @@ func (x *PutPrm) SetInfo(id []byte) { x.args[2] = id } -// PutRes groups resulting values of Put method of Subnet contract. +// PutRes groups the resulting values of Put method of Subnet contract. type PutRes struct{} // Put creates subnet though the call of the corresponding method of the Subnet contract. diff --git a/pkg/morph/timer/block_test.go b/pkg/morph/timer/block_test.go index 59b484e6ec..a0981ca5a9 100644 --- a/pkg/morph/timer/block_test.go +++ b/pkg/morph/timer/block_test.go @@ -13,7 +13,7 @@ func tickN(t *timer.BlockTimer, n uint32) { } } -// This test emulates inner-ring handling of a new epoch and a new block. +// This test emulates inner ring handling of a new epoch and a new block. // "resetting" consists of ticking the current height as well and invoking `Reset`. func TestIRBlockTimer_Reset(t *testing.T) { var baseCounter [2]int diff --git a/pkg/services/audit/task.go b/pkg/services/audit/task.go index 7274e927db..1948add9b2 100644 --- a/pkg/services/audit/task.go +++ b/pkg/services/audit/task.go @@ -110,7 +110,7 @@ func (t *Task) ContainerNodes() netmap.ContainerNodes { return t.cnrNodes } -// WithStorageGroupList sets list of storage groups from container under audit. +// WithStorageGroupList sets a list of storage groups from container under audit. func (t *Task) WithStorageGroupList(sgList []oidSDK.ID) *Task { if t != nil { t.sgList = sgList diff --git a/pkg/services/control/service.go b/pkg/services/control/service.go index 7f0b0d7aaa..ab93b99343 100644 --- a/pkg/services/control/service.go +++ b/pkg/services/control/service.go @@ -454,7 +454,7 @@ func (x *SetNetmapStatusResponse) SignedDataSize() int { return x.GetBody().StableSize() } -// SetAddressList sets list of objects to be removed in NeoFS API binary format. +// SetAddressList sets a list of objects to be removed in NeoFS API binary format. func (x *DropObjectsRequest_Body) SetAddressList(v [][]byte) { if x != nil { x.AddressList = v diff --git a/pkg/services/object/get/prm.go b/pkg/services/object/get/prm.go index 686adb293f..75f00fc325 100644 --- a/pkg/services/object/get/prm.go +++ b/pkg/services/object/get/prm.go @@ -86,7 +86,7 @@ func (p *RangePrm) SetRange(rng *object.Range) { p.rng = rng } -// SetRangeList sets list of object payload ranges. +// SetRangeList sets a list of object payload ranges. func (p *RangeHashPrm) SetRangeList(rngs []object.Range) { p.rngs = rngs } diff --git a/pkg/services/object/internal/client/client.go b/pkg/services/object/internal/client/client.go index 449ad9c704..40e23a7cab 100644 --- a/pkg/services/object/internal/client/client.go +++ b/pkg/services/object/internal/client/client.go @@ -132,7 +132,7 @@ func (x *GetObjectPrm) SetAddress(addr *addressSDK.Address) { } } -// GetObjectRes groups resulting values of GetObject operation. +// GetObjectRes groups the resulting values of GetObject operation. type GetObjectRes struct { obj *object.Object } @@ -146,10 +146,10 @@ func (x GetObjectRes) Object() *object.Object { // // Client, context and key must be set. // -// Returns any error prevented the operation from completing correctly in error return. +// Returns any error which prevented the operation from completing correctly in error return. // Returns: // error of type *object.SplitInfoError if object raw flag is set and requested object is virtual; -// error of type *apistatus.ObjectAlreadyRemoved if requested object is marked to be removed. +// error of type *apistatus.ObjectAlreadyRemoved if the requested object is marked to be removed. func GetObject(prm GetObjectPrm) (*GetObjectRes, error) { if prm.tokenSession != nil { prm.cliPrm.WithinSession(*prm.tokenSession) @@ -227,7 +227,7 @@ func (x *HeadObjectPrm) SetAddress(addr *addressSDK.Address) { } } -// HeadObjectRes groups resulting values of GetObject operation. +// HeadObjectRes groups the resulting values of GetObject operation. type HeadObjectRes struct { hdr *object.Object } @@ -241,10 +241,10 @@ func (x HeadObjectRes) Header() *object.Object { // // Client, context and key must be set. // -// Returns any error prevented the operation from completing correctly in error return. +// Returns any error which prevented the operation from completing correctly in error return. // Returns: // error of type *object.SplitInfoError if object raw flag is set and requested object is virtual; -// error of type *apistatus.ObjectAlreadyRemoved if requested object is marked to be removed. +// error of type *apistatus.ObjectAlreadyRemoved if the requested object is marked to be removed. func HeadObject(prm HeadObjectPrm) (*HeadObjectRes, error) { if prm.local { prm.cliPrm.MarkLocal() @@ -318,7 +318,7 @@ func (x *PayloadRangePrm) SetRange(rng *object.Range) { x.ln = rng.GetLength() } -// PayloadRangeRes groups resulting values of GetObject operation. +// PayloadRangeRes groups the resulting values of GetObject operation. type PayloadRangeRes struct { data []byte } @@ -332,10 +332,10 @@ func (x PayloadRangeRes) PayloadRange() []byte { // // Client, context and key must be set. // -// Returns any error prevented the operation from completing correctly in error return. +// Returns any error which prevented the operation from completing correctly in error return. // Returns: // error of type *object.SplitInfoError if object raw flag is set and requested object is virtual; -// error of type *apistatus.ObjectAlreadyRemoved if requested object is marked to be removed. +// error of type *apistatus.ObjectAlreadyRemoved if the requested object is marked to be removed. func PayloadRange(prm PayloadRangePrm) (*PayloadRangeRes, error) { if prm.local { prm.cliPrm.MarkLocal() @@ -383,7 +383,7 @@ func (x *PutObjectPrm) SetObject(obj *object.Object) { x.obj = obj } -// PutObjectRes groups resulting values of PutObject operation. +// PutObjectRes groups the resulting values of PutObject operation. type PutObjectRes struct { id *oidSDK.ID } @@ -397,7 +397,7 @@ func (x PutObjectRes) ID() *oidSDK.ID { // // Client, context and key must be set. // -// Returns any error prevented the operation from completing correctly in error return. +// Returns any error which prevented the operation from completing correctly in error return. func PutObject(prm PutObjectPrm) (*PutObjectRes, error) { var prmCli client.PrmObjectPutInit @@ -466,7 +466,7 @@ func (x *SearchObjectsPrm) SetFilters(fs object.SearchFilters) { x.cliPrm.SetFilters(fs) } -// SearchObjectsRes groups resulting values of SearchObjects operation. +// SearchObjectsRes groups the resulting values of SearchObjects operation. type SearchObjectsRes struct { ids []oidSDK.ID } @@ -478,7 +478,7 @@ func (x SearchObjectsRes) IDList() []oidSDK.ID { // SearchObjects selects objects from container which match the filters. // -// Returns any error prevented the operation from completing correctly in error return. +// Returns any error which prevented the operation from completing correctly in error return. func SearchObjects(prm SearchObjectsPrm) (*SearchObjectsRes, error) { if prm.local { prm.cliPrm.MarkLocal() diff --git a/pkg/services/replicator/task.go b/pkg/services/replicator/task.go index 34273cc384..308b5579a7 100644 --- a/pkg/services/replicator/task.go +++ b/pkg/services/replicator/task.go @@ -43,7 +43,7 @@ func (t *Task) WithObjectAddress(v *addressSDK.Address) *Task { return t } -// WithNodes sets list of potential object holders. +// WithNodes sets a list of potential object holders. func (t *Task) WithNodes(v netmap.Nodes) *Task { if t != nil { t.nodes = v diff --git a/pkg/util/config/crypto.go b/pkg/util/config/crypto.go index 0e74da950c..33fd245c3a 100644 --- a/pkg/util/config/crypto.go +++ b/pkg/util/config/crypto.go @@ -8,7 +8,7 @@ import ( "github.com/nspcc-dev/neo-go/pkg/wallet" ) -// LoadAccount loads NEP-6 load, unlocks and returns provided account. +// LoadAccount loads NEP-6 load, unlocks and returns the provided account. func LoadAccount(path, addr, password string) (*wallet.Account, error) { w, err := wallet.NewWalletFromFile(path) if err != nil { diff --git a/pkg/util/http/calls.go b/pkg/util/http/calls.go index e06a6420a7..a9877e007f 100644 --- a/pkg/util/http/calls.go +++ b/pkg/util/http/calls.go @@ -6,13 +6,13 @@ import ( "net/http" ) -// Serve listens and serves internal HTTP server. +// Serve listens and serves the internal HTTP server. // -// Returns any error returned by internal server +// Returns any error returned by the internal server // except http.ErrServerClosed. // // After Shutdown call, Serve has no effect and -// returned error is always nil. +// the returned error is always nil. func (x *Server) Serve() error { err := x.srv.ListenAndServe() @@ -25,10 +25,10 @@ func (x *Server) Serve() error { return err } -// Shutdown gracefully shuts down internal HTTP server. +// Shutdown gracefully shuts down the internal HTTP server. // -// Shutdown is called with context which expires after -// configured timeout. +// Shutdown is called with the context which expires after +// the configured timeout. // // Once Shutdown has been called on a server, it may not be reused; // future calls to Serve method will have no effect. diff --git a/pkg/util/http/opts.go b/pkg/util/http/opts.go index 83209373a2..852cdf1176 100644 --- a/pkg/util/http/opts.go +++ b/pkg/util/http/opts.go @@ -17,7 +17,7 @@ func defaultCfg() *cfg { } } -// WithShutdownTimeout returns option to set shutdown timeout +// WithShutdownTimeout returns an option to set shutdown timeout // of the internal HTTP server. func WithShutdownTimeout(dur time.Duration) Option { return func(c *cfg) { diff --git a/pkg/util/http/server.go b/pkg/util/http/server.go index 7cd3b6cbf2..7c436c2c5b 100644 --- a/pkg/util/http/server.go +++ b/pkg/util/http/server.go @@ -22,7 +22,7 @@ type Prm struct { } // Server represents a wrapper over http.Server -// that provides interface to start and stop +// that provides an interface to start and stop // listening routine. // // For correct operation, Server must be created diff --git a/pkg/util/locode/column/coordinates.go b/pkg/util/locode/column/coordinates.go index 076ac38f5f..95656345f0 100644 --- a/pkg/util/locode/column/coordinates.go +++ b/pkg/util/locode/column/coordinates.go @@ -26,7 +26,7 @@ type coordinateCode struct { // of the location conforming to UN/LOCODE specification. type LongitudeCode coordinateCode -// LongitudeHemisphere represents hemisphere of the earth +// LongitudeHemisphere represents the hemisphere of the earth // // along the Greenwich meridian. type LongitudeHemisphere [hemisphereSymbols]uint8 @@ -34,7 +34,7 @@ type LongitudeHemisphere [hemisphereSymbols]uint8 // of the location conforming to UN/LOCODE specification. type LatitudeCode coordinateCode -// LatitudeHemisphere represents hemisphere of the earth +// LatitudeHemisphere represents the hemisphere of the earth // along the equator. type LatitudeHemisphere [hemisphereSymbols]uint8 @@ -66,7 +66,7 @@ loop: }, nil } -// LongitudeFromString parses string and returns location's longitude. +// LongitudeFromString parses a string and returns the location's longitude. func LongitudeFromString(s string) (*LongitudeCode, error) { cc, err := coordinateFromString(s, lngDegDigits, []uint8{'W', 'E'}) if err != nil { @@ -76,7 +76,7 @@ func LongitudeFromString(s string) (*LongitudeCode, error) { return (*LongitudeCode)(cc), nil } -// LatitudeFromString parses string and returns location's latitude. +// LatitudeFromString parses a string and returns the location's latitude. func LatitudeFromString(s string) (*LatitudeCode, error) { cc, err := coordinateFromString(s, latDegDigits, []uint8{'N', 'S'}) if err != nil { @@ -90,13 +90,13 @@ func (cc *coordinateCode) degrees() []uint8 { return cc.value[:cc.degDigits] } -// Degrees returns longitude's degrees. +// Degrees returns the longitude's degrees. func (lc *LongitudeCode) Degrees() (l [lngDegDigits]uint8) { copy(l[:], (*coordinateCode)(lc).degrees()) return } -// Degrees returns latitude's degrees. +// Degrees returns the latitude's degrees. func (lc *LatitudeCode) Degrees() (l [latDegDigits]uint8) { copy(l[:], (*coordinateCode)(lc).degrees()) return @@ -110,22 +110,22 @@ func (cc *coordinateCode) minutes() (mnt [minutesDigits]uint8) { return } -// Minutes returns longitude's minutes. +// Minutes returns the longitude's minutes. func (lc *LongitudeCode) Minutes() [minutesDigits]uint8 { return (*coordinateCode)(lc).minutes() } -// Minutes returns latitude's minutes. +// Minutes returns the latitude's minutes. func (lc *LatitudeCode) Minutes() [minutesDigits]uint8 { return (*coordinateCode)(lc).minutes() } -// Hemisphere returns longitude's hemisphere code. +// Hemisphere returns the longitude's hemisphere code. func (lc *LongitudeCode) Hemisphere() LongitudeHemisphere { return (*coordinateCode)(lc).hemisphere() } -// Hemisphere returns latitude's hemisphere code. +// Hemisphere returns the latitude's hemisphere code. func (lc *LatitudeCode) Hemisphere() LatitudeHemisphere { return (*coordinateCode)(lc).hemisphere() } @@ -148,24 +148,24 @@ func (h LongitudeHemisphere) East() bool { return h[0] == 'E' } -// Coordinates represents coordinates of the location from UN/LOCODE table. +// Coordinates represents the coordinates of the location from UN/LOCODE table. type Coordinates struct { lat *LatitudeCode lng *LongitudeCode } -// Latitude returns location's latitude. +// Latitude returns the location's latitude. func (c *Coordinates) Latitude() *LatitudeCode { return c.lat } -// Longitude returns location's longitude. +// Longitude returns the location's longitude. func (c *Coordinates) Longitude() *LongitudeCode { return c.lng } -// CoordinatesFromString parses string and returns location's coordinates. +// CoordinatesFromString parses a string and returns the location's coordinates. func CoordinatesFromString(s string) (*Coordinates, error) { if len(s) == 0 { return nil, nil diff --git a/pkg/util/locode/column/country.go b/pkg/util/locode/column/country.go index adbff9f41e..1abedca86d 100644 --- a/pkg/util/locode/column/country.go +++ b/pkg/util/locode/column/country.go @@ -14,7 +14,7 @@ func (cc *CountryCode) Symbols() [countryCodeLen]uint8 { return *cc } -// CountryCodeFromString parses string and returns country code. +// CountryCodeFromString parses a string and returns the country code. func CountryCodeFromString(s string) (*CountryCode, error) { if len(s) != countryCodeLen { return nil, locode.ErrInvalidString diff --git a/pkg/util/locode/column/location.go b/pkg/util/locode/column/location.go index 6d53af336d..5c1225eba8 100644 --- a/pkg/util/locode/column/location.go +++ b/pkg/util/locode/column/location.go @@ -14,7 +14,7 @@ func (lc *LocationCode) Symbols() [locationCodeLen]uint8 { return *lc } -// LocationCodeFromString parses string and returns location code. +// LocationCodeFromString parses a string and returns the location code. func LocationCodeFromString(s string) (*LocationCode, error) { if len(s) != locationCodeLen { return nil, locode.ErrInvalidString diff --git a/pkg/util/locode/db/airports/calls.go b/pkg/util/locode/db/airports/calls.go index 35a6d8aebb..d3f681f0d2 100644 --- a/pkg/util/locode/db/airports/calls.go +++ b/pkg/util/locode/db/airports/calls.go @@ -41,8 +41,8 @@ type record struct { lng string } -// Get scans records of the OpenFlights Airport to in-memory table (once), -// and returns entry that matches passed UN/LOCODE record. +// Get scans the records of the OpenFlights Airport to an in-memory table (once), +// and returns an entry that matches the passed UN/LOCODE record. // // Records are matched if they have the same country code and either // same IATA code or same city name (location name in UN/LOCODE). @@ -90,8 +90,8 @@ const ( countryFldNum ) -// CountryName scans records of the OpenFlights Country table to in-memory table (once), -// and returns name of the country by code. +// CountryName scans the records of the OpenFlights Country table to an in-memory table (once), +// and returns the name of the country by code. // // Returns locodedb.ErrCountryNotFound if no entry matches. func (db *DB) CountryName(code *locodedb.CountryCode) (name string, err error) { diff --git a/pkg/util/locode/db/boltdb/calls.go b/pkg/util/locode/db/boltdb/calls.go index c17597e5d2..25ff96ee21 100644 --- a/pkg/util/locode/db/boltdb/calls.go +++ b/pkg/util/locode/db/boltdb/calls.go @@ -11,7 +11,7 @@ import ( "go.etcd.io/bbolt" ) -// Open opens underlying BoltDB instance. +// Open opens an underlying BoltDB instance. // // Timeout of BoltDB opening is 3s (only for Linux or Darwin). // @@ -33,7 +33,7 @@ func (db *DB) Open() error { return nil } -// Close closes underlying BoltDB instance. +// Close closes an underlying BoltDB instance. // // Must not be called before successful Open call. func (db *DB) Close() error { @@ -94,10 +94,10 @@ func recordFromValue(data []byte) (*locodedb.Record, error) { return r, nil } -// Put saves the record by key in underlying BoltDB instance. +// Put saves the record by key in an underlying BoltDB instance. // -// Country code from key is used for allocating the 1st level buckets. -// Records are stored in country buckets by location code from key. +// Country code from the key is used for allocating the 1st level buckets. +// Records are stored in country buckets by the location code from the key. // The records are stored in internal binary JSON format. // // Must not be called before successful Open call. diff --git a/pkg/util/locode/db/continent.go b/pkg/util/locode/db/continent.go index 3b05aa79b4..863af7b571 100644 --- a/pkg/util/locode/db/continent.go +++ b/pkg/util/locode/db/continent.go @@ -58,7 +58,7 @@ func (c Continent) String() string { } // ContinentFromString returns Continent value -// corresponding to passed string representation. +// corresponding to the passed string representation. func ContinentFromString(str string) Continent { switch str { default: diff --git a/pkg/util/locode/db/continents/geojson/calls.go b/pkg/util/locode/db/continents/geojson/calls.go index fe212701d7..a8351b745d 100644 --- a/pkg/util/locode/db/continents/geojson/calls.go +++ b/pkg/util/locode/db/continents/geojson/calls.go @@ -12,8 +12,8 @@ import ( const continentProperty = "Continent" -// PointContinent goes through all polygons, and returns continent -// in which point is located. +// PointContinent goes through all polygons and returns the continent +// in which the point is located. // // Returns locodedb.ContinentUnknown if no entry matches. // diff --git a/pkg/util/locode/db/country.go b/pkg/util/locode/db/country.go index c63add3b78..ab64127733 100644 --- a/pkg/util/locode/db/country.go +++ b/pkg/util/locode/db/country.go @@ -6,12 +6,12 @@ import ( locodecolumn "github.com/nspcc-dev/neofs-node/pkg/util/locode/column" ) -// CountryCode represents country code for -// storage in the NeoFS location database. +// CountryCode represents a country code for +// the storage in the NeoFS location database. type CountryCode locodecolumn.CountryCode -// CountryCodeFromString parses string UN/LOCODE country code -// and returns CountryCode. +// CountryCodeFromString parses a string UN/LOCODE country code +// and returns a CountryCode. func CountryCodeFromString(s string) (*CountryCode, error) { cc, err := locodecolumn.CountryCodeFromString(s) if err != nil { @@ -21,7 +21,7 @@ func CountryCodeFromString(s string) (*CountryCode, error) { return CountryFromColumn(cc) } -// CountryFromColumn converts UN/LOCODE country code to CountryCode. +// CountryFromColumn converts a UN/LOCODE country code to a CountryCode. func CountryFromColumn(cc *locodecolumn.CountryCode) (*CountryCode, error) { return (*CountryCode)(cc), nil } diff --git a/pkg/util/locode/db/db.go b/pkg/util/locode/db/db.go index 906c036161..623c05e8af 100644 --- a/pkg/util/locode/db/db.go +++ b/pkg/util/locode/db/db.go @@ -59,14 +59,14 @@ var ErrCountryNotFound = errors.New("country not found") // NamesDB is an interface of the NeoFS location namespace. type NamesDB interface { - // Must resolve country code to country name. + // Must resolve a country code to a country name. // // Must return ErrCountryNotFound if there is no - // country with provided code. + // country with the provided code. CountryName(*CountryCode) (string, error) // Must resolve (country code, subdivision code) to - // subdivision name. + // a subdivision name. // // Must return ErrSubDivNotFound if either country or // subdivision is not presented in database. @@ -152,8 +152,8 @@ func FillDatabase(table SourceTable, airports AirportDB, continents ContinentsDB }) } -// LocodeRecord returns record from the NeoFS location database -// corresponding to string representation of UN/LOCODE. +// LocodeRecord returns the record from the NeoFS location database +// corresponding to the string representation of UN/LOCODE. func LocodeRecord(db DB, sLocode string) (*Record, error) { lc, err := locode.FromString(sLocode) if err != nil { diff --git a/pkg/util/locode/db/location.go b/pkg/util/locode/db/location.go index c7c5262f07..5f6862315e 100644 --- a/pkg/util/locode/db/location.go +++ b/pkg/util/locode/db/location.go @@ -6,12 +6,12 @@ import ( locodecolumn "github.com/nspcc-dev/neofs-node/pkg/util/locode/column" ) -// LocationCode represents location code for -// storage in the NeoFS location database. +// LocationCode represents a location code for +// the storage in the NeoFS location database. type LocationCode locodecolumn.LocationCode -// LocationCodeFromString parses string UN/LOCODE location code -// and returns LocationCode. +// LocationCodeFromString parses a string UN/LOCODE location code +// and returns a LocationCode. func LocationCodeFromString(s string) (*LocationCode, error) { lc, err := locodecolumn.LocationCodeFromString(s) if err != nil { @@ -21,7 +21,7 @@ func LocationCodeFromString(s string) (*LocationCode, error) { return LocationFromColumn(lc) } -// LocationFromColumn converts UN/LOCODE country code to LocationCode. +// LocationFromColumn converts a UN/LOCODE country code to a LocationCode. func LocationFromColumn(cc *locodecolumn.LocationCode) (*LocationCode, error) { return (*LocationCode)(cc), nil } diff --git a/pkg/util/locode/db/point.go b/pkg/util/locode/db/point.go index 78590d61a4..ee5b345f3b 100644 --- a/pkg/util/locode/db/point.go +++ b/pkg/util/locode/db/point.go @@ -7,12 +7,12 @@ import ( locodecolumn "github.com/nspcc-dev/neofs-node/pkg/util/locode/column" ) -// Point represents 2D geographic point. +// Point represents a 2D geographic point. type Point struct { lat, lng float64 } -// NewPoint creates, initializes and returns new Point. +// NewPoint creates, initializes and returns a new Point. func NewPoint(lat, lng float64) *Point { return &Point{ lat: lat, @@ -20,17 +20,17 @@ func NewPoint(lat, lng float64) *Point { } } -// Latitude returns Point's latitude. +// Latitude returns the Point's latitude. func (p Point) Latitude() float64 { return p.lat } -// Longitude returns Point's longitude. +// Longitude returns the Point's longitude. func (p Point) Longitude() float64 { return p.lng } -// PointFromCoordinates converts UN/LOCODE coordinates to Point. +// PointFromCoordinates converts a UN/LOCODE coordinates to a Point. func PointFromCoordinates(crd *locodecolumn.Coordinates) (*Point, error) { if crd == nil { return nil, nil diff --git a/pkg/util/locode/db/record.go b/pkg/util/locode/db/record.go index b385321214..367de4ce09 100644 --- a/pkg/util/locode/db/record.go +++ b/pkg/util/locode/db/record.go @@ -33,12 +33,12 @@ func NewKey(lc locode.LOCODE) (*Key, error) { }, nil } -// CountryCode returns location's country code. +// CountryCode returns the location's country code. func (k *Key) CountryCode() *CountryCode { return k.cc } -// LocationCode returns location code. +// LocationCode returns the location code. func (k *Key) LocationCode() *LocationCode { return k.lc } @@ -60,7 +60,7 @@ type Record struct { var errParseCoordinates = errors.New("invalid coordinates") -// NewRecord calculates Record from UN/LOCODE table record. +// NewRecord calculates the Record from the UN/LOCODE table record. func NewRecord(r locode.Record) (*Record, error) { crd, err := locodecolumn.CoordinatesFromString(r.Coordinates) if err != nil { @@ -79,42 +79,42 @@ func NewRecord(r locode.Record) (*Record, error) { }, nil } -// CountryName returns country name. +// CountryName returns the country name. func (r *Record) CountryName() string { return r.countryName } -// SetCountryName sets country name. +// SetCountryName sets the country name. func (r *Record) SetCountryName(name string) { r.countryName = name } -// LocationName returns location name. +// LocationName returns the location name. func (r *Record) LocationName() string { return r.locationName } -// SetLocationName sets location name. +// SetLocationName sets the location name. func (r *Record) SetLocationName(name string) { r.locationName = name } -// SubDivCode returns subdivision code. +// SubDivCode returns the subdivision code. func (r *Record) SubDivCode() string { return r.subDivCode } -// SetSubDivCode sets subdivision code. +// SetSubDivCode sets the subdivision code. func (r *Record) SetSubDivCode(name string) { r.subDivCode = name } -// SubDivName returns subdivision name. +// SubDivName returns the subdivision name. func (r *Record) SubDivName() string { return r.subDivName } -// SetSubDivName sets subdivision name. +// SetSubDivName sets the subdivision name. func (r *Record) SetSubDivName(name string) { r.subDivName = name } @@ -129,12 +129,12 @@ func (r *Record) SetGeoPoint(p *Point) { r.p = p } -// Continent returns location continent. +// Continent returns the location continent. func (r *Record) Continent() *Continent { return r.cont } -// SetContinent sets location continent. +// SetContinent sets the location continent. func (r *Record) SetContinent(c *Continent) { r.cont = c } diff --git a/pkg/util/locode/table/csv/calls.go b/pkg/util/locode/table/csv/calls.go index fae65885b0..159fa5e2ec 100644 --- a/pkg/util/locode/table/csv/calls.go +++ b/pkg/util/locode/table/csv/calls.go @@ -13,7 +13,7 @@ import ( var errInvalidRecord = errors.New("invalid table record") -// IterateAll scans table record one-by-one, parses UN/LOCODE record +// IterateAll scans a table record one-by-one, parses a UN/LOCODE record // from it and passes it to f. // // Returns f's errors directly. @@ -64,8 +64,8 @@ type subDivRecord struct { name string } -// SubDivName scans table record to in-memory table (once), -// and returns subdivision name on country and subdivision codes match. +// SubDivName scans a table record to an in-memory table (once), +// and returns the subdivision name of the country and the subdivision codes match. // // Returns locodedb.ErrSubDivNotFound if no entry matches. func (t *Table) SubDivName(countryCode *locodedb.CountryCode, code string) (string, error) { diff --git a/pkg/util/locode/table/csv/opts.go b/pkg/util/locode/table/csv/opts.go index e521ddf7f1..5aaffd7c17 100644 --- a/pkg/util/locode/table/csv/opts.go +++ b/pkg/util/locode/table/csv/opts.go @@ -19,7 +19,7 @@ func defaultOpts() *options { } } -// WithExtraPaths returns option to add extra paths +// WithExtraPaths returns an option to add extra paths // to UN/LOCODE tables in csv format. func WithExtraPaths(ps ...string) Option { return func(o *options) { diff --git a/pkg/util/logger/logger.go b/pkg/util/logger/logger.go index 462b38e2a3..8fa66da26f 100644 --- a/pkg/util/logger/logger.go +++ b/pkg/util/logger/logger.go @@ -7,7 +7,7 @@ import ( "go.uber.org/zap/zapcore" ) -// Logger represents the component +// Logger represents a component // for writing messages to log. // // It is a type alias of @@ -20,10 +20,10 @@ type Prm struct { } // ErrNilLogger is returned by functions that -// expect a non-nil Logger, but received nil. +// expect a non-nil Logger but received nil. var ErrNilLogger = errors.New("logger is nil") -// SetLevelString sets minimum logging level. +// SetLevelString sets the minimum logging level. // // Returns error of s is not a string representation of zap.Level // value (see zapcore.Level docs). diff --git a/pkg/util/os.go b/pkg/util/os.go index 03b97766d3..1c4c97806c 100644 --- a/pkg/util/os.go +++ b/pkg/util/os.go @@ -2,8 +2,8 @@ package util import "os" -// MkdirAllX calls os.MkdirAll with passed permissions -// but with +x for user and group. This makes created +// MkdirAllX calls os.MkdirAll with the passed permissions +// but with +x for a user and a group. This makes the created // dir openable regardless of the passed permissions. func MkdirAllX(path string, perm os.FileMode) error { return os.MkdirAll(path, perm|0110) diff --git a/pkg/util/precision/converter.go b/pkg/util/precision/converter.go index 3e6ea16d99..bd2948f0a4 100644 --- a/pkg/util/precision/converter.go +++ b/pkg/util/precision/converter.go @@ -6,7 +6,7 @@ import ( ) type ( - // Converter is cached wrapper on `convert` function. It caches base and + // Converter is a cached wrapper on `convert` function. It caches base and // target precisions and factor. converter struct { base uint32 // base precision diff --git a/pkg/util/state/storage.go b/pkg/util/state/storage.go index f09f6b70e7..0485b14813 100644 --- a/pkg/util/state/storage.go +++ b/pkg/util/state/storage.go @@ -17,7 +17,7 @@ type PersistentStorage struct { var stateBucket = []byte("state") -// NewPersistentStorage creates new instance of a storage with 0600 rights. +// NewPersistentStorage creates a new instance of a storage with 0600 rights. func NewPersistentStorage(path string) (*PersistentStorage, error) { db, err := bbolt.Open(path, 0600, nil) if err != nil { @@ -27,7 +27,7 @@ func NewPersistentStorage(path string) (*PersistentStorage, error) { return &PersistentStorage{db: db}, nil } -// SetUInt32 sets uint32 value in the storage. +// SetUInt32 sets a uint32 value in the storage. func (p PersistentStorage) SetUInt32(key []byte, value uint32) error { return p.db.Update(func(tx *bbolt.Tx) error { b, err := tx.CreateBucketIfNotExists(stateBucket) @@ -42,7 +42,7 @@ func (p PersistentStorage) SetUInt32(key []byte, value uint32) error { }) } -// UInt32 returns uint32 value from persistent storage. If value is not exists, +// UInt32 returns a uint32 value from persistent storage. If the value does not exist, // returns 0. func (p PersistentStorage) UInt32(key []byte) (n uint32, err error) { err = p.db.View(func(tx *bbolt.Tx) error { diff --git a/pkg/util/worker_pool.go b/pkg/util/worker_pool.go index 453f9f3fcd..145fd1a5a9 100644 --- a/pkg/util/worker_pool.go +++ b/pkg/util/worker_pool.go @@ -5,7 +5,7 @@ import ( "go.uber.org/atomic" ) -// WorkerPool represents the tool for control +// WorkerPool represents a tool to control // the execution of go-routine pool. type WorkerPool interface { // Submit queues a function for execution @@ -22,7 +22,7 @@ type WorkerPool interface { Release() } -// pseudoWorkerPool represents pseudo worker pool which executes submitted job immediately in the caller's routine. +// pseudoWorkerPool represents a pseudo worker pool which executes the submitted job immediately in the caller's routine. type pseudoWorkerPool struct { closed atomic.Bool } @@ -30,12 +30,12 @@ type pseudoWorkerPool struct { // ErrPoolClosed is returned when submitting task to a closed pool. var ErrPoolClosed = ants.ErrPoolClosed -// NewPseudoWorkerPool returns new instance of a synchronous worker pool. +// NewPseudoWorkerPool returns a new instance of a synchronous worker pool. func NewPseudoWorkerPool() WorkerPool { return &pseudoWorkerPool{} } -// Submit executes passed function immediately. +// Submit executes the passed function immediately. // // Always returns nil. func (p *pseudoWorkerPool) Submit(fn func()) error { @@ -48,7 +48,7 @@ func (p *pseudoWorkerPool) Submit(fn func()) error { return nil } -// Release implements WorkerPool interface. +// Release implements the WorkerPool interface. func (p *pseudoWorkerPool) Release() { p.closed.Store(true) }