[#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

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

@ -4,8 +4,8 @@
// the Reputation service does not fully use the client's flexible interface.
//
// In this regard, this package provides functions over base API client necessary for the application.
// This allows you to concentrate the entire spectrum of the client's use in one place (this will be convenient
// both when updating the base client and for evaluating the UX of SDK library). So it is expected that all
// Reputation service packages will be limited to this package for the development of functionality requiring
// This allows you to concentrate the entire spectrum of the client's use in one place (this will be convenient
// both when updating the base client and for evaluating the UX of SDK library). So, it is expected that all
// Reputation service packages will be limited to this package for the development of functionality requiring
// NeoFS API communication.
package internal

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