Documentation
¶
Index ¶
- Constants
- func CalculateAndSetID(obj *Object) error
- func CalculateAndSetPayloadChecksum(obj *Object)
- func CalculateAndSetSignature(key *ecdsa.PrivateKey, obj *Object) error
- func CalculateID(obj *Object) (*oid.ID, error)
- func CalculateIDSignature(key *ecdsa.PrivateKey, id *oid.ID) (*signature.Signature, error)
- func CalculatePayloadChecksum(payload []byte) *checksum.Checksum
- func CheckHeaderVerificationFields(obj *Object) error
- func CheckVerificationFields(obj *Object) error
- func SetIDWithSignature(key *ecdsa.PrivateKey, obj *Object) error
- func SetVerificationFields(key *ecdsa.PrivateKey, obj *Object) error
- func VerifyID(obj *Object) error
- func VerifyIDSignature(obj *Object) error
- func VerifyPayloadChecksum(obj *Object) error
- type Attribute
- func (a *Attribute) Key() string
- func (a *Attribute) Marshal() ([]byte, error)
- func (a *Attribute) MarshalJSON() ([]byte, error)
- func (a *Attribute) SetKey(v string)
- func (a *Attribute) SetValue(v string)
- func (a *Attribute) ToV2() *object.Attribute
- func (a *Attribute) Unmarshal(data []byte) error
- func (a *Attribute) UnmarshalJSON(data []byte) error
- func (a *Attribute) Value() string
- type Lock
- type NotificationInfo
- type Object
- func (o *Object) Attributes() []*Attribute
- func (o *Object) Children() []*oid.ID
- func (o *Object) ContainerID() *cid.ID
- func (o *Object) CreationEpoch() uint64
- func (o *Object) CutPayload() *Object
- func (o *Object) HasParent() bool
- func (o *Object) ID() *oid.ID
- func (o *Object) InitRelations()
- func (o *Object) Marshal() ([]byte, error)
- func (o *Object) MarshalHeaderJSON() ([]byte, error)
- func (o *Object) MarshalJSON() ([]byte, error)
- func (o *Object) NotificationInfo() (*NotificationInfo, error)
- func (o *Object) Object() *Objectdeprecated
- func (o *Object) OwnerID() *owner.ID
- func (o *Object) Parent() *Object
- func (o *Object) ParentID() *oid.ID
- func (o *Object) Payload() []byte
- func (o *Object) PayloadChecksum() *checksum.Checksum
- func (o *Object) PayloadHomomorphicHash() *checksum.Checksum
- func (o *Object) PayloadSize() uint64
- func (o *Object) PreviousID() *oid.ID
- func (o *Object) ResetRelations()
- func (o *Object) SessionToken() *session.Token
- func (o *Object) SetAttributes(v ...*Attribute)
- func (o *Object) SetChildren(v ...*oid.ID)
- func (o *Object) SetContainerID(v *cid.ID)
- func (o *Object) SetCreationEpoch(v uint64)
- func (o *Object) SetID(v *oid.ID)
- func (o *Object) SetNotification(ni NotificationInfo)
- func (o *Object) SetOwnerID(v *owner.ID)
- func (o *Object) SetParent(v *Object)
- func (o *Object) SetParentID(v *oid.ID)
- func (o *Object) SetPayload(v []byte)
- func (o *Object) SetPayloadChecksum(v *checksum.Checksum)
- func (o *Object) SetPayloadHomomorphicHash(v *checksum.Checksum)
- func (o *Object) SetPayloadSize(v uint64)
- func (o *Object) SetPreviousID(v *oid.ID)
- func (o *Object) SetSessionToken(v *session.Token)
- func (o *Object) SetSignature(v *signature.Signature)
- func (o *Object) SetSplitID(id *SplitID)
- func (o *Object) SetType(v Type)
- func (o *Object) SetVersion(v *version.Version)
- func (o *Object) Signature() *signature.Signature
- func (o *Object) SplitID() *SplitID
- func (o *Object) ToV2() *object.Object
- func (o *Object) Type() Type
- func (o *Object) Unmarshal(data []byte) error
- func (o *Object) UnmarshalJSON(data []byte) error
- func (o *Object) Version() *version.Version
- type Range
- type RawObjectdeprecated
- type SearchFilter
- type SearchFilters
- func (f *SearchFilters) AddFilter(header, value string, op SearchMatchType)
- func (f *SearchFilters) AddNotificationEpochFilter(epoch uint64)
- func (f *SearchFilters) AddObjectContainerIDFilter(m SearchMatchType, id *cid.ID)
- func (f *SearchFilters) AddObjectIDFilter(m SearchMatchType, id *oid.ID)
- func (f *SearchFilters) AddObjectOwnerIDFilter(m SearchMatchType, id *owner.ID)
- func (f *SearchFilters) AddObjectVersionFilter(op SearchMatchType, v *version.Version)
- func (f *SearchFilters) AddParentIDFilter(m SearchMatchType, id *oid.ID)
- func (f *SearchFilters) AddPhyFilter()
- func (f *SearchFilters) AddRootFilter()
- func (f *SearchFilters) AddSplitIDFilter(m SearchMatchType, id *SplitID)
- func (f *SearchFilters) AddTypeFilter(m SearchMatchType, typ Type)
- func (f *SearchFilters) MarshalJSON() ([]byte, error)
- func (f SearchFilters) ToV2() []*v2object.SearchFilter
- func (f *SearchFilters) UnmarshalJSON(data []byte) error
- type SearchMatchType
- type SplitID
- type SplitInfo
- func (s *SplitInfo) LastPart() *oid.ID
- func (s *SplitInfo) Link() *oid.ID
- func (s *SplitInfo) Marshal() ([]byte, error)
- func (s *SplitInfo) SetLastPart(v *oid.ID)
- func (s *SplitInfo) SetLink(v *oid.ID)
- func (s *SplitInfo) SetSplitID(v *SplitID)
- func (s *SplitInfo) SplitID() *SplitID
- func (s *SplitInfo) ToV2() *object.SplitInfo
- func (s *SplitInfo) Unmarshal(data []byte) error
- type SplitInfoError
- type Tombstone
- func (t *Tombstone) ExpirationEpoch() uint64
- func (t *Tombstone) Marshal() ([]byte, error)
- func (t *Tombstone) MarshalJSON() ([]byte, error)
- func (t *Tombstone) Members() []*oid.ID
- func (t *Tombstone) SetExpirationEpoch(v uint64)
- func (t *Tombstone) SetMembers(v []*oid.ID)
- func (t *Tombstone) SetSplitID(v *SplitID)
- func (t *Tombstone) SplitID() *SplitID
- func (t *Tombstone) ToV2() *tombstone.Tombstone
- func (t *Tombstone) Unmarshal(data []byte) error
- func (t *Tombstone) UnmarshalJSON(data []byte) error
- type Type
Constants ¶
const ( // AttributeName is an attribute key that is commonly used to denote // human-friendly name. AttributeName = "Name" // AttributeFileName is an attribute key that is commonly used to denote // file name to be associated with the object on saving. AttributeFileName = "FileName" // AttributeTimestamp is an attribute key that is commonly used to denote // user-defined local time of object creation in Unix Timestamp format. AttributeTimestamp = "Timestamp" // AttributeContentType is an attribute key that is commonly used to denote // MIME Content Type of object's payload. AttributeContentType = "Content-Type" )
Variables ¶
This section is empty.
Functions ¶
func CalculateAndSetID ¶
CalculateAndSetID calculates identifier for the object and writes the result to it.
func CalculateAndSetPayloadChecksum ¶
func CalculateAndSetPayloadChecksum(obj *Object)
CalculateAndSetPayloadChecksum calculates checksum of current object payload and writes it to the object.
func CalculateAndSetSignature ¶
func CalculateAndSetSignature(key *ecdsa.PrivateKey, obj *Object) error
func CalculateID ¶
CalculateID calculates identifier for the object.
func CalculateIDSignature ¶
func CalculatePayloadChecksum ¶
CalculatePayloadChecksum calculates and returns checksum of object payload bytes.
func CheckHeaderVerificationFields ¶
CheckHeaderVerificationFields checks all verification fields except payload.
func CheckVerificationFields ¶
CheckVerificationFields checks all verification fields of the object.
func SetIDWithSignature ¶
func SetIDWithSignature(key *ecdsa.PrivateKey, obj *Object) error
SetIDWithSignature sets object identifier and signature.
func SetVerificationFields ¶
func SetVerificationFields(key *ecdsa.PrivateKey, obj *Object) error
SetVerificationFields calculates and sets all verification fields of the object.
func VerifyIDSignature ¶
func VerifyPayloadChecksum ¶
VerifyPayloadChecksum checks if payload checksum in the object corresponds to its payload.
Types ¶
type Attribute ¶
Attribute represents v2-compatible object attribute.
func NewAttribute ¶
func NewAttribute() *Attribute
NewAttribute creates and initializes blank Attribute.
Works similar as NewAttributeFromV2(new(Attribute)).
Defaults:
- key: "";
- value: "".
func NewAttributeFromV2 ¶
NewAttributeFromV2 wraps v2 Attribute message to Attribute.
Nil object.Attribute converts to nil.
func (*Attribute) MarshalJSON ¶
MarshalJSON encodes Attribute to protobuf JSON format.
func (*Attribute) ToV2 ¶
ToV2 converts Attribute to v2 Attribute message.
Nil Attribute converts to nil.
func (*Attribute) UnmarshalJSON ¶
UnmarshalJSON decodes Attribute from protobuf JSON format.
type Lock ¶
Lock represents record with locked objects. It is compatible with NeoFS API V2 protocol.
func (Lock) NumberOfMembers ¶
NumberOfMembers returns number of members in lock list.
func (Lock) ReadMembers ¶
ReadMembers reads list of locked members.
Buffer length must not be less than NumberOfMembers.
func (*Lock) WriteMembers ¶
WriteMembers writes list of locked members.
type NotificationInfo ¶
type NotificationInfo struct {
// contains filtered or unexported fields
}
NotificationInfo groups information about object notification that can be written to object.
Topic is an optional field.
func (NotificationInfo) Epoch ¶
func (n NotificationInfo) Epoch() uint64
Epoch returns object notification tick epoch.
func (*NotificationInfo) SetEpoch ¶
func (n *NotificationInfo) SetEpoch(epoch uint64)
SetEpoch sets object notification tick epoch.
func (*NotificationInfo) SetTopic ¶
func (n *NotificationInfo) SetTopic(topic string)
SetTopic sets optional object notification topic.
func (NotificationInfo) Topic ¶
func (n NotificationInfo) Topic() string
Topic return optional object notification topic.
type Object ¶
Object represents v2-compatible NeoFS object that provides a convenient interface for working in isolation from the internal structure of an object.
func New ¶
func New() *Object
New creates and initializes blank Object.
Works similar as NewFromV2(new(Object)).
func NewRawFrom
deprecated
func NewRawFromV2
deprecated
func (*Object) Attributes ¶
Attributes returns object attributes.
func (*Object) ContainerID ¶
ContainerID returns identifier of the related container.
func (*Object) CreationEpoch ¶
CreationEpoch returns epoch number in which object was created.
func (*Object) CutPayload ¶
CutPayload returns Object w/ empty payload.
Changes of non-payload fields affect source object.
func (*Object) InitRelations ¶
func (o *Object) InitRelations()
InitRelations initializes relation field.
func (*Object) MarshalHeaderJSON ¶
MarshalHeaderJSON marshals object's header into JSON format.
func (*Object) MarshalJSON ¶
MarshalJSON encodes object to protobuf JSON format.
func (*Object) NotificationInfo ¶
func (o *Object) NotificationInfo() (*NotificationInfo, error)
NotificationInfo returns notification info read from the object structure. Returns any error that appeared during notification information parsing.
func (*Object) PayloadChecksum ¶
PayloadChecksum returns checksum of the object payload.
func (*Object) PayloadHomomorphicHash ¶
PayloadHomomorphicHash returns homomorphic hash of the object payload.
func (*Object) PayloadSize ¶
PayloadSize returns payload length of the object.
func (*Object) PreviousID ¶
PreviousID returns identifier of the previous sibling object.
func (*Object) ResetRelations ¶
func (o *Object) ResetRelations()
ResetRelations removes all fields of links with other objects.
func (*Object) SessionToken ¶
SessionToken returns token of the session within which object was created.
func (*Object) SetAttributes ¶
SetAttributes sets object attributes.
func (*Object) SetChildren ¶
SetChildren sets list of the identifiers of the child objects.
func (*Object) SetContainerID ¶
SetContainerID sets identifier of the related container.
func (*Object) SetCreationEpoch ¶
SetCreationEpoch sets epoch number in which object was created.
func (*Object) SetNotification ¶
func (o *Object) SetNotification(ni NotificationInfo)
SetNotification writes NotificationInfo to the object structure.
func (*Object) SetOwnerID ¶
SetOwnerID sets identifier of the object owner.
func (*Object) SetParentID ¶
SetParentID sets identifier of the parent object.
func (*Object) SetPayloadChecksum ¶
SetPayloadChecksum sets checksum of the object payload.
func (*Object) SetPayloadHomomorphicHash ¶
SetPayloadHomomorphicHash sets homomorphic hash of the object payload.
func (*Object) SetPayloadSize ¶
SetPayloadSize sets payload length of the object.
func (*Object) SetPreviousID ¶
SetPreviousID sets identifier of the previous sibling object.
func (*Object) SetSessionToken ¶
SetSessionToken sets token of the session within which object was created.
func (*Object) SetSignature ¶
SetSignature sets signature of the object identifier.
func (*Object) SetSplitID ¶
SetSplitID sets split identifier for the split object.
func (*Object) SetVersion ¶
SetVersion sets version of the object.
func (*Object) SplitID ¶
SplitID return split identity of split object. If object is not split returns nil.
func (*Object) UnmarshalJSON ¶
UnmarshalJSON decodes object from protobuf JSON format.
type Range ¶
Range represents v2-compatible object payload range.
func NewRange ¶
func NewRange() *Range
NewRange creates and initializes blank Range.
Defaults:
- offset: 0;
- length: 0.
func NewRangeFromV2 ¶
NewRangeFromV2 wraps v2 Range message to Range.
Nil object.Range converts to nil.
type SearchFilter ¶
type SearchFilter struct {
// contains filtered or unexported fields
}
func (*SearchFilter) Header ¶
func (f *SearchFilter) Header() string
func (*SearchFilter) Operation ¶
func (f *SearchFilter) Operation() SearchMatchType
func (*SearchFilter) Value ¶
func (f *SearchFilter) Value() string
type SearchFilters ¶
type SearchFilters []SearchFilter
func NewSearchFilters ¶
func NewSearchFilters() SearchFilters
func NewSearchFiltersFromV2 ¶
func NewSearchFiltersFromV2(v2 []*v2object.SearchFilter) SearchFilters
func (*SearchFilters) AddFilter ¶
func (f *SearchFilters) AddFilter(header, value string, op SearchMatchType)
func (*SearchFilters) AddNotificationEpochFilter ¶
func (f *SearchFilters) AddNotificationEpochFilter(epoch uint64)
func (*SearchFilters) AddObjectContainerIDFilter ¶
func (f *SearchFilters) AddObjectContainerIDFilter(m SearchMatchType, id *cid.ID)
func (*SearchFilters) AddObjectIDFilter ¶
func (f *SearchFilters) AddObjectIDFilter(m SearchMatchType, id *oid.ID)
AddObjectIDFilter adds filter by object identifier.
func (*SearchFilters) AddObjectOwnerIDFilter ¶
func (f *SearchFilters) AddObjectOwnerIDFilter(m SearchMatchType, id *owner.ID)
func (*SearchFilters) AddObjectVersionFilter ¶
func (f *SearchFilters) AddObjectVersionFilter(op SearchMatchType, v *version.Version)
func (*SearchFilters) AddParentIDFilter ¶
func (f *SearchFilters) AddParentIDFilter(m SearchMatchType, id *oid.ID)
AddParentIDFilter adds filter by parent identifier.
func (*SearchFilters) AddPhyFilter ¶
func (f *SearchFilters) AddPhyFilter()
func (*SearchFilters) AddRootFilter ¶
func (f *SearchFilters) AddRootFilter()
func (*SearchFilters) AddSplitIDFilter ¶
func (f *SearchFilters) AddSplitIDFilter(m SearchMatchType, id *SplitID)
func (*SearchFilters) AddTypeFilter ¶
func (f *SearchFilters) AddTypeFilter(m SearchMatchType, typ Type)
AddTypeFilter adds filter by object type.
func (*SearchFilters) MarshalJSON ¶
func (f *SearchFilters) MarshalJSON() ([]byte, error)
MarshalJSON encodes SearchFilters to protobuf JSON format.
func (SearchFilters) ToV2 ¶
func (f SearchFilters) ToV2() []*v2object.SearchFilter
func (*SearchFilters) UnmarshalJSON ¶
func (f *SearchFilters) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes SearchFilters from protobuf JSON format.
type SearchMatchType ¶
type SearchMatchType uint32
SearchMatchType indicates match operation on specified header.
const ( MatchUnknown SearchMatchType = iota MatchStringEqual MatchStringNotEqual MatchNotPresent MatchCommonPrefix )
func SearchMatchFromV2 ¶
func SearchMatchFromV2(t v2object.MatchType) (m SearchMatchType)
func (*SearchMatchType) FromString ¶
func (m *SearchMatchType) FromString(s string) bool
FromString parses SearchMatchType from a string representation. It is a reverse action to String().
Returns true if s was parsed successfully.
func (SearchMatchType) String ¶
func (m SearchMatchType) String() string
String returns string representation of SearchMatchType.
String mapping:
- MatchStringEqual: STRING_EQUAL;
- MatchStringNotEqual: STRING_NOT_EQUAL;
- MatchNotPresent: NOT_PRESENT;
- MatchCommonPrefix: COMMON_PREFIX;
- MatchUnknown, default: MATCH_TYPE_UNSPECIFIED.
func (SearchMatchType) ToV2 ¶
func (m SearchMatchType) ToV2() v2object.MatchType
type SplitID ¶
type SplitID struct {
// contains filtered or unexported fields
}
SplitID is a UUIDv4 used as attribute in split objects.
func NewSplitID ¶
func NewSplitID() *SplitID
NewSplitID returns UUID representation of splitID attribute.
Defaults:
- id: random UUID.
func NewSplitIDFromV2 ¶
NewSplitIDFromV2 returns parsed UUID from bytes. If v is invalid UUIDv4 byte sequence, then function returns nil.
Nil converts to nil.
type SplitInfo ¶
func NewSplitInfo ¶
func NewSplitInfo() *SplitInfo
NewSplitInfo creates and initializes blank SplitInfo.
Defaults:
- splitID: nil;
- lastPart nil;
- link: nil.
func NewSplitInfoFromV2 ¶
NewSplitInfoFromV2 wraps v2 SplitInfo message to SplitInfo.
Nil object.SplitInfo converts to nil.
func (*SplitInfo) SetLastPart ¶
func (*SplitInfo) SetSplitID ¶
type SplitInfoError ¶
type SplitInfoError struct {
// contains filtered or unexported fields
}
func NewSplitInfoError ¶
func NewSplitInfoError(v *SplitInfo) *SplitInfoError
func (*SplitInfoError) Error ¶
func (s *SplitInfoError) Error() string
func (*SplitInfoError) SplitInfo ¶
func (s *SplitInfoError) SplitInfo() *SplitInfo
type Tombstone ¶
Tombstone represents v2-compatible tombstone structure.
func NewTombstone ¶
func NewTombstone() *Tombstone
NewTombstone creates and initializes blank Tombstone.
Defaults:
- exp: 0;
- splitID: nil;
- members: nil.
func NewTombstoneFromV2 ¶
NewTombstoneFromV2 wraps v2 Tombstone message to Tombstone.
Nil tombstone.Tombstone converts to nil.
func (*Tombstone) ExpirationEpoch ¶
ExpirationEpoch return number of tombstone expiration epoch.
func (*Tombstone) MarshalJSON ¶
MarshalJSON encodes Tombstone to protobuf JSON format.
func (*Tombstone) SetExpirationEpoch ¶
SetExpirationEpoch sets number of tombstone expiration epoch.
func (*Tombstone) SetMembers ¶
SetMembers sets list of objects to be deleted.
func (*Tombstone) SetSplitID ¶
SetSplitID sets identifier of object split hierarchy.
func (*Tombstone) ToV2 ¶
ToV2 converts Tombstone to v2 Tombstone message.
Nil Tombstone converts to nil.
func (*Tombstone) UnmarshalJSON ¶
UnmarshalJSON decodes Tombstone from protobuf JSON format.
type Type ¶
func TypeFromV2 ¶
func (*Type) FromString ¶
FromString parses Type from a string representation. It is a reverse action to String().
Returns true if s was parsed successfully.