forked from TrueCloudLab/frostfs-node
[#1320] English Check
Signed-off-by: Elizaveta Chichindaeva <elizaveta@nspcc.ru>
This commit is contained in:
parent
d99800ee93
commit
cc7a723d77
182 changed files with 802 additions and 802 deletions
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue