Documentation ¶
Index ¶
- Constants
- Variables
- func CalculateID(c *Container) *cid.ID
- type Attribute
- type Attributes
- type Container
- func (c *Container) Attributes() Attributes
- func (c *Container) BasicACL() uint32
- func (c *Container) Marshal(b ...[]byte) ([]byte, error)
- func (c *Container) MarshalJSON() ([]byte, error)
- func (c *Container) Nonce() []bytedeprecated
- func (c *Container) NonceUUID() (uuid.UUID, error)
- func (c *Container) OwnerID() *owner.ID
- func (c *Container) PlacementPolicy() *netmap.PlacementPolicy
- func (c Container) SessionToken() *session.Token
- func (c *Container) SetAttributes(v Attributes)
- func (c *Container) SetBasicACL(v uint32)
- func (c *Container) SetNonce(v []byte)deprecated
- func (c *Container) SetNonceUUID(v uuid.UUID)
- func (c *Container) SetOwnerID(v *owner.ID)
- func (c *Container) SetPlacementPolicy(v *netmap.PlacementPolicy)
- func (c *Container) SetSessionToken(t *session.Token)
- func (c *Container) SetSignature(sig *pkg.Signature)
- func (c *Container) SetVersion(v *pkg.Version)
- func (c Container) Signature() *pkg.Signature
- func (c *Container) ToV2() *container.Container
- func (c *Container) Unmarshal(data []byte) error
- func (c *Container) UnmarshalJSON(data []byte) error
- func (c *Container) Version() *pkg.Version
- type IDdeprecated
- type NewOption
- func WithAttribute(key, value string) NewOption
- func WithCustomBasicACL(acl uint32) NewOption
- func WithNEO3Wallet(w *owner.NEO3Wallet) NewOption
- func WithNonce(nonce uuid.UUID) NewOption
- func WithOwnerID(id *owner.ID) NewOption
- func WithPolicy(policy *netmap.PlacementPolicy) NewOption
- func WithPublicBasicACL() NewOption
- func WithReadOnlyBasicACL() NewOption
- type UsedSpaceAnnouncement
- func (a *UsedSpaceAnnouncement) ContainerID() *cid.ID
- func (a *UsedSpaceAnnouncement) Epoch() uint64
- func (a *UsedSpaceAnnouncement) Marshal(b ...[]byte) ([]byte, error)
- func (a *UsedSpaceAnnouncement) SetContainerID(cid *cid.ID)
- func (a *UsedSpaceAnnouncement) SetEpoch(epoch uint64)
- func (a *UsedSpaceAnnouncement) SetUsedSpace(value uint64)
- func (a *UsedSpaceAnnouncement) ToV2() *container.UsedSpaceAnnouncement
- func (a *UsedSpaceAnnouncement) Unmarshal(data []byte) error
- func (a *UsedSpaceAnnouncement) UsedSpace() uint64
Constants ¶
const ( // AttributeName is an attribute key that is commonly used to denote // human-friendly name. AttributeName = "Name" // AttributeTimestamp is an attribute key that is commonly used to denote // user-defined local time of container creation in Unix Timestamp format. AttributeTimestamp = "Timestamp" )
Variables ¶
var NewID = cid.New
NewID creates and initializes blank ID.
Works similar to NewIDFromV2(new(ContainerID)).
Deprecated: use cid.New instead.
var NewIDFromV2 = cid.NewFromV2
NewIDFromV2 wraps v2 ContainerID message to ID.
Deprecated: use cid.NewFromV2 instead.
Functions ¶
func CalculateID ¶
CalculateID calculates container identifier based on its structure.
Types ¶
type Attributes ¶
type Attributes []*Attribute
func NewAttributesFromV2 ¶
func NewAttributesFromV2(v []*container.Attribute) Attributes
func (Attributes) ToV2 ¶
func (a Attributes) ToV2() []*container.Attribute
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
func NewContainerFromV2 ¶
NewVerifiedFromV2 constructs Container from NeoFS API V2 Container message.
Does not perform if message meets NeoFS API V2 specification. To do this use NewVerifiedFromV2 constructor.
func NewVerifiedFromV2 ¶ added in v1.21.2
NewVerifiedFromV2 constructs Container from NeoFS API V2 Container message. Returns error if message does not meet NeoFS API V2 specification.
Additionally checks if message carries supported version.
func (*Container) Attributes ¶
func (c *Container) Attributes() Attributes
func (*Container) Marshal ¶
Marshal marshals Container into a protobuf binary form.
Buffer is allocated when the argument is empty. Otherwise, the first buffer is used.
func (*Container) MarshalJSON ¶
MarshalJSON encodes Container to protobuf JSON format.
func (*Container) NonceUUID ¶ added in v1.21.2
Returns container nonce in UUID format.
Returns error if container nonce is not a valid UUID.
func (*Container) PlacementPolicy ¶
func (c *Container) PlacementPolicy() *netmap.PlacementPolicy
func (Container) SessionToken ¶ added in v1.27.0
SessionToken returns token of the session within which container was created.
func (*Container) SetAttributes ¶
func (c *Container) SetAttributes(v Attributes)
func (*Container) SetBasicACL ¶
func (*Container) SetNonce
deprecated
func (*Container) SetNonceUUID ¶ added in v1.21.2
SetNonceUUID sets container nonce as UUID.
func (*Container) SetOwnerID ¶
func (*Container) SetPlacementPolicy ¶
func (c *Container) SetPlacementPolicy(v *netmap.PlacementPolicy)
func (*Container) SetSessionToken ¶ added in v1.27.0
SetSessionToken sets token of the session within which container was created.
func (*Container) SetSignature ¶ added in v1.27.0
SetSignature sets signature of the marshaled container.
func (*Container) SetVersion ¶
func (Container) Signature ¶ added in v1.27.0
Signature returns signature of the marshaled container.
func (*Container) UnmarshalJSON ¶
UnmarshalJSON decodes Container from protobuf JSON format.
type NewOption ¶
type NewOption interface {
// contains filtered or unexported methods
}
func WithAttribute ¶
func WithCustomBasicACL ¶
func WithNEO3Wallet ¶
func WithNEO3Wallet(w *owner.NEO3Wallet) NewOption
func WithOwnerID ¶
func WithPolicy ¶
func WithPolicy(policy *netmap.PlacementPolicy) NewOption
func WithPublicBasicACL ¶
func WithPublicBasicACL() NewOption
func WithReadOnlyBasicACL ¶
func WithReadOnlyBasicACL() NewOption
type UsedSpaceAnnouncement ¶ added in v1.23.0
type UsedSpaceAnnouncement container.UsedSpaceAnnouncement
UsedSpaceAnnouncement is an announcement message used by storage nodes to estimate actual container sizes.
func NewAnnouncement ¶ added in v1.23.0
func NewAnnouncement() *UsedSpaceAnnouncement
NewAnnouncement initialize empty UsedSpaceAnnouncement message.
func NewAnnouncementFromV2 ¶ added in v1.23.0
func NewAnnouncementFromV2(v *container.UsedSpaceAnnouncement) *UsedSpaceAnnouncement
NewAnnouncementFromV2 wraps protocol dependent version of UsedSpaceAnnouncement message.
func (*UsedSpaceAnnouncement) ContainerID ¶ added in v1.23.0
func (a *UsedSpaceAnnouncement) ContainerID() *cid.ID
ContainerID of the announcement.
func (*UsedSpaceAnnouncement) Epoch ¶ added in v1.23.0
func (a *UsedSpaceAnnouncement) Epoch() uint64
Epoch of the announcement.
func (*UsedSpaceAnnouncement) Marshal ¶ added in v1.23.0
func (a *UsedSpaceAnnouncement) Marshal(b ...[]byte) ([]byte, error)
Marshal marshals UsedSpaceAnnouncement into a protobuf binary form.
Buffer is allocated when the argument is empty. Otherwise, the first buffer is used.
func (*UsedSpaceAnnouncement) SetContainerID ¶ added in v1.23.0
func (a *UsedSpaceAnnouncement) SetContainerID(cid *cid.ID)
SetContainerID sets announcement container value.
func (*UsedSpaceAnnouncement) SetEpoch ¶ added in v1.23.0
func (a *UsedSpaceAnnouncement) SetEpoch(epoch uint64)
SetEpoch sets announcement epoch value.
func (*UsedSpaceAnnouncement) SetUsedSpace ¶ added in v1.23.0
func (a *UsedSpaceAnnouncement) SetUsedSpace(value uint64)
SetUsedSpace sets used space value by specified container.
func (*UsedSpaceAnnouncement) ToV2 ¶ added in v1.23.0
func (a *UsedSpaceAnnouncement) ToV2() *container.UsedSpaceAnnouncement
ToV2 returns protocol dependent version of UsedSpaceAnnouncement message.
func (*UsedSpaceAnnouncement) Unmarshal ¶ added in v1.23.0
func (a *UsedSpaceAnnouncement) Unmarshal(data []byte) error
Unmarshal unmarshals protobuf binary representation of UsedSpaceAnnouncement.
func (*UsedSpaceAnnouncement) UsedSpace ¶ added in v1.23.0
func (a *UsedSpaceAnnouncement) UsedSpace() uint64
UsedSpace in container.