Documentation ¶
Index ¶
- Constants
- func CalculateID(c *Container) cid.ID
- func GetNativeNameWithZone(c *Container) (name string, zone string)
- func SetNativeName(c *Container, name string)
- func SetNativeNameWithZone(c *Container, name, zone string)
- type Attribute
- type Attributes
- type Container
- func (c *Container) Attributes() Attributes
- func (c *Container) BasicACL() uint32
- func (c *Container) Marshal() ([]byte, error)
- func (c *Container) MarshalJSON() ([]byte, error)
- func (c *Container) NonceUUID() (uuid.UUID, error)
- func (c *Container) OwnerID() *user.ID
- func (c *Container) PlacementPolicy() *netmap.PlacementPolicy
- func (c Container) SessionToken() *session.Container
- func (c *Container) SetAttributes(v Attributes)
- func (c *Container) SetBasicACL(v acl.BasicACL)
- func (c *Container) SetNonceUUID(v uuid.UUID)
- func (c *Container) SetOwnerID(v *user.ID)
- func (c *Container) SetPlacementPolicy(v *netmap.PlacementPolicy)
- func (c *Container) SetSessionToken(t *session.Container)
- func (c *Container) SetSignature(sig *neofscrypto.Signature)
- func (c *Container) SetVersion(v *version.Version)
- func (c Container) Signature() *neofscrypto.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() *version.Version
- type Option
- func WithAttribute(key, value string) Option
- func WithCustomBasicACL(acl acl.BasicACL) Option
- func WithNonce(nonce uuid.UUID) Option
- func WithOwnerID(id *user.ID) Option
- func WithOwnerPublicKey(pub *ecdsa.PublicKey) Option
- func WithPolicy(policy *netmap.PlacementPolicy) Option
- func WithPublicBasicACL() Option
- func WithReadOnlyBasicACL() Option
- type UsedSpaceAnnouncement
- func (a *UsedSpaceAnnouncement) ContainerID() (cID cid.ID, isSet bool)
- func (a *UsedSpaceAnnouncement) Epoch() uint64
- func (a *UsedSpaceAnnouncement) Marshal() ([]byte, error)
- func (a *UsedSpaceAnnouncement) SetContainerID(cnr 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 ¶
This section is empty.
Functions ¶
func CalculateID ¶
CalculateID calculates container identifier based on its structure.
func GetNativeNameWithZone ¶
GetNativeNameWithZone returns container native name and its zone.
func SetNativeName ¶
SetNativeName sets container native name with default zone (container).
func SetNativeNameWithZone ¶
SetNativeNameWithZone sets container native name and its zone.
Use SetNativeName to set default zone.
Types ¶
type Attribute ¶
func NewAttribute ¶
func NewAttribute() *Attribute
NewAttribute creates and initializes blank Attribute.
Defaults:
- key: "";
- value: "".
func NewAttributeFromV2 ¶
NewAttributeFromV2 wraps protocol dependent version of Attribute message.
Nil container.Attribute converts to nil.
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 New ¶
New creates, initializes and returns blank Container instance.
Defaults:
- token: nil;
- sig: nil;
- basicACL: acl.PrivateBasicRule;
- version: version.Current;
- nonce: random UUID;
- attr: nil;
- policy: nil;
- ownerID: nil.
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 (*Container) Attributes ¶
func (c *Container) Attributes() Attributes
func (*Container) MarshalJSON ¶
MarshalJSON encodes Container to protobuf JSON format.
func (*Container) NonceUUID ¶
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 ¶
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) SetNonceUUID ¶
SetNonceUUID sets container nonce as UUID.
func (*Container) SetOwnerID ¶
func (*Container) SetPlacementPolicy ¶
func (c *Container) SetPlacementPolicy(v *netmap.PlacementPolicy)
func (*Container) SetSessionToken ¶
SetSessionToken sets token of the session within which container was created.
func (*Container) SetSignature ¶
func (c *Container) SetSignature(sig *neofscrypto.Signature)
SetSignature sets signature of the marshaled container.
func (*Container) SetVersion ¶
func (Container) Signature ¶
func (c Container) Signature() *neofscrypto.Signature
Signature returns signature of the marshaled container.
func (*Container) UnmarshalJSON ¶
UnmarshalJSON decodes Container from protobuf JSON format.
type Option ¶
type Option func(*containerOptions)
func WithAttribute ¶
func WithCustomBasicACL ¶
func WithOwnerID ¶
func WithOwnerPublicKey ¶
func WithPolicy ¶
func WithPolicy(policy *netmap.PlacementPolicy) Option
func WithPublicBasicACL ¶
func WithPublicBasicACL() Option
func WithReadOnlyBasicACL ¶
func WithReadOnlyBasicACL() Option
type UsedSpaceAnnouncement ¶
type UsedSpaceAnnouncement container.UsedSpaceAnnouncement
UsedSpaceAnnouncement is an announcement message used by storage nodes to estimate actual container sizes.
func NewAnnouncement ¶
func NewAnnouncement() *UsedSpaceAnnouncement
NewAnnouncement initialize empty UsedSpaceAnnouncement message.
Defaults:
- epoch: 0;
- usedSpace: 0;
- cid: nil.
func NewAnnouncementFromV2 ¶
func NewAnnouncementFromV2(v *container.UsedSpaceAnnouncement) *UsedSpaceAnnouncement
NewAnnouncementFromV2 wraps protocol dependent version of UsedSpaceAnnouncement message.
Nil container.UsedSpaceAnnouncement converts to nil.
func (*UsedSpaceAnnouncement) ContainerID ¶
func (a *UsedSpaceAnnouncement) ContainerID() (cID cid.ID, isSet bool)
ContainerID of the announcement.
func (*UsedSpaceAnnouncement) Epoch ¶
func (a *UsedSpaceAnnouncement) Epoch() uint64
Epoch of the announcement.
func (*UsedSpaceAnnouncement) Marshal ¶
func (a *UsedSpaceAnnouncement) Marshal() ([]byte, error)
Marshal marshals UsedSpaceAnnouncement into a protobuf binary form.
func (*UsedSpaceAnnouncement) SetContainerID ¶
func (a *UsedSpaceAnnouncement) SetContainerID(cnr cid.ID)
SetContainerID sets announcement container value.
func (*UsedSpaceAnnouncement) SetEpoch ¶
func (a *UsedSpaceAnnouncement) SetEpoch(epoch uint64)
SetEpoch sets announcement epoch value.
func (*UsedSpaceAnnouncement) SetUsedSpace ¶
func (a *UsedSpaceAnnouncement) SetUsedSpace(value uint64)
SetUsedSpace sets used space value by specified container.
func (*UsedSpaceAnnouncement) ToV2 ¶
func (a *UsedSpaceAnnouncement) ToV2() *container.UsedSpaceAnnouncement
ToV2 returns protocol dependent version of UsedSpaceAnnouncement message.
Nil UsedSpaceAnnouncement converts to nil.
func (*UsedSpaceAnnouncement) Unmarshal ¶
func (a *UsedSpaceAnnouncement) Unmarshal(data []byte) error
Unmarshal unmarshals protobuf binary representation of UsedSpaceAnnouncement.
func (*UsedSpaceAnnouncement) UsedSpace ¶
func (a *UsedSpaceAnnouncement) UsedSpace() uint64
UsedSpace in container.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package cid provides primitives to work with container identification in NeoFS.
|
Package cid provides primitives to work with container identification in NeoFS. |
test
Package cidtest provides functions for convenient testing of cid package API.
|
Package cidtest provides functions for convenient testing of cid package API. |