Documentation
¶
Index ¶
- Constants
- func CalculatePayloadChecksum(payload []byte) checksum.Checksum
- type Attribute
- func (a *Attribute) Key() string
- func (a *Attribute) Marshal() []byte
- func (a *Attribute) MarshalJSON() ([]byte, error)
- func (a *Attribute) SetKey(v string)
- func (a *Attribute) SetValue(v string)
- func (a *Attribute) Unmarshal(data []byte) error
- func (a *Attribute) UnmarshalJSON(data []byte) error
- func (a *Attribute) Value() string
- type Link
- type Lock
- type MeasuredObject
- type Object
- func (o *Object) AssociateDeleted(id oid.ID)
- func (o *Object) AssociateLocked(id oid.ID)
- func (o *Object) AssociateObject(id oid.ID)
- func (o *Object) AssociatedObject() oid.ID
- 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) CopyTo(dst *Object)
- func (o Object) CreationEpoch() uint64
- func (o *Object) CutPayload() *Object
- func (o Object) FirstID() (oid.ID, bool)
- func (o *Object) FromProtoMessage(m *protoobject.Object) error
- func (o Object) GetContainerID() cid.ID
- func (o Object) GetFirstID() oid.ID
- func (o Object) GetID() oid.ID
- func (o Object) GetParentID() oid.ID
- func (o Object) GetPreviousID() oid.ID
- func (o Object) HasParent() bool
- func (o Object) HeaderLen() int
- func (o *Object) InitCreation(rf RequiredFields)
- func (o Object) Marshal() []byte
- func (o Object) MarshalHeaderJSON() ([]byte, error)
- func (o Object) MarshalJSON() ([]byte, error)
- func (o Object) Owner() user.ID
- func (o Object) Parent() *Object
- 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) ProtoMessage() *protoobject.Object
- func (o Object) ReadLink(l *Link) error
- 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) SetFirstID(id oid.ID)
- func (o *Object) SetID(v oid.ID)
- func (o *Object) SetIDWithSignature(signer neofscrypto.Signer) error
- func (o *Object) SetOwner(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) 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) WriteLink(l Link)
- 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) AddFirstSplitObjectFilter(m SearchMatchType, id oid.ID)
- func (f *SearchFilters) AddHomomorphicHashFilter(m SearchMatchType, sum [tz.Size]byte)
- 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) FromProtoMessage(ms []*protoobject.SearchFilter) error
- func (f SearchFilters) MarshalJSON() ([]byte, error)
- func (f SearchFilters) ProtoMessage() []*protoobject.SearchFilter
- func (f *SearchFilters) UnmarshalJSON(data []byte) error
- type SearchMatchType
- type SplitID
- type SplitInfo
- func (s *SplitInfo) FromProtoMessage(m *protoobject.SplitInfo) error
- func (s SplitInfo) GetFirstPart() oid.ID
- func (s SplitInfo) GetLastPart() oid.ID
- func (s SplitInfo) GetLink() oid.ID
- func (s SplitInfo) Marshal() []byte
- func (s SplitInfo) MarshalJSON() ([]byte, error)
- func (s SplitInfo) ProtoMessage() *protoobject.SplitInfo
- func (s *SplitInfo) SetFirstPart(v oid.ID)
- 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) Unmarshal(data []byte) error
- func (s *SplitInfo) UnmarshalJSON(data []byte) error
- type SplitInfoError
- type Tombstone
- func (t Tombstone) ExpirationEpoch() uint64
- func (t *Tombstone) FromProtoMessage(m *prototombstone.Tombstone) error
- func (t Tombstone) Marshal() []byte
- func (t Tombstone) MarshalJSON() ([]byte, error)
- func (t Tombstone) Members() []oid.ID
- func (t Tombstone) ProtoMessage() *prototombstone.Tombstone
- 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) Unmarshal(data []byte) error
- func (t *Tombstone) UnmarshalJSON(data []byte) error
- type Type
Examples ¶
Constants ¶
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 = sysAttrPrefix + "EXPIRATION_EPOCH" // AttributeAssociatedObject is a key to an object attribute that determines // associated object's ID. For [object.TypeTombstone] it defines object to // delete. For [object.TypeLock] it defines object to lock. AttributeAssociatedObject = sysAttrPrefix + "ASSOCIATE" // AttributeECPrefix is a prefix of EC object attributes. AttributeECPrefix = sysAttrPrefix + "EC_" // AttributeECRuleIndex is an attribute of EC part object specifying index of EC // rule in container storage policy according to which the part was created. // Value is base-10 integer. AttributeECRuleIndex = AttributeECPrefix + "RULE_IDX" // AttributeECPartIndex is an attribute of EC part object specifying index in // the EC parts into which the parent object is divided. Value is base-10 // integer. AttributeECPartIndex = AttributeECPrefix + "PART_IDX" )
Various system attributes.
const ( FilterVersion = reservedFilterPrefix + "version" FilterID = reservedFilterPrefix + "objectID" // Deprecated. FilterContainerID = reservedFilterPrefix + "containerID" // Deprecated. FilterOwnerID = reservedFilterPrefix + "ownerID" FilterPayloadChecksum = reservedFilterPrefix + "payloadHash" FilterType = reservedFilterPrefix + "objectType" FilterPayloadHomomorphicHash = reservedFilterPrefix + "homomorphicHash" FilterParentID = reservedFilterPrefix + "split.parent" FilterSplitID = reservedFilterPrefix + "split.splitID" FilterFirstSplitObject = reservedFilterPrefix + "split.first" FilterCreationEpoch = reservedFilterPrefix + "creationEpoch" FilterPayloadSize = reservedFilterPrefix + "payloadLength" )
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 = reservedFilterPrefix + "ROOT" // 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 = reservedFilterPrefix + "PHY" )
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 MaxHeaderLen = 16 << 10
MaxHeaderLen is a maximum allowed length of binary object header to be created via NeoFS API protocol.
Variables ¶
This section is empty.
Functions ¶
func CalculatePayloadChecksum ¶
CalculatePayloadChecksum calculates and returns checksum of object payload bytes.
Types ¶
type Attribute ¶
type Attribute struct {
// contains filtered or unexported fields
}
Attribute represents an object attribute.
func NewAttribute ¶
NewAttribute creates and initializes new Attribute.
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) 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 Link ¶
type Link struct {
// contains filtered or unexported fields
}
Link is a payload of helper objects that contain the full list of the split chain of the big NeoFS objects. It is compatible with NeoFS API V2 protocol.
Link instance can be written to the Object, see Object.WriteLink/Object.ReadLink.
func (*Link) Marshal ¶
Marshal encodes the Link into a NeoFS protocol binary format.
See also Link.Unmarshal.
func (*Link) Objects ¶
func (l *Link) Objects() []MeasuredObject
Objects returns split chain's measured objects.
See also Link.SetObjects.
func (*Link) SetObjects ¶
func (l *Link) SetObjects(oo []MeasuredObject)
SetObjects sets split chain's measured objects.
See also Link.Objects.
type Lock ¶
type Lock struct {
// contains filtered or unexported fields
}
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.
DEPRECATED: use Object.AssociateLocked instead, locking exactly one object per Lock.
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 MeasuredObject ¶
type MeasuredObject struct {
// contains filtered or unexported fields
}
MeasuredObject groups object ID and its size length.
func (*MeasuredObject) ObjectID ¶
func (m *MeasuredObject) ObjectID() oid.ID
ObjectID returns object identifier.
See also MeasuredObject.SetObjectID.
func (*MeasuredObject) ObjectSize ¶
func (m *MeasuredObject) ObjectSize() uint32
ObjectSize returns size of the object.
See also MeasuredObject.SetObjectSize.
func (*MeasuredObject) SetObjectID ¶
func (m *MeasuredObject) SetObjectID(id oid.ID)
SetObjectID sets object identifier.
See also MeasuredObject.ObjectID.
func (*MeasuredObject) SetObjectSize ¶
func (m *MeasuredObject) SetObjectSize(s uint32)
SetObjectSize sets size of the object.
See also MeasuredObject.ObjectSize.
type Object ¶
type Object struct {
// contains filtered or unexported fields
}
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);
- Object.FromProtoMessage (when working under NeoFS API V2 protocol).
func (*Object) AssociateDeleted ¶
AssociateDeleted makes this object to delete another object. See also object.AttributeAssociatedObject.
func (*Object) AssociateLocked ¶
AssociateLocked makes this object to lock another object from deletion. See also object.AttributeAssociatedObject.
func (*Object) AssociateObject ¶
AssociateObject associates object with the current one. See also object.AttributeAssociatedObject attribute.
func (*Object) AssociatedObject ¶
AssociatedObject returns associated object with the current one. Returns zero object ID of no association has been made or if associated object ID is incorrect. If more than one association has been made, retuned result is undefined. See also object.AttributeAssociatedObject.
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) 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) FirstID ¶
FirstID returns the first part of the object's split chain.
See also Object.SetFirstID.
func (*Object) FromProtoMessage ¶
func (o *Object) FromProtoMessage(m *protoobject.Object) error
FromProtoMessage validates m according to the NeoFS API protocol and restores o from it.
See also [Table.ProtoMessage].
func (Object) GetContainerID ¶
GetContainerID returns identifier of the related container. Zero means unset binding.
See also Object.SetContainerID.
func (Object) GetFirstID ¶
GetFirstID returns the first part of the object's split chain. Zero return means unset ID.
See also Object.SetFirstID.
func (Object) GetID ¶
GetID returns identifier of the object. Zero return means unset ID.
See also Object.SetID.
func (Object) GetParentID ¶
GetParentID returns identifier of the parent object. Zero return means unset ID.
See also Object.SetParentID.
func (Object) GetPreviousID ¶
GetPreviousID returns identifier of the previous sibling object. Zero return means unset ID.
See also Object.SetPreviousID.
func (*Object) InitCreation ¶
func (o *Object) InitCreation(rf RequiredFields)
InitCreation initializes the object instance with minimum set of required fields.
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) Owner ¶
Owner returns user ID of the object owner. Zero return means unset ID.
See also Object.SetOwner.
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) ProtoMessage ¶
func (o Object) ProtoMessage() *protoobject.Object
ProtoMessage converts o into message to transmit using the NeoFS API protocol.
See also Object.FromProtoMessage.
func (Object) ReadLink ¶
ReadLink reads a link from the Object. The link must not be nil. Returns an error describing incorrect format. Makes sense only if the object has TypeLink type.
See also Object.WriteLink.
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.GetPreviousID.
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.GetContainerID.
func (*Object) SetCreationEpoch ¶
SetCreationEpoch sets epoch number in which object was created.
See also Object.CreationEpoch.
func (*Object) SetFirstID ¶
SetFirstID sets the first part's ID of the object's split chain.
See also Object.GetFirstID.
func (*Object) SetIDWithSignature ¶
func (o *Object) SetIDWithSignature(signer neofscrypto.Signer) error
SetIDWithSignature sets object identifier and signature.
func (*Object) SetParentID ¶
SetParentID sets identifier of the parent object.
See also Object.GetParentID.
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.GetPreviousID.
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) 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.
func (Object) Version ¶
Version returns version of the object. Returns nil if the version is unset.
See also Object.SetVersion.
type Range ¶
type Range struct {
// contains filtered or unexported fields
}
Range represents v2 object.Range object payload range.
func NewRange ¶
func NewRange() *Range
NewRange creates and initializes blank Range.
Defaults:
- offset: 0;
- length: 0.
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 (*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.
If op is numeric (like MatchNumGT), value must be a base-10 integer.
func (*SearchFilters) AddFirstSplitObjectFilter ¶
func (f *SearchFilters) AddFirstSplitObjectFilter(m SearchMatchType, id oid.ID)
AddFirstSplitObjectFilter adds filter by first object ID.
The m must not be numeric (like MatchNumGT).
func (*SearchFilters) AddHomomorphicHashFilter ¶
func (f *SearchFilters) AddHomomorphicHashFilter(m SearchMatchType, sum [tz.Size]byte)
AddHomomorphicHashFilter adds filter by homomorphic hash.
The m must not be numeric (like MatchNumGT).
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")
cs := checksum.NewTillichZemor([tz.Size]byte(hash))
fmt.Println(hex.EncodeToString(cs.Value()))
}
Output: 7e302ebb3937e810feb501965580c746048db99cebd095c3ce27022407408bf904dde8d9aa8085d2cf7202345341cc947fa9d722c6b6699760d307f653815d0c
func (*SearchFilters) AddObjectOwnerIDFilter ¶
func (f *SearchFilters) AddObjectOwnerIDFilter(m SearchMatchType, id user.ID)
AddObjectOwnerIDFilter adds a filter by object owner id.
The m must not be numeric (like MatchNumGT).
func (*SearchFilters) AddObjectVersionFilter ¶
func (f *SearchFilters) AddObjectVersionFilter(op SearchMatchType, v version.Version)
AddObjectVersionFilter adds a filter by version.
The op must not be numeric (like MatchNumGT).
func (*SearchFilters) AddParentIDFilter ¶
func (f *SearchFilters) AddParentIDFilter(m SearchMatchType, id oid.ID)
AddParentIDFilter adds filter by parent identifier.
The m must not be numeric (like MatchNumGT).
func (*SearchFilters) AddPayloadHashFilter ¶
func (f *SearchFilters) AddPayloadHashFilter(m SearchMatchType, sum [sha256.Size]byte)
AddPayloadHashFilter adds filter by payload hash.
The m must not be numeric (like MatchNumGT).
Example ¶
package main
import (
"crypto/sha256"
"encoding/hex"
"fmt"
"github.com/nspcc-dev/neofs-sdk-go/checksum"
)
func main() {
hash, _ := hex.DecodeString("66842cfea090b1d906b52400fae49d86df078c0670f2bdd059ba289ebe24a498")
cs := checksum.NewSHA256([sha256.Size]byte(hash))
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.
The m must not be numeric (like MatchNumGT).
func (*SearchFilters) AddTypeFilter ¶
func (f *SearchFilters) AddTypeFilter(m SearchMatchType, typ Type)
AddTypeFilter adds filter by object type.
The m must not be numeric (like MatchNumGT).
func (*SearchFilters) FromProtoMessage ¶
func (f *SearchFilters) FromProtoMessage(ms []*protoobject.SearchFilter) error
FromProtoMessage validates m according to the NeoFS API protocol and restores f from it.
See also SearchFilters.ProtoMessage.
func (SearchFilters) MarshalJSON ¶
func (f SearchFilters) MarshalJSON() ([]byte, error)
MarshalJSON encodes SearchFilters to protobuf JSON format.
See also SearchFilters.UnmarshalJSON.
func (SearchFilters) ProtoMessage ¶
func (f SearchFilters) ProtoMessage() []*protoobject.SearchFilter
ProtoMessage converts f into message to transmit using the NeoFS API protocol.
See also SearchFilters.FromProtoMessage.
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 int32
SearchMatchType indicates match operation on specified header.
const ( MatchUnspecified SearchMatchType = iota MatchStringEqual MatchStringNotEqual MatchNotPresent MatchCommonPrefix MatchNumGT MatchNumGE MatchNumLT MatchNumLE )
func (*SearchMatchType) DecodeString ¶
func (m *SearchMatchType) DecodeString(s string) bool
DecodeString parses SearchMatchType from a string representation. It is a reverse action to SearchMatchType.String.
Returns true if s was parsed successfully.
func (SearchMatchType) String ¶
func (m SearchMatchType) String() string
String implements fmt.Stringer with the following string mapping:
- MatchStringEqual: STRING_EQUAL
- MatchStringNotEqual: STRING_NOT_EQUAL
- MatchNotPresent: NOT_PRESENT
- MatchCommonPrefix: COMMON_PREFIX
- MatchNumGT: NUM_GT
- MatchNumGE: NUM_GE
- MatchNumLT: NUM_LT
- MatchNumLE: NUM_LE
- [MatchUnknown]: MATCH_TYPE_UNSPECIFIED
All other values are base-10 integers.
The mapping is consistent and resilient to lib updates. At the same time, please note that this is not a NeoFS protocol format.
String is reverse to SearchMatchType.DecodeString.
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 ¶
type SplitInfo struct {
// contains filtered or unexported fields
}
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 (*SplitInfo) FromProtoMessage ¶
func (s *SplitInfo) FromProtoMessage(m *protoobject.SplitInfo) error
FromProtoMessage validates m according to the NeoFS API protocol and restores s from it.
See also SplitInfo.ProtoMessage.
func (SplitInfo) GetFirstPart ¶
GetFirstPart returns the first part of the split chain. Zero means unset ID.
See also SplitInfo.SetFirstPart.
func (SplitInfo) GetLastPart ¶
GetLastPart returns last object ID, can be used to retrieve original object. Zero return means unset ID.
See also SplitInfo.SetLastPart.
func (SplitInfo) GetLink ¶
GetLink returns a linker object ID. Zero return means unset ID.
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) ProtoMessage ¶
func (s SplitInfo) ProtoMessage() *protoobject.SplitInfo
ProtoMessage converts s into message to transmit using the NeoFS API protocol.
See also SplitInfo.FromProtoMessage.
func (*SplitInfo) SetFirstPart ¶
SetFirstPart sets the first part of the split chain.
See also SplitInfo.GetFirstPart.
func (*SplitInfo) SetLastPart ¶
SetLastPart sets the last object ID.
See also SplitInfo.GetLastPart.
func (*SplitInfo) SetSplitID ¶
SetSplitID sets split ID in object ID. It resets split ID if nil passed.
See also SplitInfo.SplitID.
DEPRECATED.SplitInfo.SetFirstPart usage is required for the _new_ split objects, it serves as chain identification.
func (SplitInfo) SplitID ¶
SplitID returns SplitID if it has been set. New objects may miss it, use SplitInfo.GetFirstPart as a split chain identifier.
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) 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 ¶
type Tombstone struct {
// contains filtered or unexported fields
}
Tombstone represents object tombstone structure.
DEPRECATED: use Object.AssociateDeleted instead, deleting exactly one object per Tombstone.
func NewTombstone ¶
func NewTombstone() *Tombstone
NewTombstone creates and initializes blank Tombstone.
Defaults:
- exp: 0;
- splitID: nil;
- members: nil.
func (Tombstone) ExpirationEpoch ¶
ExpirationEpoch returns the last NeoFS epoch number of the tombstone lifetime.
See also Tombstone.SetExpirationEpoch.
func (*Tombstone) FromProtoMessage ¶
func (t *Tombstone) FromProtoMessage(m *prototombstone.Tombstone) error
FromProtoMessage validates m according to the NeoFS API protocol and restores t from it.
See also Tombstone.ProtoMessage.
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) ProtoMessage ¶
func (t Tombstone) ProtoMessage() *prototombstone.Tombstone
ProtoMessage converts t into message to transmit using the NeoFS API protocol.
See also Tombstone.FromProtoMessage.
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) 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 Type int32
Type is an enumerator for possible object types.
func (*Type) DecodeString ¶
DecodeString parses Type from a string representation. It is a reverse action to Type.String.
Returns true if s was parsed successfully.
func (Type) String ¶
String implements fmt.Stringer with the following string mapping:
- TypeRegular: REGULAR
- TypeTombstone: TOMBSTONE
- TypeStorageGroup: STORAGE_GROUP
- TypeLock: LOCK
- TypeLink: LINK
All other values are base-10 integers.
The mapping is consistent and resilient to lib updates. At the same time, please note that this is not a NeoFS protocol format.
String is reverse to Type.DecodeString.
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. |