object

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_object_v1_object_proto protoreflect.FileDescriptor
View Source
var VersionZero = Version{}

Functions

This section is empty.

Types

type Object

type Object struct {

	// The object metadata that must be populated on both VersionVectors and Updates
	Key       []byte   `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`             // A unique key/id that represents the object across the namespace of the object type
	Namespace string   `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"` // The namespace of the object, used to disambiguate keys or different object types
	Version   *Version `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"`     // A version vector representing this objects current or latest version
	Region    string   `protobuf:"bytes,4,opt,name=region,proto3" json:"region,omitempty"`       // The region code where the data originated
	Owner     string   `protobuf:"bytes,5,opt,name=owner,proto3" json:"owner,omitempty"`         // The replica that created the object (identified as "pid:name" if name exists)
	// The object data that is only populated on Updates.
	Data []byte `protobuf:"bytes,10,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

An Object is a generic representation of a replicated piece of data. At the top level it contains enough metadata in order to detect changes during anti-entropy, specifically, given two objects, which is the later object (or does it need to be created or deleted). When used in VersionVectors only the metadata of the object is supplied. When passed via Updates, then the full data of the object is populated.

For research purposes, this anti-entropy mechanism tracks the region and owner of each object to determine provinence and global interactions. Because this is side channel information that may not necessarily be stored with the object data, it is recommended that an objects table be kept for fast lookups of object versions. Additionally, it is recommended that a history table be maintained locally so that Object versions can be rolled back to previous states where necessary.

func (*Object) Descriptor deprecated

func (*Object) Descriptor() ([]byte, []int)

Deprecated: Use Object.ProtoReflect.Descriptor instead.

func (*Object) GetData

func (x *Object) GetData() []byte

func (*Object) GetKey

func (x *Object) GetKey() []byte

func (*Object) GetNamespace

func (x *Object) GetNamespace() string

func (*Object) GetOwner

func (x *Object) GetOwner() string

func (*Object) GetRegion

func (x *Object) GetRegion() string

func (*Object) GetVersion

func (x *Object) GetVersion() *Version

func (*Object) ProtoMessage

func (*Object) ProtoMessage()

func (*Object) ProtoReflect

func (x *Object) ProtoReflect() protoreflect.Message

func (*Object) Reset

func (x *Object) Reset()

func (*Object) String

func (x *Object) String() string

func (*Object) Tombstone

func (o *Object) Tombstone() bool

Tombstone returns true if the version of the object is a Tombstone (for a deleted object)

type Version

type Version struct {
	Pid       uint64   `protobuf:"varint,1,opt,name=pid,proto3" json:"pid,omitempty"`             // Process ID - used to deconflict ties in the version number.
	Version   uint64   `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"`     // Montonically increasing version number.
	Region    string   `protobuf:"bytes,3,opt,name=region,proto3" json:"region,omitempty"`        // The region where the change occurred to track multi-region handling.
	Parent    *Version `protobuf:"bytes,4,opt,name=parent,proto3" json:"parent,omitempty"`        // In order to get a complete version history, identify the predessor; for compact data transfer parent should not be defined in parent version.
	Tombstone bool     `protobuf:"varint,5,opt,name=tombstone,proto3" json:"tombstone,omitempty"` // Set to true in order to mark the object as deleted
	// contains filtered or unexported fields
}

Implements a geo-distributed version as a Lamport Scalar

func (*Version) Clone added in v0.2.1

func (v *Version) Clone() *Version

Copies the child's attributes before updating to the parent.

func (*Version) Concurrent added in v0.2.7

func (v *Version) Concurrent(other *Version) bool

Concurrent returns true if and only if the Version scalars are equal but the PIDs are not equal. Nil is considered to be the zero valued Version.

func (*Version) Descriptor deprecated

func (*Version) Descriptor() ([]byte, []int)

Deprecated: Use Version.ProtoReflect.Descriptor instead.

func (*Version) Equal added in v0.2.7

func (v *Version) Equal(other *Version) bool

Equal returns true if and only if the Version scalars and PIDs are equal. Nil is considered to be the zero valued Version.

func (*Version) GetParent

func (x *Version) GetParent() *Version

func (*Version) GetPid

func (x *Version) GetPid() uint64

func (*Version) GetRegion

func (x *Version) GetRegion() string

func (*Version) GetTombstone

func (x *Version) GetTombstone() bool

func (*Version) GetVersion

func (x *Version) GetVersion() uint64

func (*Version) IsLater

func (v *Version) IsLater(other *Version) bool

IsLater returns true if the specified version is later than the other version. It returns false if the other version is later or equal to the specified version. If other is nil, it is considered equivalent to the zero-valued version.

Versions are Lamport Scalars composed of a monotonically increasing scalar component along with a tiebreaking component called the PID (the process ID of a replica). If the scalar is greater than the other scaler, then the Version is later. If the scalars are equal, then the version with the lower PID has higher precedence. Versions are conflict free so long as the processes that increment the scalar have a unique PID. E.g. if two processes concurrently increment the scalar to the same value then unique PIDs guarantee that one of those processes will have precedence. Lower PIDs are used for the higher precedence because of the PIDs are assigned in increasing order, then the lower PIDs are older replicas.

func (*Version) IsZero

func (v *Version) IsZero() bool

IsZero determines if the version is zero valued (e.g. the PID and Version are zero). Note that zero-valuation does not check parent or region.

func (*Version) LinearFrom added in v0.2.7

func (v *Version) LinearFrom(other *Version) bool

LinearFrom returns true if and only if the the parent of this version is equal to the other version. E.g. is this version created from the other version (a child of). LinearFrom implies that this version is later than the other version so long as the child is always later than the parent version.

NOTE: this method cannot detect a linear chain through multiple ancestors to the current version - it is a direct relationship only. A complete version history is required to compute a longer linear chain and branch points.

func (*Version) ProtoMessage

func (*Version) ProtoMessage()

func (*Version) ProtoReflect

func (x *Version) ProtoReflect() protoreflect.Message

func (*Version) Reset

func (x *Version) Reset()

func (*Version) Skips added in v0.2.7

func (v *Version) Skips(other *Version) bool

Skips returns true if and only if this version is later, is not concurrent (e.g. is not a stomp) and is not linear from the other version, e.g. this version is at least one version farther in the version history than the other version. Skips does not imply a stomp, though a stomp is possible in the version chain between the skip. Skips really mean that the replica does not have enough information to determine if a stomp has occurred or if we've just moved forward in a linear chain.

func (*Version) Stomps added in v0.2.7

func (v *Version) Stomps(other *Version) bool

Stomps returns true if and only if this version is both concurrent and later than the other version; e.g. this version is concurrent and would have precedence.

func (*Version) String

func (x *Version) String() string

Jump to

Keyboard shortcuts

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