forked from TrueCloudLab/frostfs-node
[#1687] *: Perform `go fmt` using go `v1.19`
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>support/v0.34
parent
37ab26bfa9
commit
30341f2192
|
@ -70,9 +70,9 @@ func (c *cleanupTable) update(snapshot netmap.NetMap, now uint64) {
|
|||
// updates last access time of the netmap node by string public key.
|
||||
//
|
||||
// Returns true if at least one condition is met:
|
||||
// * node hasn't been accessed yet;
|
||||
// * remove flag is set;
|
||||
// * binary node info has changed.
|
||||
// - node hasn't been accessed yet;
|
||||
// - remove flag is set;
|
||||
// - binary node info has changed.
|
||||
func (c *cleanupTable) touch(keyString string, now uint64, binNodeInfo []byte) bool {
|
||||
c.Lock()
|
||||
defer c.Unlock()
|
||||
|
|
|
@ -21,12 +21,12 @@ var errMissingRequiredAttr = errors.New("missing required attribute in DB record
|
|||
//
|
||||
// New attributes are formed from the record of DB instance (Prm).
|
||||
// If DB entry R was found w/o errors, new attributes are:
|
||||
// * CountryCode: R.CountryCode().String();
|
||||
// * Country: R.CountryName();
|
||||
// * Location: Record.LocationName();
|
||||
// * SubDivCode: R.SubDivCode();
|
||||
// * SubDiv: R.SubDivName();
|
||||
// * Continent: R.Continent().String().
|
||||
// - CountryCode: R.CountryCode().String();
|
||||
// - Country: R.CountryName();
|
||||
// - Location: Record.LocationName();
|
||||
// - SubDivCode: R.SubDivCode();
|
||||
// - SubDiv: R.SubDivName();
|
||||
// - Continent: R.Continent().String().
|
||||
//
|
||||
// UN-LOCODE attribute remains untouched.
|
||||
func (v *Validator) VerifyAndUpdate(n *netmap.NodeInfo) error {
|
||||
|
|
|
@ -37,9 +37,9 @@ var errDiffID = errors.New("diff subnet IDs")
|
|||
// All read errors of Put are forwarded.
|
||||
//
|
||||
// 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.
|
||||
// - zero subnet creation;
|
||||
// - empty ID or different from the one wired into info;
|
||||
// - empty owner ID or different from the one wired into info.
|
||||
func (x PutValidator) Assert(event Put) error {
|
||||
var err error
|
||||
|
||||
|
|
|
@ -101,12 +101,12 @@ const (
|
|||
// All handlers are executed only if the local node is an alphabet one.
|
||||
//
|
||||
// Events (notary):
|
||||
// * put (parser: subnetevents.ParseNotaryPut, handler: catchSubnetCreation);
|
||||
// * Delete (parser: subnetevents.ParseDelete, handler: catchSubnetCreation).
|
||||
// - put (parser: subnetevents.ParseNotaryPut, handler: catchSubnetCreation);
|
||||
// - Delete (parser: subnetevents.ParseDelete, handler: catchSubnetCreation).
|
||||
//
|
||||
// Events (non-notary):
|
||||
// * Put (parser: subnetevents.ParsePut, handler: catchSubnetCreation);
|
||||
// * Delete (parser: subnetevents.ParseDelete, handler: catchSubnetCreation).
|
||||
// - Put (parser: subnetevents.ParsePut, handler: catchSubnetCreation);
|
||||
// - Delete (parser: subnetevents.ParseDelete, handler: catchSubnetCreation).
|
||||
func (s *Server) listenSubnet() {
|
||||
if s.sideNotaryConfig.disabled {
|
||||
s.listenSubnetWithoutNotary()
|
||||
|
|
|
@ -141,9 +141,9 @@ func (e *StorageEngine) execIfNotBlocked(op func() error) error {
|
|||
}
|
||||
|
||||
// sets the flag of blocking execution of all data operations according to err:
|
||||
// * err != nil, then blocks the execution. If exec wasn't blocked, calls close method
|
||||
// - err != nil, then blocks the execution. If exec wasn't blocked, calls close method
|
||||
// (if err == errClosed => additionally releases pools and does not allow to resume executions).
|
||||
// * otherwise, resumes execution. If exec was blocked, calls open method.
|
||||
// - otherwise, resumes execution. If exec was blocked, calls open method.
|
||||
//
|
||||
// Can be called concurrently with exec. In this case it waits for all executions to complete.
|
||||
func (e *StorageEngine) setBlockExecErr(err error) error {
|
||||
|
|
|
@ -110,10 +110,10 @@ func (e *StorageEngine) inhume(prm InhumePrm) (InhumeRes, error) {
|
|||
}
|
||||
|
||||
// Returns:
|
||||
// 0 - fail
|
||||
// 1 - object locked
|
||||
// 2 - lock object removal
|
||||
// 3 - ok
|
||||
// - 0: fail
|
||||
// - 1: object locked
|
||||
// - 2: lock object removal
|
||||
// - 3: ok
|
||||
func (e *StorageEngine) inhumeAddr(addr oid.Address, prm shard.InhumePrm, checkExists bool) (status uint8) {
|
||||
root := false
|
||||
var errLocked apistatus.ObjectLocked
|
||||
|
|
|
@ -43,9 +43,9 @@ func (e *StorageEngine) lock(idCnr cid.ID, locker oid.ID, locked []oid.ID) error
|
|||
}
|
||||
|
||||
// Returns:
|
||||
// 0 - fail
|
||||
// 1 - locking irregular object
|
||||
// 2 - ok
|
||||
// - 0: fail
|
||||
// - 1: locking irregular object
|
||||
// - 2: ok
|
||||
func (e *StorageEngine) lockSingle(idCnr cid.ID, locker, locked oid.ID, checkExists bool) (status uint8) {
|
||||
// code is pretty similar to inhumeAddr, maybe unify?
|
||||
root := false
|
||||
|
|
|
@ -95,10 +95,10 @@ func (db *DB) exists(tx *bbolt.Tx, addr oid.Address, currEpoch uint64) (exists b
|
|||
}
|
||||
|
||||
// objectStatus returns:
|
||||
// * 0 if object is available;
|
||||
// * 1 if object with GC mark;
|
||||
// * 2 if object is covered with tombstone;
|
||||
// * 3 if object is expired.
|
||||
// - 0 if object is available;
|
||||
// - 1 if object with GC mark;
|
||||
// - 2 if object is covered with tombstone;
|
||||
// - 3 if object is expired.
|
||||
func objectStatus(tx *bbolt.Tx, addr oid.Address, currEpoch uint64) uint8 {
|
||||
// we check only if the object is expired in the current
|
||||
// epoch since it is considered the only corner case: the
|
||||
|
|
|
@ -67,12 +67,12 @@ func defaultConfig() *cfg {
|
|||
// If private key is nil, it panics.
|
||||
//
|
||||
// Other values are set according to provided options, or by default:
|
||||
// * client context: Background;
|
||||
// * dial timeout: 5s;
|
||||
// * blockchain network type: netmode.PrivNet;
|
||||
// * signer with the global scope;
|
||||
// * wait interval: 500ms;
|
||||
// * logger: zap.L().
|
||||
// - client context: Background;
|
||||
// - dial timeout: 5s;
|
||||
// - blockchain network type: netmode.PrivNet;
|
||||
// - signer with the global scope;
|
||||
// - wait interval: 500ms;
|
||||
// - logger: zap.L().
|
||||
//
|
||||
// If desired option satisfies the default value, it can be omitted.
|
||||
// If multiple options of the same config value are supplied,
|
||||
|
|
|
@ -820,11 +820,13 @@ func alreadyOnChainError(err error) bool {
|
|||
|
||||
// CalculateNotaryDepositAmount calculates notary deposit amount
|
||||
// using the rule:
|
||||
//
|
||||
// IF notaryBalance < gasBalance * gasMul {
|
||||
// DEPOSIT gasBalance / gasDiv
|
||||
// } ELSE {
|
||||
// DEPOSIT 1
|
||||
// }
|
||||
//
|
||||
// gasMul and gasDiv must be positive.
|
||||
func CalculateNotaryDepositAmount(c *Client, gasMul, gasDiv int64) (fixedn.Fixed8, error) {
|
||||
notaryBalance, err := c.GetNotaryDeposit()
|
||||
|
|
|
@ -52,11 +52,9 @@ func (x NodeEndpointsIterator) NumberOfAddresses() int {
|
|||
//
|
||||
// Correct composition(and order from low to high level)
|
||||
// of protocols:
|
||||
//
|
||||
// 1. dns4/ip4/ip6
|
||||
// 2. tcp
|
||||
// 3. tls(optional, may be absent)
|
||||
//
|
||||
func VerifyMultiAddress(ni netmap.NodeInfo) error {
|
||||
return iterateParsedAddresses(NodeEndpointsIterator(ni), checkProtocols)
|
||||
}
|
||||
|
|
|
@ -504,29 +504,29 @@ func (x *ShardInfo) GetPiloramaPath() string {
|
|||
// Storage Nodes in the network and used implicitly with default values if not
|
||||
// explicitly set:
|
||||
//
|
||||
// * Capacity \
|
||||
// - Capacity \
|
||||
// Total available disk space in Gigabytes.
|
||||
// * Price \
|
||||
// - Price \
|
||||
// Price in GAS tokens for storing one GB of data during one Epoch. In node
|
||||
// attributes it's a string presenting floating point number with comma or
|
||||
// point delimiter for decimal part. In the Network Map it will be saved as
|
||||
// 64-bit unsigned integer representing number of minimal token fractions.
|
||||
// * Subnet \
|
||||
// - Subnet \
|
||||
// String ID of Node's storage subnet. There can be only one subnet served
|
||||
// by the Storage Node.
|
||||
// * Locode \
|
||||
// - Locode \
|
||||
// Node's geographic location in
|
||||
// [UN/LOCODE](https://www.unece.org/cefact/codesfortrade/codes_index.html)
|
||||
// format approximated to the nearest point defined in standard.
|
||||
// * Country \
|
||||
// - Country \
|
||||
// Country code in
|
||||
// [ISO 3166-1_alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
|
||||
// format. Calculated automatically from `Locode` attribute
|
||||
// * Region \
|
||||
// - Region \
|
||||
// Country's administative subdivision where node is located. Calculated
|
||||
// automatically from `Locode` attribute based on `SubDiv` field. Presented
|
||||
// in [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) format.
|
||||
// * City \
|
||||
// - City \
|
||||
// City, town, village or rural area name where node is located written
|
||||
// without diacritics . Calculated automatically from `Locode` attribute.
|
||||
//
|
||||
|
|
|
@ -129,8 +129,8 @@ func (x GetObjectRes) Object() *object.Object {
|
|||
//
|
||||
// Returns any error which prevented the operation from completing correctly in error return.
|
||||
// Returns:
|
||||
// error of type *object.SplitInfoError if object raw flag is set and requested object is virtual;
|
||||
// error of type *apistatus.ObjectAlreadyRemoved if the requested object is marked to be removed.
|
||||
// - error of type *object.SplitInfoError if object raw flag is set and requested object is virtual;
|
||||
// - error of type *apistatus.ObjectAlreadyRemoved if the requested object is marked to be removed.
|
||||
func GetObject(prm GetObjectPrm) (*GetObjectRes, error) {
|
||||
if prm.tokenSession != nil {
|
||||
prm.cliPrm.WithinSession(*prm.tokenSession)
|
||||
|
@ -219,6 +219,7 @@ func (x HeadObjectRes) Header() *object.Object {
|
|||
//
|
||||
// Returns any error which prevented the operation from completing correctly in error return.
|
||||
// Returns:
|
||||
//
|
||||
// error of type *object.SplitInfoError if object raw flag is set and requested object is virtual;
|
||||
// error of type *apistatus.ObjectAlreadyRemoved if the requested object is marked to be removed.
|
||||
func HeadObject(prm HeadObjectPrm) (*HeadObjectRes, error) {
|
||||
|
@ -305,6 +306,7 @@ func (x PayloadRangeRes) PayloadRange() []byte {
|
|||
//
|
||||
// Returns any error which prevented the operation from completing correctly in error return.
|
||||
// Returns:
|
||||
//
|
||||
// error of type *object.SplitInfoError if object raw flag is set and requested object is virtual;
|
||||
// error of type *apistatus.ObjectAlreadyRemoved if the requested object is marked to be removed.
|
||||
func PayloadRange(prm PayloadRangePrm) (*PayloadRangeRes, error) {
|
||||
|
|
|
@ -39,8 +39,8 @@ type ExpirationChecker struct {
|
|||
|
||||
// IsTombstoneAvailable checks the tombstone presence in the system in the
|
||||
// following order:
|
||||
// * 1. Local LRU cache;
|
||||
// * 2. Tombstone source.
|
||||
// - 1. Local LRU cache;
|
||||
// - 2. Tombstone source.
|
||||
//
|
||||
// If a tombstone was successfully fetched (regardless of its expiration)
|
||||
// it is cached in the LRU cache.
|
||||
|
|
|
@ -30,8 +30,8 @@ type Prm struct {
|
|||
//
|
||||
// Controller's main goal is to separate the two main stages of
|
||||
// the calculation:
|
||||
// 1.reporting local values to manager nodes
|
||||
// 2.calculating global trusts of child nodes
|
||||
// 1. reporting local values to manager nodes
|
||||
// 2. calculating global trusts of child nodes
|
||||
//
|
||||
// Calculation stages are controlled based on external signals
|
||||
// that come from the application through the Controller's API.
|
||||
|
|
|
@ -231,8 +231,8 @@ func setStatusV2(resp ResponseMessage, err error) {
|
|||
|
||||
// signs response with private key via signature.SignServiceMessage.
|
||||
// The signature error affects the result depending on the protocol version:
|
||||
// * if status return is supported, panics since we cannot return the failed status, because it will not be signed;
|
||||
// * otherwise, returns error in order to transport it directly.
|
||||
// - if status return is supported, panics since we cannot return the failed status, because it will not be signed;
|
||||
// - otherwise, returns error in order to transport it directly.
|
||||
func signResponse(key *ecdsa.PrivateKey, resp interface{}, statusSupported bool) error {
|
||||
err := signature.SignServiceMessage(key, resp)
|
||||
if err != nil {
|
||||
|
|
|
@ -54,7 +54,7 @@ func panicOnValue(t, n string, v interface{}) {
|
|||
// Panics if at least one value of the parameters is invalid.
|
||||
//
|
||||
// Panics if at least one of next optional parameters is invalid:
|
||||
// * shutdown timeout is non-positive.
|
||||
// - shutdown timeout is non-positive.
|
||||
//
|
||||
// The created Server does not require additional
|
||||
// initialization and is completely ready for work.
|
||||
|
|
|
@ -34,9 +34,9 @@ func (p *Prm) SetLevelString(s string) error {
|
|||
// NewLogger constructs a new zap logger instance.
|
||||
//
|
||||
// Logger is built from production logging configuration with:
|
||||
// * parameterized level;
|
||||
// * console encoding;
|
||||
// * ISO8601 time encoding.
|
||||
// - parameterized level;
|
||||
// - console encoding;
|
||||
// - ISO8601 time encoding.
|
||||
//
|
||||
// Logger records a stack trace for all messages at or above fatal level.
|
||||
func NewLogger(prm Prm) (*Logger, error) {
|
||||
|
|
Loading…
Reference in New Issue