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 CalculatePayloadChecksum(payload []byte) checksum.Checksum
- func CheckHeaderVerificationFields(obj *Object) error
- func CheckVerificationFields(obj *Object) error
- func InitCreation(dst *Object, rf RequiredFields)
- func ReadLock(l *Lock, 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 VerifyPayloadChecksum(obj *Object) error
- func WriteLock(obj *Object, l Lock)
- 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() (v cid.ID, isSet bool)
- func (o *Object) CreationEpoch() uint64
- func (o *Object) CutPayload() *Object
- func (o *Object) HasParent() bool
- func (o *Object) ID() (v oid.ID, isSet bool)
- 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() *user.ID
- func (o *Object) Parent() *Object
- func (o *Object) ParentID() (v oid.ID, isSet bool)
- func (o *Object) Payload() []byte
- func (o *Object) PayloadChecksum() (checksum.Checksum, bool)
- func (o *Object) PayloadHomomorphicHash() (checksum.Checksum, bool)
- func (o *Object) PayloadSize() uint64
- func (o *Object) PreviousID() (v oid.ID, isSet bool)
- func (o *Object) ResetRelations()
- func (o *Object) SessionToken() *session.Object
- 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 *user.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.Object)
- func (o *Object) SetSignature(v *neofscrypto.Signature)
- func (o *Object) SetSplitID(id *SplitID)
- func (o *Object) SetType(v Type)
- func (o *Object) SetVersion(v *version.Version)
- func (o *Object) Signature() *neofscrypto.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) VerifyIDSignature() bool
- func (o *Object) Version() *version.Version
- type Range
- type RawObjectdeprecated
- type RequiredFields
- 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 user.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() (v oid.ID, isSet bool)
- func (s SplitInfo) Link() (v oid.ID, isSet bool)
- func (s *SplitInfo) Marshal() ([]byte, error)
- func (s *SplitInfo) MarshalJSON() ([]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
- func (s *SplitInfo) UnmarshalJSON(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
CalculateAndSetSignature signs id with provided key and sets that signature to the object.
func CalculateID ¶
CalculateID calculates identifier for the object.
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 InitCreation ¶
func InitCreation(dst *Object, rf RequiredFields)
InitCreation initializes the object instance with minimum set of required fields. Object is expected (but not required) to be blank. Object must not be nil.
func ReadLock ¶
ReadLock reads Lock from the Object. The lock must not be nil. Returns an error describing incorrect format. Makes sense only if object has TypeLock type.
See also WriteLock.
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 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.
Lock instance can be written to the Object, see WriteLock/ReadLock.
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 in-memory structure of the NeoFS object. Type is compatible with NeoFS API V2 protocol.
Instance can be created depending on scenario:
- InitCreation (an object to be placed in container);
- New (blank instance, usually needed for decoding);
- NewFromV2 (when working under NeoFS API V2 protocol).
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 and bool that indicates checksum presence in the object.
Zero Object does not have payload checksum.
See also SetPayloadChecksum.
func (*Object) PayloadHomomorphicHash ¶
PayloadHomomorphicHash returns homomorphic hash of the object payload and bool that indicates checksum presence in the object.
Zero Object does not have payload homomorphic checksum.
See also SetPayloadHomomorphicHash.
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.
See also PayloadChecksum.
func (*Object) SetPayloadHomomorphicHash ¶
SetPayloadHomomorphicHash sets homomorphic hash of the object payload.
See also PayloadHomomorphicHash.
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 ¶
func (o *Object) SetSignature(v *neofscrypto.Signature)
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) Signature ¶
func (o *Object) Signature() *neofscrypto.Signature
Signature returns signature of the object identifier.
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.
func (*Object) VerifyIDSignature ¶
VerifyIDSignature verifies object ID signature.
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 RequiredFields ¶
type RequiredFields struct { // Identifier of the NeoFS container associated with the object. Container cid.ID // Object owner's user ID in the NeoFS system. Owner user.ID }
RequiredFields contains the minimum set of object data that must be set by the NeoFS user at the stage of creation.
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 user.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) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (*SplitInfo) SetLastPart ¶
func (*SplitInfo) SetSplitID ¶
func (*SplitInfo) ToV2 ¶
ToV2 converts SplitInfo to v2 SplitInfo message.
Nil SplitInfo converts to nil.
func (*SplitInfo) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
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.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package oid provides primitives to work with object identification in NeoFS.
|
Package oid provides primitives to work with object identification in NeoFS. |
test
Package oidtest provides functions for convenient testing of oid package API.
|
Package oidtest provides functions for convenient testing of oid package API. |