consensus

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2025 License: AGPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Consensus_StealTableOwnership_FullMethodName = "/atlas.consensus.Consensus/StealTableOwnership"
	Consensus_WriteMigration_FullMethodName      = "/atlas.consensus.Consensus/WriteMigration"
	Consensus_AcceptMigration_FullMethodName     = "/atlas.consensus.Consensus/AcceptMigration"
	Consensus_JoinCluster_FullMethodName         = "/atlas.consensus.Consensus/JoinCluster"
	Consensus_Gossip_FullMethodName              = "/atlas.consensus.Consensus/Gossip"
	Consensus_Ping_FullMethodName                = "/atlas.consensus.Consensus/Ping"
	Consensus_ReadKey_FullMethodName             = "/atlas.consensus.Consensus/ReadKey"
	Consensus_WriteKey_FullMethodName            = "/atlas.consensus.Consensus/WriteKey"
	Consensus_DeleteKey_FullMethodName           = "/atlas.consensus.Consensus/DeleteKey"
	Consensus_PrefixScan_FullMethodName          = "/atlas.consensus.Consensus/PrefixScan"
)
View Source
const NodeTable = "atlas.nodes"

Variables

View Source
var (
	ReplicationLevel_name = map[int32]string{
		0: "global",
		1: "regional",
		2: "local",
	}
	ReplicationLevel_value = map[string]int32{
		"global":   0,
		"regional": 1,
		"local":    2,
	}
)

Enum value maps for ReplicationLevel.

View Source
var (
	TableType_name = map[int32]string{
		0: "table",
		1: "group",
		2: "trigger",
		3: "view",
		4: "sharded",
	}
	TableType_value = map[string]int32{
		"table":   0,
		"group":   1,
		"trigger": 2,
		"view":    3,
		"sharded": 4,
	}
)

Enum value maps for TableType.

View Source
var (
	StealReason_name = map[int32]string{
		0: "queryReason",
		1: "writeReason",
		2: "discoveryReason",
	}
	StealReason_value = map[string]int32{
		"queryReason":     0,
		"writeReason":     1,
		"discoveryReason": 2,
	}
)

Enum value maps for StealReason.

View Source
var Consensus_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "atlas.consensus.Consensus",
	HandlerType: (*ConsensusServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "StealTableOwnership",
			Handler:    _Consensus_StealTableOwnership_Handler,
		},
		{
			MethodName: "WriteMigration",
			Handler:    _Consensus_WriteMigration_Handler,
		},
		{
			MethodName: "AcceptMigration",
			Handler:    _Consensus_AcceptMigration_Handler,
		},
		{
			MethodName: "JoinCluster",
			Handler:    _Consensus_JoinCluster_Handler,
		},
		{
			MethodName: "Gossip",
			Handler:    _Consensus_Gossip_Handler,
		},
		{
			MethodName: "Ping",
			Handler:    _Consensus_Ping_Handler,
		},
		{
			MethodName: "ReadKey",
			Handler:    _Consensus_ReadKey_Handler,
		},
		{
			MethodName: "WriteKey",
			Handler:    _Consensus_WriteKey_Handler,
		},
		{
			MethodName: "DeleteKey",
			Handler:    _Consensus_DeleteKey_Handler,
		},
		{
			MethodName: "PrefixScan",
			Handler:    _Consensus_PrefixScan_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "consensus/consensus.proto",
}

Consensus_ServiceDesc is the grpc.ServiceDesc for Consensus service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var ErrCannotChangeReplicationLevel = errors.New("cannot change replication level of a table")
View Source
var ErrCannotStealGroupOwnership = errors.New("cannot steal ownership of a table in a group")
View Source
var ErrKVPoolNotInitialized = errors.New("KV pool not initialized")
View Source
var ErrMetadataStoreClosed = errors.New("metadata store closed")
View Source
var ErrTablePolicyViolation = errors.New("table policy violation")
View Source
var File_consensus_consensus_proto protoreflect.FileDescriptor

Functions

func CreateACLKey added in v0.1.0

func CreateACLKey(key string) string

CreateACLKey creates an ACL metadata key for a given data key. Uses the same colon-separated format as the rest of Atlas-DB.

func CreateReadACLKey added in v0.1.0

func CreateReadACLKey(key string) string

CreateReadACLKey creates an ACL metadata key for READ permissions for a given data key.

func CreateWriteACLKey added in v0.1.0

func CreateWriteACLKey(key string) string

CreateWriteACLKey creates an ACL metadata key for WRITE permissions for a given data key.

func DescribeQuorum added in v0.1.0

func DescribeQuorum(ctx context.Context, table string) (q1 []*QuorumNode, q2 []*QuorumNode, err error)

DescribeQuorum computes and returns diagnostic information about the potential quorum for a given table, showing all known nodes regardless of their current health status. This is intended for diagnostic purposes only.

func GrantACLToKey added in v0.1.0

func GrantACLToKey(ctx context.Context, metaStore interface {
	Get(context.Context, []byte) ([]byte, error)
	Put(context.Context, []byte, []byte) error
}, key, principal string) error

GrantACLToKey grants access to a principal for a specific key by updating ACL metadata. This is designed to be used via WriteKey operations to ensure consensus.

func GrantACLToKeyWithPermission added in v0.1.0

func GrantACLToKeyWithPermission(ctx context.Context, metaStore interface {
	Get(context.Context, []byte) ([]byte, error)
	Put(context.Context, []byte, []byte) error
}, key, principal, permission string) error

GrantACLToKeyWithPermission grants a specific permission (READ, WRITE, OWNER) to a principal for the given key by updating the appropriate ACL metadata key. OWNER maps to the base ACL key and implies full access.

func HasPrincipal added in v0.1.0

func HasPrincipal(aclData *ACLData, principal string) bool

HasPrincipal checks if a principal exists in the ACL data.

func RegisterConsensusServer added in v0.1.0

func RegisterConsensusServer(s grpc.ServiceRegistrar, srv ConsensusServer)

func RevokeACLFromKey added in v0.1.0

func RevokeACLFromKey(ctx context.Context, metaStore interface {
	Get(context.Context, []byte) ([]byte, error)
	Put(context.Context, []byte, []byte) error
	Delete(context.Context, []byte) error
}, key, principal string) error

RevokeACLFromKey revokes access from a principal for a specific key by updating ACL metadata. This is designed to be used via WriteKey operations to ensure consensus.

func RevokeACLFromKeyWithPermission added in v0.1.0

func RevokeACLFromKeyWithPermission(ctx context.Context, metaStore interface {
	Get(context.Context, []byte) ([]byte, error)
	Put(context.Context, []byte, []byte) error
	Delete(context.Context, []byte) error
}, key, principal, permission string) error

RevokeACLFromKeyWithPermission revokes a specific permission (READ, WRITE, OWNER) from a principal for the given key by updating the appropriate ACL metadata key. OWNER maps to the base ACL key and implies full access.

func SendGossip

func SendGossip(ctx context.Context, req *GossipMigration, kvStore kv.Store) error

Types

type ACL added in v0.1.0

type ACL struct {
	Owners  *ACLData `protobuf:"bytes,1,opt,name=owners,proto3" json:"owners,omitempty"`
	Readers *ACLData `protobuf:"bytes,2,opt,name=readers,proto3" json:"readers,omitempty"`
	Writers *ACLData `protobuf:"bytes,3,opt,name=writers,proto3" json:"writers,omitempty"`
	// contains filtered or unexported fields
}

func (*ACL) Descriptor deprecated added in v0.1.0

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

Deprecated: Use ACL.ProtoReflect.Descriptor instead.

func (*ACL) GetOwners added in v0.1.0

func (x *ACL) GetOwners() *ACLData

func (*ACL) GetReaders added in v0.1.0

func (x *ACL) GetReaders() *ACLData

func (*ACL) GetWriters added in v0.1.0

func (x *ACL) GetWriters() *ACLData

func (*ACL) ProtoMessage added in v0.1.0

func (*ACL) ProtoMessage()

func (*ACL) ProtoReflect added in v0.1.0

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

func (*ACL) Reset added in v0.1.0

func (x *ACL) Reset()

func (*ACL) String added in v0.1.0

func (x *ACL) String() string

type ACLData added in v0.1.0

type ACLData struct {
	Principals []string               `protobuf:"bytes,1,rep,name=principals,proto3" json:"principals,omitempty"`                // List of principals with access to this key
	CreatedAt  *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` // When ACL was created
	UpdatedAt  *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` // When ACL was last modified
	// contains filtered or unexported fields
}

ACL data structure for protobuf encoding

func DecodeACLData added in v0.1.0

func DecodeACLData(b []byte) (*ACLData, error)

DecodeACLData decodes bytes to ACLData protobuf message.

func (*ACLData) Descriptor deprecated added in v0.1.0

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

Deprecated: Use ACLData.ProtoReflect.Descriptor instead.

func (*ACLData) GetCreatedAt added in v0.1.0

func (x *ACLData) GetCreatedAt() *timestamppb.Timestamp

func (*ACLData) GetPrincipals added in v0.1.0

func (x *ACLData) GetPrincipals() []string

func (*ACLData) GetUpdatedAt added in v0.1.0

func (x *ACLData) GetUpdatedAt() *timestamppb.Timestamp

func (*ACLData) ProtoMessage added in v0.1.0

func (*ACLData) ProtoMessage()

func (*ACLData) ProtoReflect added in v0.1.0

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

func (*ACLData) Reset added in v0.1.0

func (x *ACLData) Reset()

func (*ACLData) String added in v0.1.0

func (x *ACLData) String() string

type AclChange added in v0.1.0

type AclChange struct {
	Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	// Types that are valid to be assigned to Change:
	//
	//	*AclChange_Addition
	//	*AclChange_Deletion
	Change isAclChange_Change `protobuf_oneof:"change"`
	// contains filtered or unexported fields
}

func (*AclChange) Descriptor deprecated added in v0.1.0

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

Deprecated: Use AclChange.ProtoReflect.Descriptor instead.

func (*AclChange) GetAddition added in v0.1.0

func (x *AclChange) GetAddition() *ACL

func (*AclChange) GetChange added in v0.1.0

func (x *AclChange) GetChange() isAclChange_Change

func (*AclChange) GetDeletion added in v0.1.0

func (x *AclChange) GetDeletion() *ACL

func (*AclChange) GetKey added in v0.1.0

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

func (*AclChange) ProtoMessage added in v0.1.0

func (*AclChange) ProtoMessage()

func (*AclChange) ProtoReflect added in v0.1.0

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

func (*AclChange) Reset added in v0.1.0

func (x *AclChange) Reset()

func (*AclChange) String added in v0.1.0

func (x *AclChange) String() string

type AclChange_Addition added in v0.1.0

type AclChange_Addition struct {
	Addition *ACL `protobuf:"bytes,2,opt,name=addition,proto3,oneof"`
}

type AclChange_Deletion added in v0.1.0

type AclChange_Deletion struct {
	Deletion *ACL `protobuf:"bytes,3,opt,name=deletion,proto3,oneof"`
}

type ConsensusClient added in v0.1.0

type ConsensusClient interface {
	StealTableOwnership(ctx context.Context, in *StealTableOwnershipRequest, opts ...grpc.CallOption) (*StealTableOwnershipResponse, error)
	WriteMigration(ctx context.Context, in *WriteMigrationRequest, opts ...grpc.CallOption) (*WriteMigrationResponse, error)
	AcceptMigration(ctx context.Context, in *WriteMigrationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
	JoinCluster(ctx context.Context, in *Node, opts ...grpc.CallOption) (*JoinClusterResponse, error)
	Gossip(ctx context.Context, in *GossipMigration, opts ...grpc.CallOption) (*emptypb.Empty, error)
	Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingResponse, error)
	ReadKey(ctx context.Context, in *ReadKeyRequest, opts ...grpc.CallOption) (*ReadKeyResponse, error)
	WriteKey(ctx context.Context, in *WriteKeyRequest, opts ...grpc.CallOption) (*WriteKeyResponse, error)
	DeleteKey(ctx context.Context, in *WriteKeyRequest, opts ...grpc.CallOption) (*WriteKeyResponse, error)
	PrefixScan(ctx context.Context, in *PrefixScanRequest, opts ...grpc.CallOption) (*PrefixScanResponse, error)
}

ConsensusClient is the client API for Consensus service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewConsensusClient added in v0.1.0

func NewConsensusClient(cc grpc.ClientConnInterface) ConsensusClient

type ConsensusServer added in v0.1.0

ConsensusServer is the server API for Consensus service. All implementations must embed UnimplementedConsensusServer for forward compatibility.

type DataMigration added in v0.1.0

type DataMigration struct {
	Time *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=time,proto3" json:"time,omitempty"`
	// Types that are valid to be assigned to Session:
	//
	//	*DataMigration_Change
	Session isDataMigration_Session `protobuf_oneof:"session"`
	// contains filtered or unexported fields
}

func (*DataMigration) Descriptor deprecated added in v0.1.0

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

Deprecated: Use DataMigration.ProtoReflect.Descriptor instead.

func (*DataMigration) GetChange added in v0.1.0

func (x *DataMigration) GetChange() *KVChange

func (*DataMigration) GetSession added in v0.1.0

func (x *DataMigration) GetSession() isDataMigration_Session

func (*DataMigration) GetTime added in v0.1.0

func (x *DataMigration) GetTime() *timestamppb.Timestamp

func (*DataMigration) ProtoMessage added in v0.1.0

func (*DataMigration) ProtoMessage()

func (*DataMigration) ProtoReflect added in v0.1.0

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

func (*DataMigration) Reset added in v0.1.0

func (x *DataMigration) Reset()

func (*DataMigration) String added in v0.1.0

func (x *DataMigration) String() string

type DataMigration_Change added in v0.1.0

type DataMigration_Change struct {
	Change *KVChange `protobuf:"bytes,2,opt,name=change,proto3,oneof"`
}

type DelChange added in v0.1.0

type DelChange struct {
	Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	// contains filtered or unexported fields
}

func (*DelChange) Descriptor deprecated added in v0.1.0

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

Deprecated: Use DelChange.ProtoReflect.Descriptor instead.

func (*DelChange) GetKey added in v0.1.0

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

func (*DelChange) ProtoMessage added in v0.1.0

func (*DelChange) ProtoMessage()

func (*DelChange) ProtoReflect added in v0.1.0

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

func (*DelChange) Reset added in v0.1.0

func (x *DelChange) Reset()

func (*DelChange) String added in v0.1.0

func (x *DelChange) String() string

type ErrStealTableOwnershipFailed

type ErrStealTableOwnershipFailed struct {
	Table *Table
}

func (ErrStealTableOwnershipFailed) Error

type GossipMigration added in v0.1.0

type GossipMigration struct {
	MigrationRequest  *Migration        `protobuf:"bytes,1,opt,name=migrationRequest,proto3" json:"migrationRequest,omitempty"`   // The migration to be gossiped
	Table             *Table            `protobuf:"bytes,2,opt,name=table,proto3" json:"table,omitempty"`                         // The table the migration is for
	PreviousMigration *MigrationVersion `protobuf:"bytes,3,opt,name=previousMigration,proto3" json:"previousMigration,omitempty"` // The previous migration
	Ttl               int64             `protobuf:"varint,4,opt,name=ttl,proto3" json:"ttl,omitempty"`                            // The time to live of the gossip
	Sender            *Node             `protobuf:"bytes,5,opt,name=sender,proto3" json:"sender,omitempty"`                       // The node sending the gossip
	// contains filtered or unexported fields
}

func (*GossipMigration) Descriptor deprecated added in v0.1.0

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

Deprecated: Use GossipMigration.ProtoReflect.Descriptor instead.

func (*GossipMigration) GetMigrationRequest added in v0.1.0

func (x *GossipMigration) GetMigrationRequest() *Migration

func (*GossipMigration) GetPreviousMigration added in v0.1.0

func (x *GossipMigration) GetPreviousMigration() *MigrationVersion

func (*GossipMigration) GetSender added in v0.1.0

func (x *GossipMigration) GetSender() *Node

func (*GossipMigration) GetTable added in v0.1.0

func (x *GossipMigration) GetTable() *Table

func (*GossipMigration) GetTtl added in v0.1.0

func (x *GossipMigration) GetTtl() int64

func (*GossipMigration) ProtoMessage added in v0.1.0

func (*GossipMigration) ProtoMessage()

func (*GossipMigration) ProtoReflect added in v0.1.0

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

func (*GossipMigration) Reset added in v0.1.0

func (x *GossipMigration) Reset()

func (*GossipMigration) String added in v0.1.0

func (x *GossipMigration) String() string

type HealthChecker

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

HealthChecker monitors node health and maintains active node lists

func NewHealthChecker

func NewHealthChecker(manager *NodeConnectionManager) *HealthChecker

func NewHealthCheckerForTesting

func NewHealthCheckerForTesting(manager *NodeConnectionManager) *HealthChecker

NewHealthCheckerForTesting creates a health checker with no jitter for testing

func (*HealthChecker) GetHealthStats

func (hc *HealthChecker) GetHealthStats() *HealthStats

func (*HealthChecker) Start

func (hc *HealthChecker) Start(ctx context.Context)

Start begins the health checking routine

func (*HealthChecker) Stop

func (hc *HealthChecker) Stop()

Stop halts the health checking routine

type HealthStats

type HealthStats struct {
	TotalNodes    int64            `json:"total_nodes"`
	ActiveNodes   int64            `json:"active_nodes"`
	FailedNodes   int64            `json:"failed_nodes"`
	RegionStats   map[string]int64 `json:"region_stats"`
	AverageRTT    time.Duration    `json:"average_rtt"`
	LastCheckTime time.Time        `json:"last_check_time"`
}

GetHealthStats returns health statistics for monitoring

type JoinClusterResponse added in v0.1.0

type JoinClusterResponse struct {
	Success bool   `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` // Whether the operation was successful
	Table   *Table `protobuf:"bytes,2,opt,name=table,proto3" json:"table,omitempty"`      // The current node table if the requested node is not the owner
	NodeId  int64  `protobuf:"varint,3,opt,name=nodeId,proto3" json:"nodeId,omitempty"`   // The ID of the newly joined node
	// contains filtered or unexported fields
}

func (*JoinClusterResponse) Descriptor deprecated added in v0.1.0

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

Deprecated: Use JoinClusterResponse.ProtoReflect.Descriptor instead.

func (*JoinClusterResponse) GetNodeId added in v0.1.0

func (x *JoinClusterResponse) GetNodeId() int64

func (*JoinClusterResponse) GetSuccess added in v0.1.0

func (x *JoinClusterResponse) GetSuccess() bool

func (*JoinClusterResponse) GetTable added in v0.1.0

func (x *JoinClusterResponse) GetTable() *Table

func (*JoinClusterResponse) ProtoMessage added in v0.1.0

func (*JoinClusterResponse) ProtoMessage()

func (*JoinClusterResponse) ProtoReflect added in v0.1.0

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

func (*JoinClusterResponse) Reset added in v0.1.0

func (x *JoinClusterResponse) Reset()

func (*JoinClusterResponse) String added in v0.1.0

func (x *JoinClusterResponse) String() string

type KVChange added in v0.1.0

type KVChange struct {

	// Types that are valid to be assigned to Operation:
	//
	//	*KVChange_Set
	//	*KVChange_Del
	//	*KVChange_Data
	//	*KVChange_Acl
	Operation isKVChange_Operation `protobuf_oneof:"operation"`
	// contains filtered or unexported fields
}

func (*KVChange) Descriptor deprecated added in v0.1.0

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

Deprecated: Use KVChange.ProtoReflect.Descriptor instead.

func (*KVChange) GetAcl added in v0.1.0

func (x *KVChange) GetAcl() *AclChange

func (*KVChange) GetData added in v0.1.0

func (x *KVChange) GetData() *RawData

func (*KVChange) GetDel added in v0.1.0

func (x *KVChange) GetDel() *DelChange

func (*KVChange) GetOperation added in v0.1.0

func (x *KVChange) GetOperation() isKVChange_Operation

func (*KVChange) GetSet added in v0.1.0

func (x *KVChange) GetSet() *SetChange

func (*KVChange) ProtoMessage added in v0.1.0

func (*KVChange) ProtoMessage()

func (*KVChange) ProtoReflect added in v0.1.0

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

func (*KVChange) Reset added in v0.1.0

func (x *KVChange) Reset()

func (*KVChange) String added in v0.1.0

func (x *KVChange) String() string

type KVChange_Acl added in v0.1.0

type KVChange_Acl struct {
	Acl *AclChange `protobuf:"bytes,4,opt,name=acl,proto3,oneof"`
}

type KVChange_Data added in v0.1.0

type KVChange_Data struct {
	Data *RawData `protobuf:"bytes,3,opt,name=data,proto3,oneof"`
}

type KVChange_Del added in v0.1.0

type KVChange_Del struct {
	Del *DelChange `protobuf:"bytes,2,opt,name=del,proto3,oneof"`
}

type KVChange_Set added in v0.1.0

type KVChange_Set struct {
	Set *SetChange `protobuf:"bytes,1,opt,name=set,proto3,oneof"`
}

type KVConsensusAdapter

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

KVConsensusAdapter provides a clean interface for KV operations using the existing w-paxos consensus

func NewKVConsensusAdapter

func NewKVConsensusAdapter(server *Server, kvStore kv.Store) *KVConsensusAdapter

NewKVConsensusAdapter creates a new KV consensus adapter

func (*KVConsensusAdapter) GetKey

func (a *KVConsensusAdapter) GetKey(ctx context.Context, key string) ([]byte, error)

GetKey implements distributed GET operation with freshness checking

type ManagedNode

type ManagedNode struct {
	*Node
	// contains filtered or unexported fields
}

ManagedNode represents a node with its connection state

func (*ManagedNode) AddRTTMeasurement

func (m *ManagedNode) AddRTTMeasurement(rtt time.Duration)

func (*ManagedNode) Close

func (m *ManagedNode) Close()

func (*ManagedNode) GetAverageRTT

func (m *ManagedNode) GetAverageRTT() time.Duration

func (*ManagedNode) GetFailures

func (m *ManagedNode) GetFailures() int64

func (*ManagedNode) GetStatus

func (m *ManagedNode) GetStatus() NodeStatus

func (*ManagedNode) UpdateStatus

func (m *ManagedNode) UpdateStatus(status NodeStatus)

type Migration added in v0.1.0

type Migration struct {
	Version *MigrationVersion `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` // The version of the migration
	// Types that are valid to be assigned to Migration:
	//
	//	*Migration_Schema
	//	*Migration_Data
	//	*Migration_None
	Migration isMigration_Migration `protobuf_oneof:"migration"`
	// contains filtered or unexported fields
}

func (*Migration) Descriptor deprecated added in v0.1.0

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

Deprecated: Use Migration.ProtoReflect.Descriptor instead.

func (*Migration) GetData added in v0.1.0

func (x *Migration) GetData() *DataMigration

func (*Migration) GetMigration added in v0.1.0

func (x *Migration) GetMigration() isMigration_Migration

func (*Migration) GetNone added in v0.1.0

func (x *Migration) GetNone() *NilMigration

func (*Migration) GetSchema added in v0.1.0

func (x *Migration) GetSchema() *SchemaMigration

func (*Migration) GetVersion added in v0.1.0

func (x *Migration) GetVersion() *MigrationVersion

func (*Migration) ProtoMessage added in v0.1.0

func (*Migration) ProtoMessage()

func (*Migration) ProtoReflect added in v0.1.0

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

func (*Migration) Reset added in v0.1.0

func (x *Migration) Reset()

func (*Migration) String added in v0.1.0

func (x *Migration) String() string

type MigrationRepository

type MigrationRepository interface {
	// GetUncommittedMigrations returns all uncommitted migrations -- from when this node was part of a previous quorum -- for a given table.
	GetUncommittedMigrations(table *Table) ([]*Migration, error)
	// AddMigration adds a migration to the migration table.
	AddMigration(migration *Migration) error
	// GetMigrationVersion returns all migrations for a given version.
	GetMigrationVersion(version *MigrationVersion) ([]*Migration, error)
	// CommitAllMigrations commits all migrations for a given table.
	CommitAllMigrations(table string) error
	// CommitMigrationExact commits a migration for a given version.
	CommitMigrationExact(version *MigrationVersion) error
	// AddGossipMigration adds a migration to the migration table as a gossiped migration.
	AddGossipMigration(migration *Migration) error
	// GetNextVersion returns the next version for a given table.
	GetNextVersion(table string) (int64, error)
}

MigrationRepository is an interface that allows getting and maintaining migrations, which are uniquely identified by a table, table version, migration version, and sender.

func NewMigrationRepositoryKV

func NewMigrationRepositoryKV(ctx context.Context, store kv.Store) MigrationRepository

NewMigrationRepositoryKV creates a new KV-based migration repository

type MigrationRepositoryKV

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

MigrationRepositoryKV implements MigrationRepository using key-value operations

func (*MigrationRepositoryKV) AddGossipMigration

func (m *MigrationRepositoryKV) AddGossipMigration(migration *Migration) error

func (*MigrationRepositoryKV) AddMigration

func (m *MigrationRepositoryKV) AddMigration(migration *Migration) error

func (*MigrationRepositoryKV) CommitAllMigrations

func (m *MigrationRepositoryKV) CommitAllMigrations(table string) error

func (*MigrationRepositoryKV) CommitMigrationExact

func (m *MigrationRepositoryKV) CommitMigrationExact(version *MigrationVersion) error

func (*MigrationRepositoryKV) DeleteMigration

func (m *MigrationRepositoryKV) DeleteMigration(version *MigrationVersion) error

DeleteMigration removes a migration (useful for cleanup)

func (*MigrationRepositoryKV) GetMigrationVersion

func (m *MigrationRepositoryKV) GetMigrationVersion(version *MigrationVersion) ([]*Migration, error)

func (*MigrationRepositoryKV) GetMigrationsByTable

func (m *MigrationRepositoryKV) GetMigrationsByTable(tableName string) ([]*Migration, error)

GetMigrationsByTable provides efficient querying of migrations by table

func (*MigrationRepositoryKV) GetNextVersion

func (m *MigrationRepositoryKV) GetNextVersion(table string) (int64, error)

func (*MigrationRepositoryKV) GetUncommittedMigrations

func (m *MigrationRepositoryKV) GetUncommittedMigrations(table *Table) ([]*Migration, error)

type MigrationVersion added in v0.1.0

type MigrationVersion struct {
	TableVersion     int64  `protobuf:"varint,1,opt,name=tableVersion,proto3" json:"tableVersion,omitempty"`         // The version of the table
	MigrationVersion int64  `protobuf:"varint,2,opt,name=migrationVersion,proto3" json:"migrationVersion,omitempty"` // The version of the migration
	NodeId           int64  `protobuf:"varint,3,opt,name=nodeId,proto3" json:"nodeId,omitempty"`                     // The ID of the node
	TableName        string `protobuf:"bytes,4,opt,name=tableName,proto3" json:"tableName,omitempty"`                // The name of the table
	// contains filtered or unexported fields
}

func (*MigrationVersion) Descriptor deprecated added in v0.1.0

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

Deprecated: Use MigrationVersion.ProtoReflect.Descriptor instead.

func (*MigrationVersion) GetMigrationVersion added in v0.1.0

func (x *MigrationVersion) GetMigrationVersion() int64

func (*MigrationVersion) GetNodeId added in v0.1.0

func (x *MigrationVersion) GetNodeId() int64

func (*MigrationVersion) GetTableName added in v0.1.0

func (x *MigrationVersion) GetTableName() string

func (*MigrationVersion) GetTableVersion added in v0.1.0

func (x *MigrationVersion) GetTableVersion() int64

func (*MigrationVersion) ProtoMessage added in v0.1.0

func (*MigrationVersion) ProtoMessage()

func (*MigrationVersion) ProtoReflect added in v0.1.0

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

func (*MigrationVersion) Reset added in v0.1.0

func (x *MigrationVersion) Reset()

func (*MigrationVersion) String added in v0.1.0

func (x *MigrationVersion) String() string

type Migration_Data added in v0.1.0

type Migration_Data struct {
	Data *DataMigration `protobuf:"bytes,3,opt,name=data,proto3,oneof"` // The data migration
}

type Migration_None added in v0.1.0

type Migration_None struct {
	None *NilMigration `protobuf:"bytes,4,opt,name=none,proto3,oneof"` // Represents a read
}

type Migration_Schema added in v0.1.0

type Migration_Schema struct {
	Schema *SchemaMigration `protobuf:"bytes,2,opt,name=schema,proto3,oneof"` // The schema migration
}

type NilMigration added in v0.1.0

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

func (*NilMigration) Descriptor deprecated added in v0.1.0

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

Deprecated: Use NilMigration.ProtoReflect.Descriptor instead.

func (*NilMigration) ProtoMessage added in v0.1.0

func (*NilMigration) ProtoMessage()

func (*NilMigration) ProtoReflect added in v0.1.0

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

func (*NilMigration) Reset added in v0.1.0

func (x *NilMigration) Reset()

func (*NilMigration) String added in v0.1.0

func (x *NilMigration) String() string

type Node added in v0.1.0

type Node struct {
	Id      int64                `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`          // The ID of the node
	Address string               `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` // The address of the node
	Region  *Region              `protobuf:"bytes,3,opt,name=region,proto3" json:"region,omitempty"`   // The region the node is in
	Port    int64                `protobuf:"varint,4,opt,name=port,proto3" json:"port,omitempty"`      // The port the node listens on
	Active  bool                 `protobuf:"varint,5,opt,name=active,proto3" json:"active,omitempty"`  // Whether the node is active
	Rtt     *durationpb.Duration `protobuf:"bytes,6,opt,name=rtt,proto3" json:"rtt,omitempty"`         // The round trip time to the node
	// contains filtered or unexported fields
}

func (*Node) Descriptor deprecated added in v0.1.0

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

Deprecated: Use Node.ProtoReflect.Descriptor instead.

func (*Node) GetActive added in v0.1.0

func (x *Node) GetActive() bool

func (*Node) GetAddress added in v0.1.0

func (x *Node) GetAddress() string

func (*Node) GetId added in v0.1.0

func (x *Node) GetId() int64

func (*Node) GetPort added in v0.1.0

func (x *Node) GetPort() int64

func (*Node) GetRegion added in v0.1.0

func (x *Node) GetRegion() *Region

func (*Node) GetRtt added in v0.1.0

func (x *Node) GetRtt() *durationpb.Duration

func (*Node) ProtoMessage added in v0.1.0

func (*Node) ProtoMessage()

func (*Node) ProtoReflect added in v0.1.0

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

func (*Node) Reset added in v0.1.0

func (x *Node) Reset()

func (*Node) String added in v0.1.0

func (x *Node) String() string

type NodeConnectionManager

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

NodeConnectionManager centralizes all node connection management

func GetNodeConnectionManager

func GetNodeConnectionManager(ctx context.Context) *NodeConnectionManager

GetNodeConnectionManager returns the singleton connection manager

func (*NodeConnectionManager) AddNode

func (ncm *NodeConnectionManager) AddNode(ctx context.Context, node *Node) error

AddNode registers a new node and attempts connection

func (*NodeConnectionManager) ExecuteOnNode

func (ncm *NodeConnectionManager) ExecuteOnNode(nodeID int64, operation func(ConsensusClient) error) error

ExecuteOnNode executes a consensus operation on a specific node

func (*NodeConnectionManager) GetActiveNodesByRegion

func (ncm *NodeConnectionManager) GetActiveNodesByRegion(region string) []*ManagedNode

GetActiveNodesByRegion returns currently reachable nodes in a region

func (*NodeConnectionManager) GetAllActiveNodes

func (ncm *NodeConnectionManager) GetAllActiveNodes() map[string][]*ManagedNode

GetAllActiveNodes returns all currently reachable nodes

func (*NodeConnectionManager) Shutdown

func (ncm *NodeConnectionManager) Shutdown()

Shutdown gracefully closes all connections and stops background processes

type NodeRepository

type NodeRepository interface {
	GetNodeById(id int64) (*Node, error)
	GetNodeByAddress(address string, port uint) (*Node, error)
	GetNodesByRegion(region string) ([]*Node, error)
	GetRegions() ([]*Region, error)
	Iterate(fn func(*Node) error) error
	TotalCount() (int64, error)
	GetRandomNodes(num int64, excluding ...int64) ([]*Node, error)
}

func NewNodeRepositoryKV

func NewNodeRepositoryKV(ctx context.Context, store kv.Store) NodeRepository

NewNodeRepositoryKV creates a new KV-based node repository

type NodeRepositoryKV

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

NodeRepositoryKV implements NodeRepository using key-value operations

func (*NodeRepositoryKV) AddNode

func (n *NodeRepositoryKV) AddNode(node *Node) error

AddNode adds a new node to the repository

func (*NodeRepositoryKV) DeleteNode

func (n *NodeRepositoryKV) DeleteNode(nodeID int64) error

DeleteNode removes a node from the repository

func (*NodeRepositoryKV) GetNodeByAddress

func (n *NodeRepositoryKV) GetNodeByAddress(address string, port uint) (*Node, error)

func (*NodeRepositoryKV) GetNodeById

func (n *NodeRepositoryKV) GetNodeById(id int64) (*Node, error)

func (*NodeRepositoryKV) GetNodesByRegion

func (n *NodeRepositoryKV) GetNodesByRegion(region string) ([]*Node, error)

func (*NodeRepositoryKV) GetRandomNodes

func (n *NodeRepositoryKV) GetRandomNodes(num int64, excluding ...int64) ([]*Node, error)

func (*NodeRepositoryKV) GetRegions

func (n *NodeRepositoryKV) GetRegions() ([]*Region, error)

func (*NodeRepositoryKV) Iterate

func (n *NodeRepositoryKV) Iterate(fn func(*Node) error) error

func (*NodeRepositoryKV) TotalCount

func (n *NodeRepositoryKV) TotalCount() (int64, error)

func (*NodeRepositoryKV) UpdateNode

func (n *NodeRepositoryKV) UpdateNode(node *Node) error

UpdateNode updates an existing node

type NodeStatus

type NodeStatus int
const (
	NodeStatusUnknown NodeStatus = iota
	NodeStatusConnecting
	NodeStatusActive
	NodeStatusFailed
	NodeStatusRemoved
)

type NodeStorageModel

type NodeStorageModel struct {
	ID        int64     `json:"id"`
	Address   string    `json:"address"`
	Port      int64     `json:"port"`
	Region    string    `json:"region"`
	Active    bool      `json:"active"`
	RTT       int64     `json:"rtt_nanoseconds"`
	CreatedAt time.Time `json:"created_at"`
}

NodeStorageModel represents node data in KV storage

type NodeStorageModelKV

type NodeStorageModelKV struct {
	ID        int64     `json:"id"`
	Address   string    `json:"address"`
	Port      int64     `json:"port"`
	Region    string    `json:"region"`
	Active    bool      `json:"active"`
	RTT       int64     `json:"rtt_nanoseconds"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

NodeStorageModelKV represents how node data is stored in KV format

type PingRequest added in v0.1.0

type PingRequest struct {
	SenderNodeId int64                  `protobuf:"varint,1,opt,name=sender_node_id,json=senderNodeId,proto3" json:"sender_node_id,omitempty"` // The ID of the node sending the ping
	Timestamp    *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"`                              // Timestamp of the ping
	// contains filtered or unexported fields
}

Ping messages for health checks

func (*PingRequest) Descriptor deprecated added in v0.1.0

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

Deprecated: Use PingRequest.ProtoReflect.Descriptor instead.

func (*PingRequest) GetSenderNodeId added in v0.1.0

func (x *PingRequest) GetSenderNodeId() int64

func (*PingRequest) GetTimestamp added in v0.1.0

func (x *PingRequest) GetTimestamp() *timestamppb.Timestamp

func (*PingRequest) ProtoMessage added in v0.1.0

func (*PingRequest) ProtoMessage()

func (*PingRequest) ProtoReflect added in v0.1.0

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

func (*PingRequest) Reset added in v0.1.0

func (x *PingRequest) Reset()

func (*PingRequest) String added in v0.1.0

func (x *PingRequest) String() string

type PingResponse added in v0.1.0

type PingResponse struct {
	Success         bool                   `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`                                          // Whether the ping was successful
	ResponderNodeId int64                  `protobuf:"varint,2,opt,name=responder_node_id,json=responderNodeId,proto3" json:"responder_node_id,omitempty"` // The ID of the node responding
	Timestamp       *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"`                                       // Timestamp of the response
	// contains filtered or unexported fields
}

func (*PingResponse) Descriptor deprecated added in v0.1.0

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

Deprecated: Use PingResponse.ProtoReflect.Descriptor instead.

func (*PingResponse) GetResponderNodeId added in v0.1.0

func (x *PingResponse) GetResponderNodeId() int64

func (*PingResponse) GetSuccess added in v0.1.0

func (x *PingResponse) GetSuccess() bool

func (*PingResponse) GetTimestamp added in v0.1.0

func (x *PingResponse) GetTimestamp() *timestamppb.Timestamp

func (*PingResponse) ProtoMessage added in v0.1.0

func (*PingResponse) ProtoMessage()

func (*PingResponse) ProtoReflect added in v0.1.0

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

func (*PingResponse) Reset added in v0.1.0

func (x *PingResponse) Reset()

func (*PingResponse) String added in v0.1.0

func (x *PingResponse) String() string

type PrefixScanRequest added in v0.1.0

type PrefixScanRequest struct {
	Sender      *Node  `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"`
	TablePrefix string `protobuf:"bytes,2,opt,name=tablePrefix,proto3" json:"tablePrefix,omitempty"`
	RowPrefix   string `protobuf:"bytes,3,opt,name=rowPrefix,proto3" json:"rowPrefix,omitempty"`
	// contains filtered or unexported fields
}

Remote prefix scan

func (*PrefixScanRequest) Descriptor deprecated added in v0.1.0

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

Deprecated: Use PrefixScanRequest.ProtoReflect.Descriptor instead.

func (*PrefixScanRequest) GetRowPrefix added in v0.1.0

func (x *PrefixScanRequest) GetRowPrefix() string

func (*PrefixScanRequest) GetSender added in v0.1.0

func (x *PrefixScanRequest) GetSender() *Node

func (*PrefixScanRequest) GetTablePrefix added in v0.1.0

func (x *PrefixScanRequest) GetTablePrefix() string

func (*PrefixScanRequest) ProtoMessage added in v0.1.0

func (*PrefixScanRequest) ProtoMessage()

func (*PrefixScanRequest) ProtoReflect added in v0.1.0

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

func (*PrefixScanRequest) Reset added in v0.1.0

func (x *PrefixScanRequest) Reset()

func (*PrefixScanRequest) String added in v0.1.0

func (x *PrefixScanRequest) String() string

type PrefixScanResponse added in v0.1.0

type PrefixScanResponse struct {
	Success bool     `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
	Keys    []string `protobuf:"bytes,2,rep,name=keys,proto3" json:"keys,omitempty"`
	Error   string   `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"`
	// contains filtered or unexported fields
}

func (*PrefixScanResponse) Descriptor deprecated added in v0.1.0

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

Deprecated: Use PrefixScanResponse.ProtoReflect.Descriptor instead.

func (*PrefixScanResponse) GetError added in v0.1.0

func (x *PrefixScanResponse) GetError() string

func (*PrefixScanResponse) GetKeys added in v0.1.0

func (x *PrefixScanResponse) GetKeys() []string

func (*PrefixScanResponse) GetSuccess added in v0.1.0

func (x *PrefixScanResponse) GetSuccess() bool

func (*PrefixScanResponse) ProtoMessage added in v0.1.0

func (*PrefixScanResponse) ProtoMessage()

func (*PrefixScanResponse) ProtoReflect added in v0.1.0

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

func (*PrefixScanResponse) Reset added in v0.1.0

func (x *PrefixScanResponse) Reset()

func (*PrefixScanResponse) String added in v0.1.0

func (x *PrefixScanResponse) String() string

type Principal added in v0.1.0

type Principal struct {
	Name  string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`   // The name of the principal
	Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` // The value of the principal
	// contains filtered or unexported fields
}

func (*Principal) Descriptor deprecated added in v0.1.0

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

Deprecated: Use Principal.ProtoReflect.Descriptor instead.

func (*Principal) GetName added in v0.1.0

func (x *Principal) GetName() string

func (*Principal) GetValue added in v0.1.0

func (x *Principal) GetValue() string

func (*Principal) ProtoMessage added in v0.1.0

func (*Principal) ProtoMessage()

func (*Principal) ProtoReflect added in v0.1.0

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

func (*Principal) Reset added in v0.1.0

func (x *Principal) Reset()

func (*Principal) String added in v0.1.0

func (x *Principal) String() string

type Quorum

type Quorum interface {
	ConsensusClient
	CurrentNodeInReplicationQuorum() bool
	CurrentNodeInMigrationQuorum() bool
}

type QuorumManager

type QuorumManager interface {
	GetQuorum(ctx context.Context, table string) (Quorum, error)
	AddNode(ctx context.Context, node *Node) error
	RemoveNode(nodeID int64) error
	Send(node *Node, do func(quorumNode *QuorumNode) (any, error)) (any, error)
}

func GetDefaultQuorumManager

func GetDefaultQuorumManager(ctx context.Context) QuorumManager

type QuorumNode

type QuorumNode struct {
	*Node
	// contains filtered or unexported fields
}

func (*QuorumNode) AcceptMigration

func (q *QuorumNode) AcceptMigration(ctx context.Context, in *WriteMigrationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)

func (*QuorumNode) Close

func (q *QuorumNode) Close()

func (*QuorumNode) Gossip

func (q *QuorumNode) Gossip(ctx context.Context, in *GossipMigration, opts ...grpc.CallOption) (*emptypb.Empty, error)

func (*QuorumNode) JoinCluster

func (q *QuorumNode) JoinCluster(ctx context.Context, in *Node, opts ...grpc.CallOption) (*JoinClusterResponse, error)

func (*QuorumNode) Ping

func (q *QuorumNode) Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingResponse, error)

func (*QuorumNode) PrefixScan added in v0.1.0

func (q *QuorumNode) PrefixScan(ctx context.Context, in *PrefixScanRequest, opts ...grpc.CallOption) (*PrefixScanResponse, error)

func (*QuorumNode) ReadKey

func (q *QuorumNode) ReadKey(ctx context.Context, in *ReadKeyRequest, opts ...grpc.CallOption) (*ReadKeyResponse, error)

func (*QuorumNode) StealTableOwnership

func (*QuorumNode) WriteKey

func (q *QuorumNode) WriteKey(ctx context.Context, in *WriteKeyRequest, opts ...grpc.CallOption) (*WriteKeyResponse, error)

func (*QuorumNode) WriteMigration

type RawData added in v0.1.0

type RawData struct {
	Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

func (*RawData) Descriptor deprecated added in v0.1.0

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

Deprecated: Use RawData.ProtoReflect.Descriptor instead.

func (*RawData) GetData added in v0.1.0

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

func (*RawData) ProtoMessage added in v0.1.0

func (*RawData) ProtoMessage()

func (*RawData) ProtoReflect added in v0.1.0

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

func (*RawData) Reset added in v0.1.0

func (x *RawData) Reset()

func (*RawData) String added in v0.1.0

func (x *RawData) String() string

type ReadKeyRequest added in v0.1.0

type ReadKeyRequest struct {
	Sender *Node  `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` // The node requesting the read
	Key    string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`       // The key to read
	Table  string `protobuf:"bytes,3,opt,name=table,proto3" json:"table,omitempty"`   // The table the key belongs to
	// contains filtered or unexported fields
}

Remote read messages for leader-based reads

func (*ReadKeyRequest) Descriptor deprecated added in v0.1.0

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

Deprecated: Use ReadKeyRequest.ProtoReflect.Descriptor instead.

func (*ReadKeyRequest) GetKey added in v0.1.0

func (x *ReadKeyRequest) GetKey() string

func (*ReadKeyRequest) GetSender added in v0.1.0

func (x *ReadKeyRequest) GetSender() *Node

func (*ReadKeyRequest) GetTable added in v0.1.0

func (x *ReadKeyRequest) GetTable() string

func (*ReadKeyRequest) ProtoMessage added in v0.1.0

func (*ReadKeyRequest) ProtoMessage()

func (*ReadKeyRequest) ProtoReflect added in v0.1.0

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

func (*ReadKeyRequest) Reset added in v0.1.0

func (x *ReadKeyRequest) Reset()

func (*ReadKeyRequest) String added in v0.1.0

func (x *ReadKeyRequest) String() string

type ReadKeyResponse added in v0.1.0

type ReadKeyResponse struct {
	Success bool   `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` // Whether the read was successful
	Value   []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`      // The value if found, empty if not found
	Error   string `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"`      // Error message if not successful
	// contains filtered or unexported fields
}

func (*ReadKeyResponse) Descriptor deprecated added in v0.1.0

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

Deprecated: Use ReadKeyResponse.ProtoReflect.Descriptor instead.

func (*ReadKeyResponse) GetError added in v0.1.0

func (x *ReadKeyResponse) GetError() string

func (*ReadKeyResponse) GetSuccess added in v0.1.0

func (x *ReadKeyResponse) GetSuccess() bool

func (*ReadKeyResponse) GetValue added in v0.1.0

func (x *ReadKeyResponse) GetValue() []byte

func (*ReadKeyResponse) ProtoMessage added in v0.1.0

func (*ReadKeyResponse) ProtoMessage()

func (*ReadKeyResponse) ProtoReflect added in v0.1.0

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

func (*ReadKeyResponse) Reset added in v0.1.0

func (x *ReadKeyResponse) Reset()

func (*ReadKeyResponse) String added in v0.1.0

func (x *ReadKeyResponse) String() string

type Record added in v0.1.0

type Record struct {
	Value         *RawData `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
	AccessControl *ACL     `protobuf:"bytes,2,opt,name=accessControl,proto3" json:"accessControl,omitempty"`
	// contains filtered or unexported fields
}

func (*Record) Descriptor deprecated added in v0.1.0

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

Deprecated: Use Record.ProtoReflect.Descriptor instead.

func (*Record) GetAccessControl added in v0.1.0

func (x *Record) GetAccessControl() *ACL

func (*Record) GetValue added in v0.1.0

func (x *Record) GetValue() *RawData

func (*Record) ProtoMessage added in v0.1.0

func (*Record) ProtoMessage()

func (*Record) ProtoReflect added in v0.1.0

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

func (*Record) Reset added in v0.1.0

func (x *Record) Reset()

func (*Record) String added in v0.1.0

func (x *Record) String() string

type Region added in v0.1.0

type Region struct {
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // The region name
	// contains filtered or unexported fields
}

func (*Region) Descriptor deprecated added in v0.1.0

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

Deprecated: Use Region.ProtoReflect.Descriptor instead.

func (*Region) GetName added in v0.1.0

func (x *Region) GetName() string

func (*Region) ProtoMessage added in v0.1.0

func (*Region) ProtoMessage()

func (*Region) ProtoReflect added in v0.1.0

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

func (*Region) Reset added in v0.1.0

func (x *Region) Reset()

func (*Region) String added in v0.1.0

func (x *Region) String() string

type RegionName

type RegionName string

type ReplicationLevel added in v0.1.0

type ReplicationLevel int32
const (
	ReplicationLevel_global   ReplicationLevel = 0 // Replicate the table globally
	ReplicationLevel_regional ReplicationLevel = 1 // Replicate the table within the region
	ReplicationLevel_local    ReplicationLevel = 2 // Replicate the table within the node
)

func (ReplicationLevel) Descriptor added in v0.1.0

func (ReplicationLevel) Enum added in v0.1.0

func (ReplicationLevel) EnumDescriptor deprecated added in v0.1.0

func (ReplicationLevel) EnumDescriptor() ([]byte, []int)

Deprecated: Use ReplicationLevel.Descriptor instead.

func (ReplicationLevel) Number added in v0.1.0

func (ReplicationLevel) String added in v0.1.0

func (x ReplicationLevel) String() string

func (ReplicationLevel) Type added in v0.1.0

type SchemaMigration added in v0.1.0

type SchemaMigration struct {
	Commands []string `protobuf:"bytes,1,rep,name=commands,proto3" json:"commands,omitempty"` // The commands to be executed
	// contains filtered or unexported fields
}

func (*SchemaMigration) Descriptor deprecated added in v0.1.0

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

Deprecated: Use SchemaMigration.ProtoReflect.Descriptor instead.

func (*SchemaMigration) GetCommands added in v0.1.0

func (x *SchemaMigration) GetCommands() []string

func (*SchemaMigration) ProtoMessage added in v0.1.0

func (*SchemaMigration) ProtoMessage()

func (*SchemaMigration) ProtoReflect added in v0.1.0

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

func (*SchemaMigration) Reset added in v0.1.0

func (x *SchemaMigration) Reset()

func (*SchemaMigration) String added in v0.1.0

func (x *SchemaMigration) String() string

type Server

type Server struct {
	UnimplementedConsensusServer
}

func NewServer added in v0.1.0

func NewServer() *Server

func (*Server) AcceptMigration

func (s *Server) AcceptMigration(ctx context.Context, req *WriteMigrationRequest) (*emptypb.Empty, error)

func (*Server) DeleteKey added in v0.1.0

func (*Server) Gossip

func (s *Server) Gossip(ctx context.Context, req *GossipMigration) (*emptypb.Empty, error)

Gossip is a method that randomly disseminates information to other nodes in the cluster. A leader disseminates this to every node in the cluster after a commit.

func (*Server) JoinCluster

func (s *Server) JoinCluster(ctx context.Context, req *Node) (*JoinClusterResponse, error)

JoinCluster adds a node to the cluster on behalf of the node.

func (*Server) Ping

func (s *Server) Ping(ctx context.Context, req *PingRequest) (*PingResponse, error)

Ping implements a simple health check endpoint

func (*Server) PrefixScan added in v0.1.0

func (s *Server) PrefixScan(ctx context.Context, req *PrefixScanRequest) (*PrefixScanResponse, error)

func (*Server) ReadKey

func (s *Server) ReadKey(ctx context.Context, req *ReadKeyRequest) (*ReadKeyResponse, error)

func (*Server) StealTableOwnership

func (s *Server) StealTableOwnership(ctx context.Context, req *StealTableOwnershipRequest) (*StealTableOwnershipResponse, error)

func (*Server) WriteKey

func (s *Server) WriteKey(ctx context.Context, req *WriteKeyRequest) (*WriteKeyResponse, error)

func (*Server) WriteMigration

func (s *Server) WriteMigration(ctx context.Context, req *WriteMigrationRequest) (*WriteMigrationResponse, error)

type SetChange added in v0.1.0

type SetChange struct {
	Key  []byte  `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	Data *Record `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

func (*SetChange) Descriptor deprecated added in v0.1.0

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

Deprecated: Use SetChange.ProtoReflect.Descriptor instead.

func (*SetChange) GetData added in v0.1.0

func (x *SetChange) GetData() *Record

func (*SetChange) GetKey added in v0.1.0

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

func (*SetChange) ProtoMessage added in v0.1.0

func (*SetChange) ProtoMessage()

func (*SetChange) ProtoReflect added in v0.1.0

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

func (*SetChange) Reset added in v0.1.0

func (x *SetChange) Reset()

func (*SetChange) String added in v0.1.0

func (x *SetChange) String() string

type Shard added in v0.1.0

type Shard struct {
	Table      *Table       `protobuf:"bytes,1,opt,name=table,proto3" json:"table,omitempty"`           // The table the shard belongs to
	Shard      *Table       `protobuf:"bytes,2,opt,name=shard,proto3" json:"shard,omitempty"`           // The shard table
	Principals []*Principal `protobuf:"bytes,3,rep,name=principals,proto3" json:"principals,omitempty"` // The principals the shard is sharded by
	// contains filtered or unexported fields
}

func (*Shard) Descriptor deprecated added in v0.1.0

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

Deprecated: Use Shard.ProtoReflect.Descriptor instead.

func (*Shard) GetPrincipals added in v0.1.0

func (x *Shard) GetPrincipals() []*Principal

func (*Shard) GetShard added in v0.1.0

func (x *Shard) GetShard() *Table

func (*Shard) GetTable added in v0.1.0

func (x *Shard) GetTable() *Table

func (*Shard) ProtoMessage added in v0.1.0

func (*Shard) ProtoMessage()

func (*Shard) ProtoReflect added in v0.1.0

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

func (*Shard) Reset added in v0.1.0

func (x *Shard) Reset()

func (*Shard) String added in v0.1.0

func (x *Shard) String() string

type StealReason added in v0.1.0

type StealReason int32
const (
	StealReason_queryReason     StealReason = 0 // The table was stolen due to a readonly
	StealReason_writeReason     StealReason = 1 // The table was stolen due to a write
	StealReason_discoveryReason StealReason = 2 // We only care about this for discovery
)

func (StealReason) Descriptor added in v0.1.0

func (StealReason) Enum added in v0.1.0

func (x StealReason) Enum() *StealReason

func (StealReason) EnumDescriptor deprecated added in v0.1.0

func (StealReason) EnumDescriptor() ([]byte, []int)

Deprecated: Use StealReason.Descriptor instead.

func (StealReason) Number added in v0.1.0

func (x StealReason) Number() protoreflect.EnumNumber

func (StealReason) String added in v0.1.0

func (x StealReason) String() string

func (StealReason) Type added in v0.1.0

type StealTableOwnershipFailure added in v0.1.0

type StealTableOwnershipFailure struct {
	Table *Table `protobuf:"bytes,1,opt,name=table,proto3" json:"table,omitempty"` // The table that was not stolen
	// contains filtered or unexported fields
}

func (*StealTableOwnershipFailure) Descriptor deprecated added in v0.1.0

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

Deprecated: Use StealTableOwnershipFailure.ProtoReflect.Descriptor instead.

func (*StealTableOwnershipFailure) GetTable added in v0.1.0

func (x *StealTableOwnershipFailure) GetTable() *Table

func (*StealTableOwnershipFailure) ProtoMessage added in v0.1.0

func (*StealTableOwnershipFailure) ProtoMessage()

func (*StealTableOwnershipFailure) ProtoReflect added in v0.1.0

func (*StealTableOwnershipFailure) Reset added in v0.1.0

func (x *StealTableOwnershipFailure) Reset()

func (*StealTableOwnershipFailure) String added in v0.1.0

func (x *StealTableOwnershipFailure) String() string

type StealTableOwnershipRequest added in v0.1.0

type StealTableOwnershipRequest struct {
	Sender *Node       `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"`                                   // The node sending the request
	Reason StealReason `protobuf:"varint,4,opt,name=reason,proto3,enum=atlas.consensus.StealReason" json:"reason,omitempty"` // The reason the table was stolen
	Table  *Table      `protobuf:"bytes,2,opt,name=table,proto3" json:"table,omitempty"`                                     // The table to be stolen
	// contains filtered or unexported fields
}

func (*StealTableOwnershipRequest) Descriptor deprecated added in v0.1.0

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

Deprecated: Use StealTableOwnershipRequest.ProtoReflect.Descriptor instead.

func (*StealTableOwnershipRequest) GetReason added in v0.1.0

func (x *StealTableOwnershipRequest) GetReason() StealReason

func (*StealTableOwnershipRequest) GetSender added in v0.1.0

func (x *StealTableOwnershipRequest) GetSender() *Node

func (*StealTableOwnershipRequest) GetTable added in v0.1.0

func (x *StealTableOwnershipRequest) GetTable() *Table

func (*StealTableOwnershipRequest) ProtoMessage added in v0.1.0

func (*StealTableOwnershipRequest) ProtoMessage()

func (*StealTableOwnershipRequest) ProtoReflect added in v0.1.0

func (*StealTableOwnershipRequest) Reset added in v0.1.0

func (x *StealTableOwnershipRequest) Reset()

func (*StealTableOwnershipRequest) String added in v0.1.0

func (x *StealTableOwnershipRequest) String() string

type StealTableOwnershipResponse added in v0.1.0

type StealTableOwnershipResponse struct {
	Promised bool `protobuf:"varint,1,opt,name=promised,proto3" json:"promised,omitempty"` // Whether the operation was successful
	// Types that are valid to be assigned to Response:
	//
	//	*StealTableOwnershipResponse_Failure
	//	*StealTableOwnershipResponse_Success
	Response isStealTableOwnershipResponse_Response `protobuf_oneof:"response"`
	// contains filtered or unexported fields
}

func (*StealTableOwnershipResponse) Descriptor deprecated added in v0.1.0

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

Deprecated: Use StealTableOwnershipResponse.ProtoReflect.Descriptor instead.

func (*StealTableOwnershipResponse) GetFailure added in v0.1.0

func (*StealTableOwnershipResponse) GetPromised added in v0.1.0

func (x *StealTableOwnershipResponse) GetPromised() bool

func (*StealTableOwnershipResponse) GetResponse added in v0.1.0

func (x *StealTableOwnershipResponse) GetResponse() isStealTableOwnershipResponse_Response

func (*StealTableOwnershipResponse) GetSuccess added in v0.1.0

func (*StealTableOwnershipResponse) ProtoMessage added in v0.1.0

func (*StealTableOwnershipResponse) ProtoMessage()

func (*StealTableOwnershipResponse) ProtoReflect added in v0.1.0

func (*StealTableOwnershipResponse) Reset added in v0.1.0

func (x *StealTableOwnershipResponse) Reset()

func (*StealTableOwnershipResponse) String added in v0.1.0

func (x *StealTableOwnershipResponse) String() string

type StealTableOwnershipResponse_Failure added in v0.1.0

type StealTableOwnershipResponse_Failure struct {
	Failure *StealTableOwnershipFailure `protobuf:"bytes,2,opt,name=failure,proto3,oneof"` // The table that was not stolen
}

type StealTableOwnershipResponse_Success added in v0.1.0

type StealTableOwnershipResponse_Success struct {
	Success *StealTableOwnershipSuccess `protobuf:"bytes,3,opt,name=success,proto3,oneof"` // The table that was stolen
}

type StealTableOwnershipSuccess added in v0.1.0

type StealTableOwnershipSuccess struct {
	Table             *Table       `protobuf:"bytes,1,opt,name=table,proto3" json:"table,omitempty"`                         // The table that was stolen
	MissingMigrations []*Migration `protobuf:"bytes,2,rep,name=missingMigrations,proto3" json:"missingMigrations,omitempty"` // The missing migrations, if any
	// contains filtered or unexported fields
}

func (*StealTableOwnershipSuccess) Descriptor deprecated added in v0.1.0

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

Deprecated: Use StealTableOwnershipSuccess.ProtoReflect.Descriptor instead.

func (*StealTableOwnershipSuccess) GetMissingMigrations added in v0.1.0

func (x *StealTableOwnershipSuccess) GetMissingMigrations() []*Migration

func (*StealTableOwnershipSuccess) GetTable added in v0.1.0

func (x *StealTableOwnershipSuccess) GetTable() *Table

func (*StealTableOwnershipSuccess) ProtoMessage added in v0.1.0

func (*StealTableOwnershipSuccess) ProtoMessage()

func (*StealTableOwnershipSuccess) ProtoReflect added in v0.1.0

func (*StealTableOwnershipSuccess) Reset added in v0.1.0

func (x *StealTableOwnershipSuccess) Reset()

func (*StealTableOwnershipSuccess) String added in v0.1.0

func (x *StealTableOwnershipSuccess) String() string

type StoredMigrationBatch added in v0.1.0

type StoredMigrationBatch struct {
	Migration *Migration `protobuf:"bytes,1,opt,name=migration,proto3" json:"migration,omitempty"`  // The complete migration
	Committed bool       `protobuf:"varint,2,opt,name=committed,proto3" json:"committed,omitempty"` // Whether this migration batch is committed
	Gossip    bool       `protobuf:"varint,3,opt,name=gossip,proto3" json:"gossip,omitempty"`       // Whether this migration batch came from gossip
	// contains filtered or unexported fields
}

Storage message for efficient migration persistence

func (*StoredMigrationBatch) Descriptor deprecated added in v0.1.0

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

Deprecated: Use StoredMigrationBatch.ProtoReflect.Descriptor instead.

func (*StoredMigrationBatch) GetCommitted added in v0.1.0

func (x *StoredMigrationBatch) GetCommitted() bool

func (*StoredMigrationBatch) GetGossip added in v0.1.0

func (x *StoredMigrationBatch) GetGossip() bool

func (*StoredMigrationBatch) GetMigration added in v0.1.0

func (x *StoredMigrationBatch) GetMigration() *Migration

func (*StoredMigrationBatch) ProtoMessage added in v0.1.0

func (*StoredMigrationBatch) ProtoMessage()

func (*StoredMigrationBatch) ProtoReflect added in v0.1.0

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

func (*StoredMigrationBatch) Reset added in v0.1.0

func (x *StoredMigrationBatch) Reset()

func (*StoredMigrationBatch) String added in v0.1.0

func (x *StoredMigrationBatch) String() string

type Table added in v0.1.0

type Table struct {
	Name              string                 `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`                                                                // The name of the table
	ReplicationLevel  ReplicationLevel       `protobuf:"varint,2,opt,name=replicationLevel,proto3,enum=atlas.consensus.ReplicationLevel" json:"replicationLevel,omitempty"` // The replication level of the table
	Owner             *Node                  `protobuf:"bytes,3,opt,name=owner,proto3" json:"owner,omitempty"`                                                              // The global owner of the table
	CreatedAt         *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=createdAt,proto3" json:"createdAt,omitempty"`                                                      // The time the table was created
	Version           int64                  `protobuf:"varint,5,opt,name=version,proto3" json:"version,omitempty"`                                                         // The version of the table
	AllowedRegions    []string               `protobuf:"bytes,6,rep,name=allowedRegions,proto3" json:"allowedRegions,omitempty"`                                            // The regions the table data can be replicated to
	RestrictedRegions []string               `protobuf:"bytes,7,rep,name=restrictedRegions,proto3" json:"restrictedRegions,omitempty"`                                      // The regions the table data cannot be replicated to
	Group             string                 `protobuf:"bytes,9,opt,name=group,proto3" json:"group,omitempty"`                                                              // The group the table belongs to
	Type              TableType              `protobuf:"varint,10,opt,name=type,proto3,enum=atlas.consensus.TableType" json:"type,omitempty"`                               // The type of the table
	ShardPrincipals   []string               `protobuf:"bytes,11,rep,name=shardPrincipals,proto3" json:"shardPrincipals,omitempty"`                                         // The principals the table is sharded by
	// contains filtered or unexported fields
}

func (*Table) Descriptor deprecated added in v0.1.0

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

Deprecated: Use Table.ProtoReflect.Descriptor instead.

func (*Table) GetAllowedRegions added in v0.1.0

func (x *Table) GetAllowedRegions() []string

func (*Table) GetCreatedAt added in v0.1.0

func (x *Table) GetCreatedAt() *timestamppb.Timestamp

func (*Table) GetGroup added in v0.1.0

func (x *Table) GetGroup() string

func (*Table) GetName added in v0.1.0

func (x *Table) GetName() string

func (*Table) GetOwner added in v0.1.0

func (x *Table) GetOwner() *Node

func (*Table) GetReplicationLevel added in v0.1.0

func (x *Table) GetReplicationLevel() ReplicationLevel

func (*Table) GetRestrictedRegions added in v0.1.0

func (x *Table) GetRestrictedRegions() []string

func (*Table) GetShardPrincipals added in v0.1.0

func (x *Table) GetShardPrincipals() []string

func (*Table) GetType added in v0.1.0

func (x *Table) GetType() TableType

func (*Table) GetVersion added in v0.1.0

func (x *Table) GetVersion() int64

func (*Table) ProtoMessage added in v0.1.0

func (*Table) ProtoMessage()

func (*Table) ProtoReflect added in v0.1.0

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

func (*Table) Reset added in v0.1.0

func (x *Table) Reset()

func (*Table) String added in v0.1.0

func (x *Table) String() string

type TableGroup added in v0.1.0

type TableGroup struct {
	Details *Table   `protobuf:"bytes,1,opt,name=details,proto3" json:"details,omitempty"` // The details of the group
	Tables  []*Table `protobuf:"bytes,2,rep,name=tables,proto3" json:"tables,omitempty"`   // The tables in the group
	// contains filtered or unexported fields
}

func (*TableGroup) Descriptor deprecated added in v0.1.0

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

Deprecated: Use TableGroup.ProtoReflect.Descriptor instead.

func (*TableGroup) GetDetails added in v0.1.0

func (x *TableGroup) GetDetails() *Table

func (*TableGroup) GetTables added in v0.1.0

func (x *TableGroup) GetTables() []*Table

func (*TableGroup) ProtoMessage added in v0.1.0

func (*TableGroup) ProtoMessage()

func (*TableGroup) ProtoReflect added in v0.1.0

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

func (*TableGroup) Reset added in v0.1.0

func (x *TableGroup) Reset()

func (*TableGroup) String added in v0.1.0

func (x *TableGroup) String() string

type TableRepository

type TableRepository interface {
	// GetTable returns a table by name.
	GetTable(name string) (*Table, error)
	// GetTablesBatch returns multiple tables by name in a single operation.
	// Returns a slice of tables in the same order as the input names.
	// Nil entries indicate table not found for that name.
	GetTablesBatch(names [][]byte) ([]*Table, error)
	// UpdateTable updates a table.
	UpdateTable(*Table) error
	// InsertTable inserts a table.
	InsertTable(*Table) error
	// GetGroup returns a group by name.
	GetGroup(string) (*TableGroup, error)
	// UpdateGroup updates a group.
	UpdateGroup(*TableGroup) error
	// InsertGroup inserts a group.
	InsertGroup(*TableGroup) error
	// GetShard returns a shard of a table, given the principal.
	GetShard(*Table, []*Principal) (*Shard, error)
	// UpdateShard updates a shard metadata.
	UpdateShard(*Shard) error
	// InsertShard inserts a shard metadata.
	// Ensure principals are set and the shard meta-name will be updated before inserting.
	InsertShard(*Shard) error
}

func NewTableRepositoryKV

func NewTableRepositoryKV(ctx context.Context, store kv.Store) TableRepository

NewTableRepositoryKV creates a new KV-based table repository

type TableRepositoryKV

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

TableRepositoryKV implements TableRepository using key-value operations

func (*TableRepositoryKV) GetGroup

func (r *TableRepositoryKV) GetGroup(name string) (*TableGroup, error)

func (*TableRepositoryKV) GetShard

func (r *TableRepositoryKV) GetShard(shard *Table, principals []*Principal) (*Shard, error)

func (*TableRepositoryKV) GetTable

func (r *TableRepositoryKV) GetTable(name string) (*Table, error)

func (*TableRepositoryKV) GetTablesBatch added in v0.1.0

func (r *TableRepositoryKV) GetTablesBatch(names [][]byte) ([]*Table, error)

func (*TableRepositoryKV) GetTablesByReplicationLevel

func (r *TableRepositoryKV) GetTablesByReplicationLevel(level ReplicationLevel) ([]*Table, error)

GetTablesByReplicationLevel provides efficient querying by replication level

func (*TableRepositoryKV) GetTablesOwnedByNode

func (r *TableRepositoryKV) GetTablesOwnedByNode(nodeID int64) ([]*Table, error)

GetTablesOwnedByNode provides efficient querying by owner node

func (*TableRepositoryKV) InsertGroup

func (r *TableRepositoryKV) InsertGroup(group *TableGroup) error

func (*TableRepositoryKV) InsertShard

func (r *TableRepositoryKV) InsertShard(shard *Shard) error

func (*TableRepositoryKV) InsertTable

func (r *TableRepositoryKV) InsertTable(table *Table) error

func (*TableRepositoryKV) UpdateGroup

func (r *TableRepositoryKV) UpdateGroup(group *TableGroup) error

func (*TableRepositoryKV) UpdateShard

func (r *TableRepositoryKV) UpdateShard(shard *Shard) error

func (*TableRepositoryKV) UpdateTable

func (r *TableRepositoryKV) UpdateTable(table *Table) error

type TableStorageModel

type TableStorageModel struct {
	Name              string            `json:"name"`
	Version           int64             `json:"version"`
	ReplicationLevel  string            `json:"replication_level"`
	AllowedRegions    []string          `json:"allowed_regions"`
	RestrictedRegions []string          `json:"restricted_regions"`
	OwnerNodeID       *int64            `json:"owner_node_id"`
	CreatedAt         time.Time         `json:"created_at"`
	GroupID           string            `json:"group_id,omitempty"`
	TableType         string            `json:"table_type"`
	ShardPrincipals   []string          `json:"shard_principals"`
	Owner             *NodeStorageModel `json:"owner,omitempty"`
}

TableStorageModel represents how table data is stored in KV format

type TableType added in v0.1.0

type TableType int32
const (
	TableType_table   TableType = 0 // The table is a regular table
	TableType_group   TableType = 1 // The table is a group meta table
	TableType_trigger TableType = 2 // The table is a trigger
	TableType_view    TableType = 3 // The table is a view
	TableType_sharded TableType = 4 // The table is sharded
)

func (TableType) Descriptor added in v0.1.0

func (TableType) Descriptor() protoreflect.EnumDescriptor

func (TableType) Enum added in v0.1.0

func (x TableType) Enum() *TableType

func (TableType) EnumDescriptor deprecated added in v0.1.0

func (TableType) EnumDescriptor() ([]byte, []int)

Deprecated: Use TableType.Descriptor instead.

func (TableType) Number added in v0.1.0

func (x TableType) Number() protoreflect.EnumNumber

func (TableType) String added in v0.1.0

func (x TableType) String() string

func (TableType) Type added in v0.1.0

type UnimplementedConsensusServer added in v0.1.0

type UnimplementedConsensusServer struct{}

UnimplementedConsensusServer must be embedded to have forward compatible implementations.

NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.

func (UnimplementedConsensusServer) AcceptMigration added in v0.1.0

func (UnimplementedConsensusServer) DeleteKey added in v0.1.0

func (UnimplementedConsensusServer) Gossip added in v0.1.0

func (UnimplementedConsensusServer) JoinCluster added in v0.1.0

func (UnimplementedConsensusServer) Ping added in v0.1.0

func (UnimplementedConsensusServer) PrefixScan added in v0.1.0

func (UnimplementedConsensusServer) ReadKey added in v0.1.0

func (UnimplementedConsensusServer) StealTableOwnership added in v0.1.0

func (UnimplementedConsensusServer) WriteKey added in v0.1.0

func (UnimplementedConsensusServer) WriteMigration added in v0.1.0

type UnsafeConsensusServer added in v0.1.0

type UnsafeConsensusServer interface {
	// contains filtered or unexported methods
}

UnsafeConsensusServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ConsensusServer will result in compilation errors.

type WriteKeyRequest added in v0.1.0

type WriteKeyRequest struct {
	Sender *Node     `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` // The node requesting the write
	Table  string    `protobuf:"bytes,3,opt,name=table,proto3" json:"table,omitempty"`   // The table the key belongs to
	Value  *KVChange `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"`   // The value to write
	// contains filtered or unexported fields
}

func (*WriteKeyRequest) Descriptor deprecated added in v0.1.0

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

Deprecated: Use WriteKeyRequest.ProtoReflect.Descriptor instead.

func (*WriteKeyRequest) GetSender added in v0.1.0

func (x *WriteKeyRequest) GetSender() *Node

func (*WriteKeyRequest) GetTable added in v0.1.0

func (x *WriteKeyRequest) GetTable() string

func (*WriteKeyRequest) GetValue added in v0.1.0

func (x *WriteKeyRequest) GetValue() *KVChange

func (*WriteKeyRequest) ProtoMessage added in v0.1.0

func (*WriteKeyRequest) ProtoMessage()

func (*WriteKeyRequest) ProtoReflect added in v0.1.0

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

func (*WriteKeyRequest) Reset added in v0.1.0

func (x *WriteKeyRequest) Reset()

func (*WriteKeyRequest) String added in v0.1.0

func (x *WriteKeyRequest) String() string

type WriteKeyResponse added in v0.1.0

type WriteKeyResponse struct {
	Success bool   `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` // Whether the write was successful
	Error   string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"`      // Error message if not successful
	// contains filtered or unexported fields
}

func (*WriteKeyResponse) Descriptor deprecated added in v0.1.0

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

Deprecated: Use WriteKeyResponse.ProtoReflect.Descriptor instead.

func (*WriteKeyResponse) GetError added in v0.1.0

func (x *WriteKeyResponse) GetError() string

func (*WriteKeyResponse) GetSuccess added in v0.1.0

func (x *WriteKeyResponse) GetSuccess() bool

func (*WriteKeyResponse) ProtoMessage added in v0.1.0

func (*WriteKeyResponse) ProtoMessage()

func (*WriteKeyResponse) ProtoReflect added in v0.1.0

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

func (*WriteKeyResponse) Reset added in v0.1.0

func (x *WriteKeyResponse) Reset()

func (*WriteKeyResponse) String added in v0.1.0

func (x *WriteKeyResponse) String() string

type WriteMigrationRequest added in v0.1.0

type WriteMigrationRequest struct {
	Sender    *Node      `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"`       // The node sending the migration
	Migration *Migration `protobuf:"bytes,2,opt,name=migration,proto3" json:"migration,omitempty"` // The migration to be written
	// contains filtered or unexported fields
}

func (*WriteMigrationRequest) Descriptor deprecated added in v0.1.0

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

Deprecated: Use WriteMigrationRequest.ProtoReflect.Descriptor instead.

func (*WriteMigrationRequest) GetMigration added in v0.1.0

func (x *WriteMigrationRequest) GetMigration() *Migration

func (*WriteMigrationRequest) GetSender added in v0.1.0

func (x *WriteMigrationRequest) GetSender() *Node

func (*WriteMigrationRequest) ProtoMessage added in v0.1.0

func (*WriteMigrationRequest) ProtoMessage()

func (*WriteMigrationRequest) ProtoReflect added in v0.1.0

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

func (*WriteMigrationRequest) Reset added in v0.1.0

func (x *WriteMigrationRequest) Reset()

func (*WriteMigrationRequest) String added in v0.1.0

func (x *WriteMigrationRequest) String() string

type WriteMigrationResponse added in v0.1.0

type WriteMigrationResponse struct {
	Success bool   `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` // Whether the operation was successful
	Table   *Table `protobuf:"bytes,2,opt,name=table,proto3" json:"table,omitempty"`      // The table if the operation was not successful
	// contains filtered or unexported fields
}

func (*WriteMigrationResponse) Descriptor deprecated added in v0.1.0

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

Deprecated: Use WriteMigrationResponse.ProtoReflect.Descriptor instead.

func (*WriteMigrationResponse) GetSuccess added in v0.1.0

func (x *WriteMigrationResponse) GetSuccess() bool

func (*WriteMigrationResponse) GetTable added in v0.1.0

func (x *WriteMigrationResponse) GetTable() *Table

func (*WriteMigrationResponse) ProtoMessage added in v0.1.0

func (*WriteMigrationResponse) ProtoMessage()

func (*WriteMigrationResponse) ProtoReflect added in v0.1.0

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

func (*WriteMigrationResponse) Reset added in v0.1.0

func (x *WriteMigrationResponse) Reset()

func (*WriteMigrationResponse) String added in v0.1.0

func (x *WriteMigrationResponse) String() string

Jump to

Keyboard shortcuts

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