object

package
v0.0.0-...-0352b5b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2024 License: Apache-2.0 Imports: 22 Imported by: 44

Documentation

Index

Constants

View Source
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"
)

Variables

This section is empty.

Functions

func CalculateAndSetID

func CalculateAndSetID(obj *Object) error

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

func CalculateID(obj *Object) (oid.ID, error)

CalculateID calculates identifier for the object.

func CalculatePayloadChecksum

func CalculatePayloadChecksum(payload []byte) checksum.Checksum

CalculatePayloadChecksum calculates and returns checksum of object payload bytes.

func CheckHeaderVerificationFields

func CheckHeaderVerificationFields(obj *Object) error

CheckHeaderVerificationFields checks all verification fields except payload.

func CheckVerificationFields

func CheckVerificationFields(obj *Object) error

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

func ReadLock(l *Lock, obj Object) error

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 VerifyID

func VerifyID(obj *Object) error

VerifyID checks if identifier in the object corresponds to its structure.

func VerifyPayloadChecksum

func VerifyPayloadChecksum(obj *Object) error

VerifyPayloadChecksum checks if payload checksum in the object corresponds to its payload.

func WriteLock

func WriteLock(obj *Object, l Lock)

WriteLock writes Lock to the Object, and sets its type to TypeLock. The object must not be nil.

See also ReadLock.

Types

type Attribute

type Attribute object.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

func NewAttributeFromV2(aV2 *object.Attribute) *Attribute

NewAttributeFromV2 wraps v2 Attribute message to Attribute.

Nil object.Attribute converts to nil.

func (*Attribute) Key

func (a *Attribute) Key() string

Key returns key to the object attribute.

func (*Attribute) Marshal

func (a *Attribute) Marshal() ([]byte, error)

Marshal marshals Attribute into a protobuf binary form.

func (*Attribute) MarshalJSON

func (a *Attribute) MarshalJSON() ([]byte, error)

MarshalJSON encodes Attribute to protobuf JSON format.

func (*Attribute) SetKey

func (a *Attribute) SetKey(v string)

SetKey sets key to the object attribute.

func (*Attribute) SetValue

func (a *Attribute) SetValue(v string)

SetValue sets value of the object attribute.

func (*Attribute) ToV2

func (a *Attribute) ToV2() *object.Attribute

ToV2 converts Attribute to v2 Attribute message.

Nil Attribute converts to nil.

func (*Attribute) Unmarshal

func (a *Attribute) Unmarshal(data []byte) error

Unmarshal unmarshals protobuf binary representation of Attribute.

func (*Attribute) UnmarshalJSON

func (a *Attribute) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes Attribute from protobuf JSON format.

func (*Attribute) Value

func (a *Attribute) Value() string

Value return value of the object attribute.

type ECChunk

type ECChunk object.ECChunk

func NewECChunkFromV2

func NewECChunkFromV2(v2 *object.ECChunk) *ECChunk

func (*ECChunk) SetID

func (c *ECChunk) SetID(id oid.ID)

func (*ECChunk) ToV2

func (c *ECChunk) ToV2() *object.ECChunk

ToV2 converts ECChunk to v2 ECChunk message.

Nil ECChunk converts to nil.

type ECHeader

type ECHeader struct {
	// contains filtered or unexported fields
}

ECHeader represents erasure coding header.

func NewECHeader

func NewECHeader(ecParentInfo ECParentInfo, index, total uint32, header []byte, headerLength uint32) *ECHeader

NewECHeader constructs new erasure coding header.

func (*ECHeader) Header

func (e *ECHeader) Header() []byte

func (*ECHeader) HeaderLength

func (e *ECHeader) HeaderLength() uint32

func (*ECHeader) Index

func (e *ECHeader) Index() uint32

func (*ECHeader) Parent

func (e *ECHeader) Parent() oid.ID

func (*ECHeader) ParentAttributes

func (e *ECHeader) ParentAttributes() []Attribute

func (*ECHeader) ParentSplitID

func (e *ECHeader) ParentSplitID() *SplitID

func (*ECHeader) ParentSplitParentID

func (e *ECHeader) ParentSplitParentID() *oid.ID

func (*ECHeader) ReadFromV2

func (e *ECHeader) ReadFromV2(h *object.ECHeader) error

ReadFromV2 converts v2-api structure to SDK one.

func (*ECHeader) SetHeader

func (e *ECHeader) SetHeader(header []byte)

func (*ECHeader) SetHeaderLength

func (e *ECHeader) SetHeaderLength(l uint32)

func (*ECHeader) SetIndex

func (e *ECHeader) SetIndex(i uint32)

func (*ECHeader) SetParent

func (e *ECHeader) SetParent(id oid.ID)

func (*ECHeader) SetParentAttributes

func (e *ECHeader) SetParentAttributes(attrs []Attribute)

func (*ECHeader) SetParentSplitID

func (e *ECHeader) SetParentSplitID(parentSplitID *SplitID)

func (*ECHeader) SetParentSplitParentID

func (e *ECHeader) SetParentSplitParentID(parentSplitParentID *oid.ID)

func (*ECHeader) SetTotal

func (e *ECHeader) SetTotal(i uint32)

func (*ECHeader) Total

func (e *ECHeader) Total() uint32

func (*ECHeader) WriteToV2

func (e *ECHeader) WriteToV2(h *object.ECHeader)

WriteToV2 converts SDK structure to v2-api one.

type ECInfo

type ECInfo object.ECInfo

func NewECInfo

func NewECInfo() *ECInfo

NewECInfo creates and initializes blank ECInfo.

func NewECInfoFromV2

func NewECInfoFromV2(v2 *object.ECInfo) *ECInfo

NewECInfoFromV2 wraps v2 ECInfo message to ECInfo.

Nil object.ECInfo converts to nil.

func (*ECInfo) AddChunk

func (s *ECInfo) AddChunk(chunk ECChunk)

func (*ECInfo) Marshal

func (s *ECInfo) Marshal() ([]byte, error)

func (*ECInfo) MarshalJSON

func (s *ECInfo) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*ECInfo) ToV2

func (s *ECInfo) ToV2() *object.ECInfo

ToV2 converts ECInfo to v2 ECInfo message.

Nil ECInfo converts to nil.

func (*ECInfo) Unmarshal

func (s *ECInfo) Unmarshal(data []byte) error

func (*ECInfo) UnmarshalJSON

func (s *ECInfo) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ECInfoError

type ECInfoError struct {
	// contains filtered or unexported fields
}

func NewECInfoError

func NewECInfoError(v *ECInfo) *ECInfoError

func (*ECInfoError) ECInfo

func (e *ECInfoError) ECInfo() *ECInfo

func (*ECInfoError) Error

func (e *ECInfoError) Error() string

type ECParentInfo

type ECParentInfo struct {
	// EC-parent's ID.
	ID oid.ID

	// EC-parent's split ID if the parent is a part of Split itself.
	SplitID *SplitID

	// EC-parent's parent split ID if the parent is a part of Split itself.
	SplitParentID *oid.ID

	// EC-parent's attributes.
	Attributes []Attribute
}

type Lock

type Lock v2object.Lock

Lock represents record with locked objects. It is compatible with FrostFS API V2 protocol.

Lock instance can be written to the Object, see WriteLock/ReadLock.

func (Lock) Marshal

func (x Lock) Marshal() []byte

Marshal encodes the Lock into a FrostFS protocol binary format.

func (Lock) NumberOfMembers

func (x Lock) NumberOfMembers() int

NumberOfMembers returns number of members in lock list.

func (Lock) ReadMembers

func (x Lock) ReadMembers(buf []oid.ID)

ReadMembers reads list of locked members.

Buffer length must not be less than NumberOfMembers.

func (*Lock) Unmarshal

func (x *Lock) Unmarshal(data []byte) error

Unmarshal decodes the Lock from its FrostFS protocol binary representation.

func (*Lock) WriteMembers

func (x *Lock) WriteMembers(ids []oid.ID)

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

type Object object.Object

Object represents in-memory structure of the FrostFS object. Type is compatible with FrostFS 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 FrostFS API V2 protocol).

func New

func New() *Object

New creates and initializes blank Object.

Works similar as NewFromV2(new(Object)).

func NewFromV2

func NewFromV2(oV2 *object.Object) *Object

NewFromV2 wraps v2 Object message to Object.

func NewRaw deprecated

func NewRaw() *Object

NewRaw creates and initializes blank Object.

Deprecated: (v1.0.0) use New instead.

func NewRawFrom deprecated

func NewRawFrom(obj *Object) *Object

NewRawFrom wraps Object instance to Object.

Deprecated: (v1.0.0) function is no-op.

func NewRawFromV2 deprecated

func NewRawFromV2(oV2 *object.Object) *Object

NewRawFromV2 wraps v2 Object message to Object.

Deprecated: (v1.0.0) use NewFromV2 function instead.

func (*Object) Attributes

func (o *Object) Attributes() []Attribute

Attributes returns object attributes.

func (*Object) Children

func (o *Object) Children() []oid.ID

Children return list of the identifiers of the child objects.

func (*Object) ContainerID

func (o *Object) ContainerID() (v cid.ID, isSet bool)

ContainerID returns identifier of the related container.

func (*Object) CreationEpoch

func (o *Object) CreationEpoch() uint64

CreationEpoch returns epoch number in which object was created.

func (*Object) CutPayload

func (o *Object) CutPayload() *Object

CutPayload returns Object w/ empty payload.

Changes of non-payload fields affect source object.

func (*Object) ECHeader

func (o *Object) ECHeader() *ECHeader

func (*Object) GetECHeader

func (o *Object) GetECHeader() *ECHeader

func (*Object) HasParent

func (o *Object) HasParent() bool

func (*Object) ID

func (o *Object) ID() (v oid.ID, isSet bool)

ID returns object identifier.

func (*Object) InitRelations

func (o *Object) InitRelations()

InitRelations initializes relation field.

func (*Object) Marshal

func (o *Object) Marshal() ([]byte, error)

Marshal marshals object into a protobuf binary form.

func (*Object) MarshalHeaderJSON

func (o *Object) MarshalHeaderJSON() ([]byte, error)

MarshalHeaderJSON marshals object's header into JSON format.

func (*Object) MarshalJSON

func (o *Object) MarshalJSON() ([]byte, error)

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) Object deprecated

func (o *Object) Object() *Object

Object returns object instance.

Deprecated: (v1.0.0) method is no-op, use arg directly.

func (*Object) OwnerID

func (o *Object) OwnerID() user.ID

OwnerID returns identifier of the object owner and True.

func (*Object) Parent

func (o *Object) Parent() *Object

Parent returns parent object w/o payload.

func (*Object) ParentID

func (o *Object) ParentID() (v oid.ID, isSet bool)

ParentID returns identifier of the parent object.

func (*Object) Payload

func (o *Object) Payload() []byte

Payload returns payload bytes.

func (*Object) PayloadChecksum

func (o *Object) PayloadChecksum() (checksum.Checksum, bool)

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

func (o *Object) PayloadHomomorphicHash() (checksum.Checksum, bool)

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

func (o *Object) PayloadSize() uint64

PayloadSize returns payload length of the object.

func (*Object) PreviousID

func (o *Object) PreviousID() (v oid.ID, isSet bool)

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

func (o *Object) SessionToken() *session.Object

SessionToken returns token of the session within which object was created.

func (*Object) SetAttributes

func (o *Object) SetAttributes(v ...Attribute)

SetAttributes sets object attributes.

func (*Object) SetChildren

func (o *Object) SetChildren(v ...oid.ID)

SetChildren sets list of the identifiers of the child objects.

func (*Object) SetContainerID

func (o *Object) SetContainerID(v cid.ID)

SetContainerID sets identifier of the related container.

func (*Object) SetCreationEpoch

func (o *Object) SetCreationEpoch(v uint64)

SetCreationEpoch sets epoch number in which object was created.

func (*Object) SetECHeader

func (o *Object) SetECHeader(ec *ECHeader)

func (*Object) SetID

func (o *Object) SetID(v oid.ID)

SetID sets object identifier.

func (*Object) SetNotification

func (o *Object) SetNotification(ni NotificationInfo)

SetNotification writes NotificationInfo to the object structure.

func (*Object) SetOwnerID

func (o *Object) SetOwnerID(v user.ID)

SetOwnerID sets identifier of the object owner.

func (*Object) SetParent

func (o *Object) SetParent(v *Object)

SetParent sets parent object w/o payload.

func (*Object) SetParentID

func (o *Object) SetParentID(v oid.ID)

SetParentID sets identifier of the parent object.

func (*Object) SetPayload

func (o *Object) SetPayload(v []byte)

SetPayload sets payload bytes.

func (*Object) SetPayloadChecksum

func (o *Object) SetPayloadChecksum(v checksum.Checksum)

SetPayloadChecksum sets checksum of the object payload.

See also PayloadChecksum.

func (*Object) SetPayloadHomomorphicHash

func (o *Object) SetPayloadHomomorphicHash(v checksum.Checksum)

SetPayloadHomomorphicHash sets homomorphic hash of the object payload.

See also PayloadHomomorphicHash.

func (*Object) SetPayloadSize

func (o *Object) SetPayloadSize(v uint64)

SetPayloadSize sets payload length of the object.

func (*Object) SetPreviousID

func (o *Object) SetPreviousID(v oid.ID)

SetPreviousID sets identifier of the previous sibling object.

func (*Object) SetSessionToken

func (o *Object) SetSessionToken(v *session.Object)

SetSessionToken sets token of the session within which object was created.

func (*Object) SetSignature

func (o *Object) SetSignature(v *frostfscrypto.Signature)

SetSignature sets signature of the object identifier.

func (*Object) SetSplitID

func (o *Object) SetSplitID(id *SplitID)

SetSplitID sets split identifier for the split object.

func (*Object) SetType

func (o *Object) SetType(v Type)

SetType sets type of the object.

func (*Object) SetVersion

func (o *Object) SetVersion(v *version.Version)

SetVersion sets version of the object.

func (*Object) Signature

func (o *Object) Signature() *frostfscrypto.Signature

Signature returns signature of the object identifier.

func (*Object) SplitID

func (o *Object) SplitID() *SplitID

SplitID return split identity of split object. If object is not split returns nil.

func (*Object) ToV2

func (o *Object) ToV2() *object.Object

ToV2 converts Object to v2 Object message.

func (*Object) Type

func (o *Object) Type() Type

Type returns type of the object.

func (*Object) Unmarshal

func (o *Object) Unmarshal(data []byte) error

Unmarshal unmarshals protobuf binary representation of object.

func (*Object) UnmarshalJSON

func (o *Object) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes object from protobuf JSON format.

func (*Object) UserAttributes

func (o *Object) UserAttributes() []Attribute

UserAttributes returns object user attributes.

func (*Object) VerifyIDSignature

func (o *Object) VerifyIDSignature() bool

VerifyIDSignature verifies object ID signature.

func (*Object) Version

func (o *Object) Version() *version.Version

Version returns version of the object.

type Patch

type Patch struct {
	// The address of the object for which the patch is being applied.
	Address oid.Address

	// The list of new attributes to set in the object's header.
	NewAttributes []Attribute

	// If ReplaceAttributes flag is true, then the header's attributes are reset and
	// filled with NewAttributes. Otherwise, the attributes are just merged.
	ReplaceAttributes bool

	// Payload patch. If this field is not set, then it assumed such Patch patches only
	// header (see NewAttributes, ReplaceAttributes).
	PayloadPatch *PayloadPatch
}

Patch is a patch that's applied for an object.

func (*Patch) FromV2

func (p *Patch) FromV2(patch *v2object.PatchRequestBody)

func (*Patch) ToV2

func (p *Patch) ToV2() *v2object.PatchRequestBody

type PayloadPatch

type PayloadPatch struct {
	// Range of the patch application.
	Range *Range

	// Chunk is the payload that replaces (or is appended to) the original object payload.
	Chunk []byte
}

Patch is a patch that's applied for an object's payload.

func (*PayloadPatch) FromV2

func (p *PayloadPatch) FromV2(patch *v2object.PatchRequestBodyPatch)

func (*PayloadPatch) ToV2

type Range

type Range object.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

func NewRangeFromV2(rV2 *object.Range) *Range

NewRangeFromV2 wraps v2 Range message to Range.

Nil object.Range converts to nil.

func (*Range) GetLength

func (r *Range) GetLength() uint64

GetLength returns payload range size.

func (*Range) GetOffset

func (r *Range) GetOffset() uint64

GetOffset sets payload range offset from start.

func (*Range) SetLength

func (r *Range) SetLength(v uint64)

SetLength sets payload range size.

func (*Range) SetOffset

func (r *Range) SetOffset(v uint64)

SetOffset gets payload range offset from start.

func (*Range) ToV2

func (r *Range) ToV2() *object.Range

ToV2 converts Range to v2 Range message.

Nil Range converts to nil.

type RawObject deprecated

type RawObject = Object

RawObject represents v2-compatible FrostFS object that provides a convenient interface to fill in the fields of an object in isolation from its internal structure.

Deprecated: use Object type instead.

type RequiredFields

type RequiredFields struct {
	// Identifier of the FrostFS container associated with the object.
	Container cid.ID

	// Object owner's user ID in the FrostFS system.
	Owner user.ID
}

RequiredFields contains the minimum set of object data that must be set by the FrostFS 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) AddECParentFilter

func (f *SearchFilters) AddECParentFilter(m SearchMatchType, parentID oid.ID)

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

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

func NewSplitIDFromV2(v []byte) *SplitID

NewSplitIDFromV2 returns parsed UUID from bytes. If v is invalid UUIDv4 byte sequence, then function returns nil.

Nil converts to nil.

func (*SplitID) Parse

func (id *SplitID) Parse(s string) (err error)

Parse converts UUIDv4 string representation into SplitID.

func (*SplitID) SetUUID

func (id *SplitID) SetUUID(v uuid.UUID)

SetUUID sets pre created UUID structure as SplitID.

func (*SplitID) String

func (id *SplitID) String() string

String returns UUIDv4 string representation of SplitID.

func (*SplitID) ToV2

func (id *SplitID) ToV2() []byte

ToV2 converts SplitID to a representation of SplitID in frostfs-api v2.

Nil SplitID converts to nil.

type SplitInfo

type SplitInfo object.SplitInfo

func NewSplitInfo

func NewSplitInfo() *SplitInfo

NewSplitInfo creates and initializes blank SplitInfo.

Defaults:

  • splitID: nil;
  • lastPart nil;
  • link: nil.

func NewSplitInfoFromV2

func NewSplitInfoFromV2(v2 *object.SplitInfo) *SplitInfo

NewSplitInfoFromV2 wraps v2 SplitInfo message to SplitInfo.

Nil object.SplitInfo converts to nil.

func (SplitInfo) LastPart

func (s SplitInfo) LastPart() (v oid.ID, isSet bool)
func (s SplitInfo) Link() (v oid.ID, isSet bool)

func (*SplitInfo) Marshal

func (s *SplitInfo) Marshal() ([]byte, error)

func (*SplitInfo) MarshalJSON

func (s *SplitInfo) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*SplitInfo) SetLastPart

func (s *SplitInfo) SetLastPart(v oid.ID)
func (s *SplitInfo) SetLink(v oid.ID)

func (*SplitInfo) SetSplitID

func (s *SplitInfo) SetSplitID(v *SplitID)

func (*SplitInfo) SplitID

func (s *SplitInfo) SplitID() *SplitID

func (*SplitInfo) ToV2

func (s *SplitInfo) ToV2() *object.SplitInfo

ToV2 converts SplitInfo to v2 SplitInfo message.

Nil SplitInfo converts to nil.

func (*SplitInfo) Unmarshal

func (s *SplitInfo) Unmarshal(data []byte) error

func (*SplitInfo) UnmarshalJSON

func (s *SplitInfo) UnmarshalJSON(data []byte) error

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

type Tombstone tombstone.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

func NewTombstoneFromV2(tV2 *tombstone.Tombstone) *Tombstone

NewTombstoneFromV2 wraps v2 Tombstone message to Tombstone.

Nil tombstone.Tombstone converts to nil.

func (*Tombstone) ExpirationEpoch

func (t *Tombstone) ExpirationEpoch() uint64

ExpirationEpoch returns the last FrostFS epoch number of the tombstone lifetime.

See also SetExpirationEpoch.

func (*Tombstone) Marshal

func (t *Tombstone) Marshal() ([]byte, error)

Marshal marshals Tombstone into a protobuf binary form.

func (*Tombstone) MarshalJSON

func (t *Tombstone) MarshalJSON() ([]byte, error)

MarshalJSON encodes Tombstone to protobuf JSON format.

func (*Tombstone) Members

func (t *Tombstone) Members() []oid.ID

Members returns list of objects to be deleted.

func (*Tombstone) SetExpirationEpoch

func (t *Tombstone) SetExpirationEpoch(v uint64)

SetExpirationEpoch sets the last FrostFS epoch number of the tombstone lifetime.

See also ExpirationEpoch.

func (*Tombstone) SetMembers

func (t *Tombstone) SetMembers(v []oid.ID)

SetMembers sets list of objects to be deleted.

func (*Tombstone) SetSplitID

func (t *Tombstone) SetSplitID(v *SplitID)

SetSplitID sets identifier of object split hierarchy.

func (*Tombstone) SplitID

func (t *Tombstone) SplitID() *SplitID

SplitID returns identifier of object split hierarchy.

func (*Tombstone) ToV2

func (t *Tombstone) ToV2() *tombstone.Tombstone

ToV2 converts Tombstone to v2 Tombstone message.

Nil Tombstone converts to nil.

func (*Tombstone) Unmarshal

func (t *Tombstone) Unmarshal(data []byte) error

Unmarshal unmarshals protobuf binary representation of Tombstone.

func (*Tombstone) UnmarshalJSON

func (t *Tombstone) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes Tombstone from protobuf JSON format.

type Type

type Type object.Type
const (
	TypeRegular Type = iota
	TypeTombstone

	TypeLock
)

func TypeFromV2

func TypeFromV2(t object.Type) Type

func (*Type) FromString

func (t *Type) FromString(s string) bool

FromString parses Type from a string representation. It is a reverse action to String().

Returns true if s was parsed successfully.

func (Type) String

func (t Type) String() string

String returns string representation of Type.

String mapping:

  • TypeTombstone: TOMBSTONE;
  • TypeLock: LOCK;
  • TypeRegular, default: REGULAR.

func (Type) ToV2

func (t Type) ToV2() object.Type

Directories

Path Synopsis
id
Package oid provides primitives to work with object identification in FrostFS.
Package oid provides primitives to work with object identification in FrostFS.
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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL