Documentation
¶
Index ¶
- Variables
- func CopyPayload(o *Object) []byte
- func SetExtendedHeadersCopy(h *Header, hs []ExtendedHeader)
- func SetPayloadCopy(o *Object, payload []byte)
- func TypeToUint32(v ExtendedHeaderType) uint32
- func TypesEQ(t1, t2 ExtendedHeaderType) bool
- func TypesGT(t1, t2 ExtendedHeaderType) bool
- func TypesLT(t1, t2 ExtendedHeaderType) bool
- type Address
- type CID
- type Epoch
- type ExtendedHeader
- type ExtendedHeaderType
- type Header
- type ID
- type Object
- type OwnerID
- type SystemHeader
- func (s *SystemHeader) CID() CID
- func (s *SystemHeader) CreationEpoch() Epoch
- func (s *SystemHeader) ID() ID
- func (s *SystemHeader) OwnerID() OwnerID
- func (s *SystemHeader) PayloadLength() uint64
- func (s *SystemHeader) SetCID(v CID)
- func (s *SystemHeader) SetCreationEpoch(v Epoch)
- func (s *SystemHeader) SetID(v ID)
- func (s *SystemHeader) SetOwnerID(v OwnerID)
- func (s *SystemHeader) SetPayloadLength(v uint64)
- func (s *SystemHeader) SetVersion(v uint64)
- func (s *SystemHeader) Version() uint64
Constants ¶
This section is empty.
Variables ¶
var ErrNilHeader = errors.New("object header is nil")
ErrNilHeader is returned by functions that expect a non-nil Header pointer, but received nil.
var ErrNilObject = errors.New("object is nil")
ErrNilObject is returned by functions that expect a non-nil Object pointer, but received nil.
Functions ¶
func CopyPayload ¶
CopyPayload returns the copy of object payload.
Changing the result is safe and does not affect the object.
CopyPayload returns nil if object is nil.
func SetExtendedHeadersCopy ¶
func SetExtendedHeadersCopy(h *Header, hs []ExtendedHeader)
SetExtendedHeadersCopy copies extended headers and sets the copy as the object extended headers.
Subsequent changing the source slice is safe and does not affect the header.
SetExtendedHeadersCopy does nothing if Header is nil.
func SetPayloadCopy ¶
SetPayloadCopy copies slice bytes and sets the copy as object payload.
Subsequent changing the source slice is safe and does not affect the object.
SetPayloadCopy does nothing if object is nil.
func TypeToUint32 ¶
func TypeToUint32(v ExtendedHeaderType) uint32
TypeToUint32 converts Epoch value to builtin uint32.
Try to avoid direct cast for better portability.
func TypesEQ ¶
func TypesEQ(t1, t2 ExtendedHeaderType) bool
TypesEQ reports whether t1 and t2 are the same ExtendedHeaderType.
Function defines the relation of equality between two ExtendedHeaderType. Try to avoid comparison through "==" operator for better portability.
func TypesGT ¶
func TypesGT(t1, t2 ExtendedHeaderType) bool
TypesGT reports whether t1 ExtendedHeaderType is greater than t2.
Function defines the "greater than" relation between two ExtendedHeaderType. Try to avoid comparison through ">" operator for better portability.
func TypesLT ¶
func TypesLT(t1, t2 ExtendedHeaderType) bool
TypesLT reports whether t1 ExtendedHeaderType is less than t2.
Function defines the "less than" relation between two ExtendedHeaderType. Try to avoid comparison through "<" operator for better portability.
Types ¶
type Address ¶
type Address struct {
// contains filtered or unexported fields
}
Address represents NeoFS Object address. Acts as a reference to the object.
func AddressFromObject ¶
AddressFromObject returns an address based on the object's header.
Returns nil on nil object.
type CID ¶
CID represents the container identifier.
It is a type alias of github.com/nspcc-dev/neofs-node/pkg/core/container.ID.
type Epoch ¶
Epoch represents the NeoFS epoch number.
It is a type alias of github.com/nspcc-dev/neofs-node/pkg/core/netmap/epoch.Epoch.
type ExtendedHeader ¶
type ExtendedHeader struct {
// contains filtered or unexported fields
}
ExtendedHeader represents the extended header of NeoFS object.
func CopyExtendedHeaders ¶
func CopyExtendedHeaders(h *Header) []ExtendedHeader
CopyExtendedHeaders returns the copy of extended headers.
Changing the result is safe and does not affect the header.
Returns nil if header is nil.
func (*ExtendedHeader) SetType ¶
func (h *ExtendedHeader) SetType(v ExtendedHeaderType)
SetType sets the extended header type.
func (*ExtendedHeader) SetValue ¶
func (h *ExtendedHeader) SetValue(v interface{})
SetValue sets the extended header value.
Caller must take into account that each type of header usually has a limited set of expected value types.
In the case of a reference type, the value is set by reference, so source value mutations affect header state. Therefore, callers must first copy the source value before changing manipulations.
func (ExtendedHeader) Type ¶
func (h ExtendedHeader) Type() ExtendedHeaderType
Type returns the extended header type.
func (ExtendedHeader) Value ¶
func (h ExtendedHeader) Value() interface{}
Value returns the extended header value.
In the case of a reference type, the value is returned by reference, so value mutations affect header state. Therefore, callers must first copy the value before changing manipulations.
type ExtendedHeaderType ¶
type ExtendedHeaderType uint32
ExtendedHeaderType represents the enumeration of extended header types of the NeoFS object.
func TypeFromUint32 ¶
func TypeFromUint32(v uint32) ExtendedHeaderType
TypeFromUint32 converts builtin uint32 value to Epoch.
Try to avoid direct cast for better portability.
type Header ¶
type Header struct {
// SystemHeader is an obligatory part of any object header.
// It is used to set the identity and basic parameters of
// the object.
//
// Header must inherit all the methods of SystemHeader,
// so the SystemHeader is embedded in Header.
SystemHeader
// contains filtered or unexported fields
}
Header represents NeoFS object header.
func (*Header) ExtendedHeaders ¶
func (h *Header) ExtendedHeaders() []ExtendedHeader
ExtendedHeaders returns the extended headers of header.
Changing the result is unsafe and affects the header. In order to prevent state mutations, use CopyExtendedHeaders.
func (*Header) SetExtendedHeaders ¶
func (h *Header) SetExtendedHeaders(v []ExtendedHeader)
SetExtendedHeaders sets the extended headers of the header.
Subsequent changing the source slice is unsafe and affects the header. In order to prevent state mutations, use SetExtendedHeadersCopy.
type ID ¶
ID represents the object identifier.
It is a type alias of github.com/nspcc-dev/neofs-api-go/refs.ObjectID. FIXME: object ID should be defined in core package.
type Object ¶
type Object struct {
// Header is an obligatory part of any object.
// It is used to carry any additional information
// besides payload.
//
// Object must inherit all the methods of Header,
// so the Header is embedded in Object.
Header
// contains filtered or unexported fields
}
Object represents NeoFS Object.
func (*Object) Payload ¶
Payload returns payload bytes of the object.
Changing the result is unsafe and affects the object. In order to prevent state mutations, use CopyPayload.
func (*Object) SetPayload ¶
SetPayload sets objecyt payload bytes.
Subsequent changing the source slice is unsafe and affects the object. In order to prevent state mutations, use SetPayloadCopy.
type OwnerID ¶
OwnerID represents the container owner identifier.
It is a type alias of github.com/nspcc-dev/neofs-node/pkg/core/container.OwnerID.
type SystemHeader ¶
type SystemHeader struct {
// contains filtered or unexported fields
}
SystemHeader represents the system header of NeoFS Object.
func (*SystemHeader) CID ¶
func (s *SystemHeader) CID() CID
CID returns the container identifier to which the object belongs.
func (*SystemHeader) CreationEpoch ¶
func (s *SystemHeader) CreationEpoch() Epoch
CreationEpoch returns the epoch number in which the object was created.
func (*SystemHeader) OwnerID ¶
func (s *SystemHeader) OwnerID() OwnerID
OwnerID returns the object owner identifier.
func (*SystemHeader) PayloadLength ¶
func (s *SystemHeader) PayloadLength() uint64
PayloadLength returns the length of the object payload bytes.
func (*SystemHeader) SetCID ¶
func (s *SystemHeader) SetCID(v CID)
SetCID sets the container identifier to which the object belongs.
func (*SystemHeader) SetCreationEpoch ¶
func (s *SystemHeader) SetCreationEpoch(v Epoch)
SetCreationEpoch sets the epoch number in which the object was created.
func (*SystemHeader) SetOwnerID ¶
func (s *SystemHeader) SetOwnerID(v OwnerID)
SetOwnerID sets the object owner identifier.
func (*SystemHeader) SetPayloadLength ¶
func (s *SystemHeader) SetPayloadLength(v uint64)
SetPayloadLength sets the length of the object payload bytes.
func (*SystemHeader) SetVersion ¶
func (s *SystemHeader) SetVersion(v uint64)
SetVersion sets the object version number.
func (*SystemHeader) Version ¶
func (s *SystemHeader) Version() uint64
Version returns the object version number.