[#1320] English Check

Signed-off-by: Elizaveta Chichindaeva <elizaveta@nspcc.ru>
This commit is contained in:
Elizaveta Chichindaeva 2022-04-21 14:28:05 +03:00 committed by LeL
parent d99800ee93
commit cc7a723d77
182 changed files with 802 additions and 802 deletions

View file

@ -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

View file

@ -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

View file

@ -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.

View file

@ -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:

View file

@ -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 \

View file

@ -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

View file

@ -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 {

View file

@ -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
)

View file

@ -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)
}

View file

@ -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

View file

@ -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
}

View file

@ -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 (

View file

@ -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 {

View file

@ -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).

View file

@ -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

View file

@ -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")
}

View file

@ -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 != "" {

View file

@ -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")
}

View file

@ -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),

View file

@ -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),

View file

@ -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(

View file

@ -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),

View file

@ -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),

View file

@ -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),

View file

@ -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 == "" {

View file

@ -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(

View file

@ -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"),

View file

@ -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 {

View file

@ -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 != "" {

View file

@ -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")

View file

@ -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")
}

View file

@ -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 {

View file

@ -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) {

View file

@ -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 {

View file

@ -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 != "" {

View file

@ -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 {

View file

@ -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),

View file

@ -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.

View file

@ -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 {

View file

@ -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

View file

@ -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{}

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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()

View file

@ -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(

View file

@ -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

View file

@ -5,7 +5,7 @@
//
// 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
// 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

View file

@ -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

View file

@ -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:

View file

@ -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:

View file

@ -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

View file

@ -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 {

View file

@ -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 {

View file

@ -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
}

View file

@ -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

View file

@ -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")

View file

@ -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
}

View file

@ -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
}

View file

@ -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)
}

View file

@ -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

View file

@ -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()

View file

@ -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

View file

@ -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()
}

View file

@ -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

View file

@ -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

View file

@ -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:

View file

@ -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 {

View file

@ -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 {

View file

@ -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.

View file

@ -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 {

View file

@ -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:

View file

@ -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)

View file

@ -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")

View file

@ -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)

View file

@ -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:

View file

@ -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) {

View file

@ -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)

View file

@ -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:

View file

@ -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")

View file

@ -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")

View file

@ -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)

View file

@ -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() {}

View file

@ -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",

View file

@ -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.

View file

@ -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{}

View file

@ -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.

View file

@ -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

View file

@ -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

View file

@ -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.

View file

@ -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
}

View file

@ -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)
}

View file

@ -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)

View file

@ -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

View file

@ -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 {

View file

@ -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.

View file

@ -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))
}

View file

@ -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 (

View file

@ -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)
}

View file

@ -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 {
}

Some files were not shown because too many files have changed in this diff Show more