Documentation ¶
Index ¶
- Constants
- func CalculatePayloadChecksum(payload []byte) checksum.Checksum
- 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) CalculateAndSetID() error
- func (o *Object) CalculateAndSetPayloadChecksum()
- func (o *Object) CalculateID() (oid.ID, error)
- func (o *Object) CheckHeaderVerificationFields() error
- func (o *Object) CheckVerificationFields() error
- func (o *Object) Children() []oid.ID
- func (o *Object) ContainerID() (v cid.ID, isSet bool)
- func (o Object) CopyTo(dst *Object)
- 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) InitCreation(rf RequiredFields)
- 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) 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) ReadLock(l *Lock) error
- func (o *Object) ResetID()
- func (o *Object) ResetParentID()
- func (o *Object) ResetPreviousID()
- 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) SetIDWithSignature(signer neofscrypto.Signer) error
- 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) SetVerificationFields(signer neofscrypto.Signer) error
- func (o *Object) SetVersion(v *version.Version)
- func (o *Object) Sign(signer neofscrypto.Signer) error
- func (o *Object) Signature() *neofscrypto.Signature
- func (o *Object) SignedData() []byte
- 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) UserAttributes() []Attribute
- func (o *Object) VerifyID() error
- func (o *Object) VerifyPayloadChecksum() error
- func (o *Object) VerifySignature() bool
- func (o *Object) Version() *version.Version
- func (o *Object) WriteLock(l Lock)
- type Range
- type RequiredFields
- type SearchFilter
- type SearchFilters
- func (f *SearchFilters) AddCreationEpochFilter(m SearchMatchType, epoch uint64)
- func (f *SearchFilters) AddFilter(key, value string, op SearchMatchType)
- func (f *SearchFilters) AddHomomorphicHashFilter(m SearchMatchType, sum [tz.Size]byte)
- 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) AddPayloadHashFilter(m SearchMatchType, sum [sha256.Size]byte)
- func (f *SearchFilters) AddPayloadSizeFilter(m SearchMatchType, size uint64)
- 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
Examples ¶
Constants ¶
const ( FilterVersion = v2object.FilterHeaderVersion FilterID = v2object.FilterHeaderObjectID FilterContainerID = v2object.FilterHeaderContainerID FilterOwnerID = v2object.FilterHeaderOwnerID FilterPayloadChecksum = v2object.FilterHeaderPayloadHash FilterType = v2object.FilterHeaderObjectType FilterPayloadHomomorphicHash = v2object.FilterHeaderHomomorphicHash FilterParentID = v2object.FilterHeaderParent FilterSplitID = v2object.FilterHeaderSplitID FilterCreationEpoch = v2object.FilterHeaderCreationEpoch FilterPayloadSize = v2object.FilterHeaderPayloadLength )
Various header filters.
const ( // FilterRoot filters objects that are root: objects of TypeRegular type // with user data that are not system-specific. In addition to such objects, the // system may contain service objects that do not fall under this property // (like split leaves, tombstones, storage groups, etc.). FilterRoot = v2object.FilterPropertyRoot // FilterPhysical filters indivisible objects that are intended to be stored // on the physical devices of the system. In addition to such objects, the // system may contain so-called "virtual" objects that exist in the system in // disassembled form (like "huge" user object sliced into smaller ones). FilterPhysical = v2object.FilterPropertyPhy )
Various filters to match certain object properties.
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" // AttributeFilePath is an attribute key that is commonly used to denote // full path to be associated with the object on saving. Should start with a // '/' and use '/' as a delimiting symbol. Trailing '/' should be // interpreted as a virtual directory marker. If an object has conflicting // FilePath and FileName, FilePath should have higher priority, because it // is used to construct the directory tree. FilePath with trailing '/' and // non-empty FileName attribute should not be used together. AttributeFilePath = "FilePath" // 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" )
const ( // AttributeExpirationEpoch is a key to an object attribute that determines // after what epoch the object becomes expired. Objects that do not have this // attribute never expire. // // Reaction of NeoFS system components to the objects' 'expired' property may // vary. For example, in the basic scenario, expired objects are auto-deleted // from the storage. Detailed behavior can be found in the NeoFS Specification. // // Note that the value determines exactly the last epoch of the object's // relevance: for example, with the value N, the object is relevant in epoch N // and expired in any epoch starting from N+1. AttributeExpirationEpoch = object.SysAttributeExpEpoch )
Various system attributes.
Variables ¶
This section is empty.
Functions ¶
func CalculatePayloadChecksum ¶
CalculatePayloadChecksum calculates and returns checksum of object payload bytes.
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 object.Attribute message to Attribute.
Nil object.Attribute converts to nil.
func (*Attribute) Marshal ¶
Marshal marshals Attribute into a protobuf binary form.
See also Attribute.Unmarshal.
func (*Attribute) MarshalJSON ¶
MarshalJSON encodes Attribute to protobuf JSON format.
See also Attribute.UnmarshalJSON.
func (*Attribute) ToV2 ¶
ToV2 converts Attribute to v2 object.Attribute message.
Nil Attribute converts to nil.
The value returned shares memory with the structure itself, so changing it can lead to data corruption. Make a copy if you need to change it.
func (*Attribute) Unmarshal ¶
Unmarshal unmarshals protobuf binary representation of Attribute.
See also Attribute.Marshal.
func (*Attribute) UnmarshalJSON ¶
UnmarshalJSON decodes Attribute from protobuf JSON format.
See also Attribute.MarshalJSON.
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) Marshal ¶
Marshal encodes the Lock into a NeoFS protocol binary format.
See also Lock.Unmarshal.
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 Lock.NumberOfMembers.
func (*Lock) Unmarshal ¶
Unmarshal decodes the Lock from its NeoFS protocol binary representation.
See also Lock.Marshal.
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.
See also NotificationInfo.SetEpoch.
func (*NotificationInfo) SetEpoch ¶
func (n *NotificationInfo) SetEpoch(epoch uint64)
SetEpoch sets object notification tick epoch.
See also NotificationInfo.Epoch.
func (*NotificationInfo) SetTopic ¶
func (n *NotificationInfo) SetTopic(topic string)
SetTopic sets optional object notification topic.
See also NotificationInfo.Topic.
func (NotificationInfo) Topic ¶
func (n NotificationInfo) Topic() string
Topic return optional object notification topic.
See also NotificationInfo.SetTopic.
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:
- Object.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 NewFromV2 ¶
NewFromV2 wraps v2 object.Object message to Object.
func (*Object) Attributes ¶
Attributes returns all object attributes.
The value returned shares memory with the structure itself, so changing it can lead to data corruption. Make a copy if you need to change it.
See also Object.SetAttributes, Object.UserAttributes.
func (*Object) CalculateAndSetID ¶
CalculateAndSetID calculates identifier for the object and writes the result to it.
func (*Object) CalculateAndSetPayloadChecksum ¶
func (o *Object) CalculateAndSetPayloadChecksum()
CalculateAndSetPayloadChecksum calculates checksum of current object payload and writes it to the object.
func (*Object) CalculateID ¶
CalculateID calculates identifier for the object.
func (*Object) CheckHeaderVerificationFields ¶
CheckHeaderVerificationFields checks all verification fields except payload.
func (*Object) CheckVerificationFields ¶
CheckVerificationFields checks all verification fields of the object.
func (*Object) Children ¶
Children return list of the identifiers of the child objects.
See also Object.SetChildren.
func (*Object) ContainerID ¶
ContainerID returns identifier of the related container.
See also Object.SetContainerID.
func (*Object) CreationEpoch ¶
CreationEpoch returns epoch number in which object was created.
See also Object.SetCreationEpoch.
func (*Object) CutPayload ¶
CutPayload returns Object w/ empty payload.
The value returned shares memory with the structure itself, so changing it can lead to data corruption. Make a copy if you need to change it.
func (*Object) InitCreation ¶
func (o *Object) InitCreation(rf RequiredFields)
InitCreation initializes the object instance with minimum set of required fields.
func (*Object) InitRelations ¶
func (o *Object) InitRelations()
InitRelations initializes relation field.
func (*Object) Marshal ¶
Marshal marshals object into a protobuf binary form.
See also Object.Unmarshal.
func (*Object) MarshalHeaderJSON ¶
MarshalHeaderJSON marshals object's header into JSON format.
func (*Object) MarshalJSON ¶
MarshalJSON encodes object to protobuf JSON format.
See also Object.UnmarshalJSON.
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.
See also Object.SetNotification.
func (*Object) OwnerID ¶
OwnerID returns identifier of the object owner.
See also Object.SetOwnerID.
func (*Object) ParentID ¶
ParentID returns identifier of the parent object.
See also Object.SetParentID.
func (*Object) Payload ¶
Payload returns payload bytes.
The value returned shares memory with the structure itself, so changing it can lead to data corruption. Make a copy if you need to change it.
See also Object.SetPayload.
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 Object.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 Object.SetPayloadHomomorphicHash.
func (*Object) PayloadSize ¶
PayloadSize returns payload length of the object.
See also Object.SetPayloadSize.
func (*Object) PreviousID ¶
PreviousID returns identifier of the previous sibling object.
See also Object.SetPreviousID.
func (*Object) 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 Object.WriteLock.
func (*Object) ResetID ¶
func (o *Object) ResetID()
ResetID removes object identifier.
See also Object.SetID.
func (*Object) ResetParentID ¶
func (o *Object) ResetParentID()
ResetParentID removes identifier of the parent object.
See also Object.SetParentID.
func (*Object) ResetPreviousID ¶
func (o *Object) ResetPreviousID()
ResetPreviousID resets identifier of the previous sibling object.
See also Object.SetPreviousID, Object.PreviousID.
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.
See also Object.SetSessionToken.
func (*Object) SetAttributes ¶
SetAttributes sets object attributes.
func (*Object) SetChildren ¶
SetChildren sets list of the identifiers of the child objects.
See also Object.Children.
func (*Object) SetContainerID ¶
SetContainerID sets identifier of the related container.
See also Object.ContainerID.
func (*Object) SetCreationEpoch ¶
SetCreationEpoch sets epoch number in which object was created.
See also Object.CreationEpoch.
func (*Object) SetIDWithSignature ¶
func (o *Object) SetIDWithSignature(signer neofscrypto.Signer) error
SetIDWithSignature sets object identifier and signature.
func (*Object) SetNotification ¶
func (o *Object) SetNotification(ni NotificationInfo)
SetNotification writes NotificationInfo to the object structure.
See also Object.NotificationInfo.
func (*Object) SetOwnerID ¶
SetOwnerID sets identifier of the object owner.
See also Object.OwnerID.
func (*Object) SetParentID ¶
SetParentID sets identifier of the parent object.
See also Object.ParentID.
func (*Object) SetPayloadChecksum ¶
SetPayloadChecksum sets checksum of the object payload.
See also Object.PayloadChecksum.
func (*Object) SetPayloadHomomorphicHash ¶
SetPayloadHomomorphicHash sets homomorphic hash of the object payload.
See also Object.PayloadHomomorphicHash.
func (*Object) SetPayloadSize ¶
SetPayloadSize sets payload length of the object.
See also Object.PayloadSize.
func (*Object) SetPreviousID ¶
SetPreviousID sets identifier of the previous sibling object.
See also Object.PreviousID.
func (*Object) SetSessionToken ¶
SetSessionToken sets token of the session within which object was created.
See also Object.SessionToken.
func (*Object) SetSignature ¶
func (o *Object) SetSignature(v *neofscrypto.Signature)
SetSignature sets signature of the object identifier.
See also Object.Signature.
func (*Object) SetSplitID ¶
SetSplitID sets split identifier for the split object.
See also Object.SplitID.
func (*Object) SetVerificationFields ¶
func (o *Object) SetVerificationFields(signer neofscrypto.Signer) error
SetVerificationFields calculates and sets all verification fields of the object.
func (*Object) Sign ¶
func (o *Object) Sign(signer neofscrypto.Signer) error
Sign signs object id with provided key and sets that signature to the object.
See also oid.ID.CalculateIDSignature.
func (*Object) Signature ¶
func (o *Object) Signature() *neofscrypto.Signature
Signature returns signature of the object identifier.
See also Object.SetSignature.
func (*Object) SplitID ¶
SplitID return split identity of split object. If object is not split returns nil.
See also Object.SetSplitID.
func (*Object) ToV2 ¶
ToV2 converts Object to v2 object.Object message.
The value returned shares memory with the structure itself, so changing it can lead to data corruption. Make a copy if you need to change it.
func (*Object) Unmarshal ¶
Unmarshal unmarshals protobuf binary representation of object.
See also Object.Marshal.
func (*Object) UnmarshalJSON ¶
UnmarshalJSON decodes object from protobuf JSON format.
See also Object.MarshalJSON.
func (*Object) UserAttributes ¶
UserAttributes returns user attributes of the Object.
The value returned shares memory with the structure itself, so changing it can lead to data corruption. Make a copy if you need to change it.
See also Object.SetAttributes, Object.Attributes.
func (*Object) VerifyPayloadChecksum ¶
VerifyPayloadChecksum checks if payload checksum in the object corresponds to its payload.
func (*Object) VerifySignature ¶
VerifySignature verifies object ID signature.
type Range ¶
Range represents v2 object.Range object payload range.
func NewRange ¶
func NewRange() *Range
NewRange creates and initializes blank Range.
Defaults:
- offset: 0;
- length: 0.
func NewRangeFromV2 ¶
NewRangeFromV2 wraps v2 object.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
}
SearchFilter describes a single filter record.
func (*SearchFilter) Header ¶
func (f *SearchFilter) Header() string
Header returns filter header value.
func (SearchFilter) IsNonAttribute ¶
func (f SearchFilter) IsNonAttribute() bool
IsNonAttribute checks if SearchFilter is non-attribute: such filter is related to the particular property of the object instead of its attribute.
func (*SearchFilter) Operation ¶
func (f *SearchFilter) Operation() SearchMatchType
Operation returns filter operation value.
type SearchFilters ¶
type SearchFilters []SearchFilter
SearchFilters is type to describe a group of filters.
func NewSearchFilters ¶
func NewSearchFilters() SearchFilters
NewSearchFilters constructs empty filter group.
func NewSearchFiltersFromV2 ¶
func NewSearchFiltersFromV2(v2 []v2object.SearchFilter) SearchFilters
NewSearchFiltersFromV2 converts slice of v2object.SearchFilter to SearchFilters.
func (*SearchFilters) AddCreationEpochFilter ¶
func (f *SearchFilters) AddCreationEpochFilter(m SearchMatchType, epoch uint64)
AddCreationEpochFilter adds filter by creation epoch.
func (*SearchFilters) AddFilter ¶
func (f *SearchFilters) AddFilter(key, value string, op SearchMatchType)
AddFilter adds a filter to group by simple plain parameters.
func (*SearchFilters) AddHomomorphicHashFilter ¶
func (f *SearchFilters) AddHomomorphicHashFilter(m SearchMatchType, sum [tz.Size]byte)
AddHomomorphicHashFilter adds filter by homomorphic hash.
Example ¶
package main import ( "encoding/hex" "fmt" "github.com/nspcc-dev/neofs-sdk-go/checksum" "github.com/nspcc-dev/tzhash/tz" ) func main() { hash, _ := hex.DecodeString("7e302ebb3937e810feb501965580c746048db99cebd095c3ce27022407408bf904dde8d9aa8085d2cf7202345341cc947fa9d722c6b6699760d307f653815d0c") var v [tz.Size]byte copy(v[:], hash[:tz.Size]) var cs checksum.Checksum cs.SetTillichZemor(v) fmt.Println(hex.EncodeToString(cs.Value())) }
Output: 7e302ebb3937e810feb501965580c746048db99cebd095c3ce27022407408bf904dde8d9aa8085d2cf7202345341cc947fa9d722c6b6699760d307f653815d0c
func (*SearchFilters) AddNotificationEpochFilter ¶
func (f *SearchFilters) AddNotificationEpochFilter(epoch uint64)
AddNotificationEpochFilter adds a filter by epoch. This epoch is not about expiration, but about notification production.
func (*SearchFilters) AddObjectContainerIDFilter ¶
func (f *SearchFilters) AddObjectContainerIDFilter(m SearchMatchType, id cid.ID)
AddObjectContainerIDFilter adds a filter by container 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)
AddObjectOwnerIDFilter adds a filter by object owner id.
func (*SearchFilters) AddObjectVersionFilter ¶
func (f *SearchFilters) AddObjectVersionFilter(op SearchMatchType, v version.Version)
AddObjectVersionFilter adds a filter by version.
func (*SearchFilters) AddParentIDFilter ¶
func (f *SearchFilters) AddParentIDFilter(m SearchMatchType, id oid.ID)
AddParentIDFilter adds filter by parent identifier.
func (*SearchFilters) AddPayloadHashFilter ¶
func (f *SearchFilters) AddPayloadHashFilter(m SearchMatchType, sum [sha256.Size]byte)
AddPayloadHashFilter adds filter by payload hash.
Example ¶
package main import ( "crypto/sha256" "encoding/hex" "fmt" "github.com/nspcc-dev/neofs-sdk-go/checksum" ) func main() { hash, _ := hex.DecodeString("66842cfea090b1d906b52400fae49d86df078c0670f2bdd059ba289ebe24a498") var v [sha256.Size]byte copy(v[:], hash[:sha256.Size]) var cs checksum.Checksum cs.SetSHA256(v) fmt.Println(hex.EncodeToString(cs.Value())) }
Output: 66842cfea090b1d906b52400fae49d86df078c0670f2bdd059ba289ebe24a498
func (*SearchFilters) AddPayloadSizeFilter ¶
func (f *SearchFilters) AddPayloadSizeFilter(m SearchMatchType, size uint64)
AddPayloadSizeFilter adds filter by payload size.
func (*SearchFilters) AddPhyFilter ¶
func (f *SearchFilters) AddPhyFilter()
AddPhyFilter adds filter by objects that are physically stored in the system.
func (*SearchFilters) AddRootFilter ¶
func (f *SearchFilters) AddRootFilter()
AddRootFilter adds filter by objects that have been created by a user explicitly.
func (*SearchFilters) AddSplitIDFilter ¶
func (f *SearchFilters) AddSplitIDFilter(m SearchMatchType, id SplitID)
AddSplitIDFilter adds filter by split ID.
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.
See also SearchFilters.UnmarshalJSON.
func (SearchFilters) ToV2 ¶
func (f SearchFilters) ToV2() []v2object.SearchFilter
ToV2 converts SearchFilters to v2object.SearchFilter slice.
func (*SearchFilters) UnmarshalJSON ¶
func (f *SearchFilters) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes SearchFilters from protobuf JSON format.
See also SearchFilters.MarshalJSON.
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)
SearchMatchFromV2 converts v2 v2object.MatchType to SearchMatchType enum value.
func (*SearchMatchType) DecodeString ¶
func (m *SearchMatchType) DecodeString(s string) bool
DecodeString parses SearchMatchType from a string representation. It is a reverse action to EncodeToString().
Returns true if s was parsed successfully.
func (SearchMatchType) EncodeToString ¶
func (m SearchMatchType) EncodeToString() string
EncodeToString 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) String ¶
func (m SearchMatchType) String() string
String implements fmt.Stringer.
String is designed to be human-readable, and its format MAY differ between SDK versions. String MAY return same result as [EncodeToString]. String MUST NOT be used to encode ID into NeoFS protocol string.
func (SearchMatchType) ToV2 ¶
func (m SearchMatchType) ToV2() v2object.MatchType
ToV2 converts SearchMatchType to v2 v2object.MatchType enum value.
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 ¶
SplitInfo is an SDK representation of object.SplitInfo.
func NewSplitInfo ¶
func NewSplitInfo() *SplitInfo
NewSplitInfo creates and initializes blank SplitInfo.
Defaults:
- splitID: nil;
- lastPart nil;
- link: nil.
func NewSplitInfoFromV2 ¶
NewSplitInfoFromV2 wraps v2 object.SplitInfo message to SplitInfo.
Nil object.SplitInfo converts to nil.
func (SplitInfo) LastPart ¶
LastPart returns last object ID, can be used to retrieve original object. The second return value is a flag, indicating if the last part is present.
See also SplitInfo.SetLastPart.
func (SplitInfo) Link ¶
Link returns a linker object ID. The second return value is a flag, indicating if the last part is present.
See also SplitInfo.SetLink.
func (*SplitInfo) Marshal ¶
Marshal marshals SplitInfo into a protobuf binary form.
See also SplitInfo.Unmarshal.
func (*SplitInfo) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
See also SplitInfo.UnmarshalJSON.
func (*SplitInfo) SetSplitID ¶
SetSplitID sets split ID in object ID. It resets split ID if nil passed.
See also SplitInfo.SplitID.
func (*SplitInfo) SplitID ¶
SplitID returns SplitID if it has been set.
The value returned shares memory with the structure itself, so changing it can lead to data corruption. Make a copy if you need to change it.
See also SplitInfo.SetSplitID.
func (*SplitInfo) ToV2 ¶
ToV2 converts SplitInfo to v2 object.SplitInfo message.
Nil SplitInfo converts to nil.
The value returned shares memory with the structure itself, so changing it can lead to data corruption. Make a copy if you need to change it.
func (*SplitInfo) Unmarshal ¶
Unmarshal unmarshals protobuf binary representation of SplitInfo.
See also SplitInfo.Marshal.
func (*SplitInfo) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
See also SplitInfo.MarshalJSON.
type SplitInfoError ¶
type SplitInfoError struct {
// contains filtered or unexported fields
}
SplitInfoError is a special error that means that the original object is a large one (split into a number of smaller objects).
func NewSplitInfoError ¶
func NewSplitInfoError(v *SplitInfo) *SplitInfoError
NewSplitInfoError is a constructor for SplitInfoError.
func (*SplitInfoError) Error ¶
func (s *SplitInfoError) Error() string
Error implements the error interface.
func (*SplitInfoError) SplitInfo ¶
func (s *SplitInfoError) SplitInfo() *SplitInfo
SplitInfo returns SplitInfo data.
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.Tombstone message to Tombstone.
Nil tombstone.Tombstone converts to nil.
func (*Tombstone) ExpirationEpoch ¶
ExpirationEpoch returns the last NeoFS epoch number of the tombstone lifetime.
See also Tombstone.SetExpirationEpoch.
func (*Tombstone) Marshal ¶
Marshal marshals Tombstone into a protobuf binary form.
See also Tombstone.Unmarshal.
func (*Tombstone) MarshalJSON ¶
MarshalJSON encodes Tombstone to protobuf JSON format.
See also Tombstone.UnmarshalJSON.
func (*Tombstone) Members ¶
Members returns list of objects to be deleted.
See also Tombstone.SetMembers.
func (*Tombstone) SetExpirationEpoch ¶
SetExpirationEpoch sets the last NeoFS epoch number of the tombstone lifetime.
See also Tombstone.ExpirationEpoch.
func (*Tombstone) SetMembers ¶
SetMembers sets list of objects to be deleted.
See also Tombstone.Members.
func (*Tombstone) SetSplitID ¶
SetSplitID sets identifier of object split hierarchy.
See also Tombstone.SplitID.
func (*Tombstone) SplitID ¶
SplitID returns identifier of object split hierarchy.
The value returned shares memory with the structure itself, so changing it can lead to data corruption. Make a copy if you need to change it.
See also Tombstone.SetSplitID.
func (*Tombstone) ToV2 ¶
ToV2 converts Tombstone to v2 tombstone.Tombstone message.
Nil Tombstone converts to nil.
The value returned shares memory with the structure itself, so changing it can lead to data corruption. Make a copy if you need to change it.
func (*Tombstone) Unmarshal ¶
Unmarshal unmarshals protobuf binary representation of Tombstone.
See also Tombstone.Marshal.
func (*Tombstone) UnmarshalJSON ¶
UnmarshalJSON decodes Tombstone from protobuf JSON format.
See also Tombstone.MarshalJSON.
type Type ¶
Type is an enumerator for possible object types.
func (*Type) DecodeString ¶
DecodeString parses Type from a string representation. It is a reverse action to EncodeToString().
Returns true if s was parsed successfully.
func (Type) EncodeToString ¶
EncodeToString returns string representation of Type.
String mapping:
- TypeTombstone: TOMBSTONE;
- TypeStorageGroup: STORAGE_GROUP;
- TypeLock: LOCK;
- TypeRegular, default: REGULAR.
func (Type) String ¶
String implements fmt.Stringer.
String is designed to be human-readable, and its format MAY differ between SDK versions. String MAY return same result as Type.EncodeToString. String MUST NOT be used to encode ID into NeoFS protocol string.
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. |
Package relations provides feature to process inner object structure.
|
Package relations provides feature to process inner object structure. |
Package slicer provides raw data slicing into NeoFS objects.
|
Package slicer provides raw data slicing into NeoFS objects. |