Documentation
¶
Index ¶
- Variables
- type Object
- func (*Object) Descriptor() ([]byte, []int)deprecated
- func (x *Object) GetData() []byte
- func (x *Object) GetKey() []byte
- func (x *Object) GetNamespace() string
- func (x *Object) GetOwner() string
- func (x *Object) GetRegion() string
- func (x *Object) GetVersion() *Version
- func (*Object) ProtoMessage()
- func (x *Object) ProtoReflect() protoreflect.Message
- func (x *Object) Reset()
- func (x *Object) String() string
- func (o *Object) Tombstone() bool
- type Version
- func (v *Version) Clone() *Version
- func (v *Version) Concurrent(other *Version) bool
- func (*Version) Descriptor() ([]byte, []int)deprecated
- func (v *Version) Equal(other *Version) bool
- func (x *Version) GetParent() *Version
- func (x *Version) GetPid() uint64
- func (x *Version) GetRegion() string
- func (x *Version) GetTombstone() bool
- func (x *Version) GetVersion() uint64
- func (v *Version) IsLater(other *Version) bool
- func (v *Version) IsZero() bool
- func (v *Version) LinearFrom(other *Version) bool
- func (*Version) ProtoMessage()
- func (x *Version) ProtoReflect() protoreflect.Message
- func (x *Version) Reset()
- func (v *Version) Skips(other *Version) bool
- func (v *Version) Stomps(other *Version) bool
- func (x *Version) String() string
Constants ¶
This section is empty.
Variables ¶
var File_object_v1_object_proto protoreflect.FileDescriptor
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) GetNamespace ¶
func (*Object) GetVersion ¶
func (*Object) ProtoMessage ¶
func (*Object) ProtoMessage()
func (*Object) ProtoReflect ¶
func (x *Object) ProtoReflect() protoreflect.Message
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
Copies the child's attributes before updating to the parent.
func (*Version) Concurrent ¶ added in v0.2.7
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) Equal ¶ added in v0.2.7
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) GetTombstone ¶
func (*Version) GetVersion ¶
func (*Version) IsLater ¶
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 ¶
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
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) Skips ¶ added in v0.2.7
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.