monstera

package module
v0.0.0-...-0a8617c Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2025 License: MIT Imports: 31 Imported by: 22

README

Monstera

Go Go Report Card

Monstera leaf

Monstera is a framework that allows you to write stateful application logic in pure Go with all data in memory or on disk without worrying about scalability and availability. Monstera takes care of replication, sharding, snapshotting, and rebalancing.

Monstera is a half-technical and half-mental framework. The tech part of it has a pretty small surface. It leaves a lot up to you to implement. But sticking to the framework principles will ensure:

  • Applications are insanely fast and efficient
  • Cluster is horizontally scalable
  • Business logic is easily testable
  • Local development is enjoyable

Data and compute are brought together into a single process. You are free to use any in-memory data structure or embedded database. By eliminating network calls and limited query languages for communication with external databases, you are able to solve problems which are known to be hard in distributed systems with just a few lines of your favorite programming language as you would do it on a whiteboard.

Go to official documentation to learn more.

Example

It might be easier to understand how it works from examples rather than from the documentation.

Installing

Use go get to install the latest version of the library.

$ go get -u github.com/evrblk/monstera@latest

There are also few CLI tools (such as codegen), so it also should be added as a tool:

$ go get -tool github.com/evrblk/monstera/cmd/monstera@latest

CLI

Monstera comes with CLI toolkit:

$ go tool github.com/evrblk/monstera/cmd/monstera
  • Code generation:
    • monstera code generate Generates stubs, core interfaces and adapters from monstera.yaml file.
  • Working with cluster configs:
    • monstera config init Creates a new cluster config.
    • monstera config add-node Adds node to the cluster config.
    • monstera config add-application Adds application to the cluster config.

Status

Monstera is being actively developed. There will be no version tagging before v0.1, just development in master branch. After it is tagged v0.1 it will be more or less stable and follow semver.

License

Monstera is released under the MIT License.

Documentation

Index

Constants

View Source
const (
	MonsteraApi_Update_FullMethodName                = "/com.evrblk.monstera.MonsteraApi/Update"
	MonsteraApi_Read_FullMethodName                  = "/com.evrblk.monstera.MonsteraApi/Read"
	MonsteraApi_AppendEntriesPipeline_FullMethodName = "/com.evrblk.monstera.MonsteraApi/AppendEntriesPipeline"
	MonsteraApi_AppendEntries_FullMethodName         = "/com.evrblk.monstera.MonsteraApi/AppendEntries"
	MonsteraApi_RequestVote_FullMethodName           = "/com.evrblk.monstera.MonsteraApi/RequestVote"
	MonsteraApi_TimeoutNow_FullMethodName            = "/com.evrblk.monstera.MonsteraApi/TimeoutNow"
	MonsteraApi_InstallSnapshot_FullMethodName       = "/com.evrblk.monstera.MonsteraApi/InstallSnapshot"
	MonsteraApi_HealthCheck_FullMethodName           = "/com.evrblk.monstera.MonsteraApi/HealthCheck"
	MonsteraApi_LeadershipTransfer_FullMethodName    = "/com.evrblk.monstera.MonsteraApi/LeadershipTransfer"
	MonsteraApi_TriggerSnapshot_FullMethodName       = "/com.evrblk.monstera.MonsteraApi/TriggerSnapshot"
	MonsteraApi_AddVoter_FullMethodName              = "/com.evrblk.monstera.MonsteraApi/AddVoter"
	MonsteraApi_UpdateClusterConfig_FullMethodName   = "/com.evrblk.monstera.MonsteraApi/UpdateClusterConfig"
)
View Source
const (
	// KeyspacePerApplication holds the total size of an application's keyspace, currently 4 bytes.
	// It is used for shard bounds calculation.
	KeyspacePerApplication = 1 << 32
)

Variables

View Source
var (
	RaftState_name = map[int32]string{
		0: "RAFT_STATE_INVALID",
		1: "RAFT_STATE_FOLLOWER",
		2: "RAFT_STATE_LEADER",
		3: "RAFT_STATE_CANDIDATE",
		4: "RAFT_STATE_SHUTDOWN",
	}
	RaftState_value = map[string]int32{
		"RAFT_STATE_INVALID":   0,
		"RAFT_STATE_FOLLOWER":  1,
		"RAFT_STATE_LEADER":    2,
		"RAFT_STATE_CANDIDATE": 3,
		"RAFT_STATE_SHUTDOWN":  4,
	}
)

Enum value maps for RaftState.

View Source
var (
	ErrNotFound = errors.New("not found")
	ErrConflict = errors.New("transaction conflict")
)
View Source
var (
	Log_LogType_name = map[int32]string{
		0: "LOG_TYPE_COMMAND",
		1: "LOG_TYPE_NOOP",
		2: "LOG_TYPE_ADD_PEER_DEPRECATED",
		3: "LOG_TYPE_REMOVE_PEER_DEPRECATED",
		4: "LOG_TYPE_BARRIER",
		5: "LOG_TYPE_CONFIGURATION",
	}
	Log_LogType_value = map[string]int32{
		"LOG_TYPE_COMMAND":                0,
		"LOG_TYPE_NOOP":                   1,
		"LOG_TYPE_ADD_PEER_DEPRECATED":    2,
		"LOG_TYPE_REMOVE_PEER_DEPRECATED": 3,
		"LOG_TYPE_BARRIER":                4,
		"LOG_TYPE_CONFIGURATION":          5,
	}
)

Enum value maps for Log_LogType.

View Source
var DefaultMonsteraNodeConfig = MonsteraNodeConfig{
	MaxHops:          5,
	MaxReadTimeout:   10 * time.Second,
	MaxUpdateTimeout: 30 * time.Second,

	UseInMemoryRaftStore: false,
}
View Source
var File_config_proto protoreflect.FileDescriptor
View Source
var MonsteraApi_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "com.evrblk.monstera.MonsteraApi",
	HandlerType: (*MonsteraApiServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Update",
			Handler:    _MonsteraApi_Update_Handler,
		},
		{
			MethodName: "Read",
			Handler:    _MonsteraApi_Read_Handler,
		},
		{
			MethodName: "AppendEntries",
			Handler:    _MonsteraApi_AppendEntries_Handler,
		},
		{
			MethodName: "RequestVote",
			Handler:    _MonsteraApi_RequestVote_Handler,
		},
		{
			MethodName: "TimeoutNow",
			Handler:    _MonsteraApi_TimeoutNow_Handler,
		},
		{
			MethodName: "HealthCheck",
			Handler:    _MonsteraApi_HealthCheck_Handler,
		},
		{
			MethodName: "LeadershipTransfer",
			Handler:    _MonsteraApi_LeadershipTransfer_Handler,
		},
		{
			MethodName: "TriggerSnapshot",
			Handler:    _MonsteraApi_TriggerSnapshot_Handler,
		},
		{
			MethodName: "AddVoter",
			Handler:    _MonsteraApi_AddVoter_Handler,
		},
		{
			MethodName: "UpdateClusterConfig",
			Handler:    _MonsteraApi_UpdateClusterConfig_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "AppendEntriesPipeline",
			Handler:       _MonsteraApi_AppendEntriesPipeline_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
		{
			StreamName:    "InstallSnapshot",
			Handler:       _MonsteraApi_InstallSnapshot_Handler,
			ClientStreams: true,
		},
	},
	Metadata: "api.proto",
}

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

Functions

func ConcatBytes

func ConcatBytes(items ...interface{}) []byte

func GetTruncatedHash

func GetTruncatedHash(data []byte, size int) []byte

func RegisterMonsteraApiServer

func RegisterMonsteraApiServer(s grpc.ServiceRegistrar, srv MonsteraApiServer)

func ShortenBounds

func ShortenBounds(lower, upper []byte) ([]byte, []byte)

func ValidateTransition

func ValidateTransition(old, new *ClusterConfig) error

ValidateTransition checks if the transition from old to new config is valid according to the following invariants:

  • New nodes can be added, but existing nodes cannot be removed if they have at least one assigned replica in the old config.
  • New applications can be added, but existing applications cannot be removed.
  • Shards cannot be removed or have their IDs, bounds, or unique global index prefixes changed.
  • New replicas can be added (even exceeding the replication factor), but replicas cannot be both added and removed in the same transition.
  • All existing replicas must remain assigned to the same nodes (no reassignment of existing replicas).
  • New config has newer UpdatedAt timestamp

Returns an error if any invariant is violated.

func WriteConfigToFile

func WriteConfigToFile(config *ClusterConfig, path string) error

WriteConfigToFile writes monstera cluster config into either a binary Protobuf `.pb` or a ProtoJSON `.json` file.

func WriteConfigToJson

func WriteConfigToJson(config *ClusterConfig) ([]byte, error)

func WriteConfigToProto

func WriteConfigToProto(config *ClusterConfig) ([]byte, error)

Types

type AddVoterRequest

type AddVoterRequest struct {
	ReplicaId      string `protobuf:"bytes,1,opt,name=replica_id,json=replicaId,proto3" json:"replica_id,omitempty"`
	VoterReplicaId string `protobuf:"bytes,2,opt,name=voter_replica_id,json=voterReplicaId,proto3" json:"voter_replica_id,omitempty"`
	VoterAddress   string `protobuf:"bytes,3,opt,name=voter_address,json=voterAddress,proto3" json:"voter_address,omitempty"`
	// contains filtered or unexported fields
}

func (*AddVoterRequest) Descriptor deprecated

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

Deprecated: Use AddVoterRequest.ProtoReflect.Descriptor instead.

func (*AddVoterRequest) GetReplicaId

func (x *AddVoterRequest) GetReplicaId() string

func (*AddVoterRequest) GetVoterAddress

func (x *AddVoterRequest) GetVoterAddress() string

func (*AddVoterRequest) GetVoterReplicaId

func (x *AddVoterRequest) GetVoterReplicaId() string

func (*AddVoterRequest) ProtoMessage

func (*AddVoterRequest) ProtoMessage()

func (*AddVoterRequest) ProtoReflect

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

func (*AddVoterRequest) Reset

func (x *AddVoterRequest) Reset()

func (*AddVoterRequest) String

func (x *AddVoterRequest) String() string

type AddVoterResponse

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

func (*AddVoterResponse) Descriptor deprecated

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

Deprecated: Use AddVoterResponse.ProtoReflect.Descriptor instead.

func (*AddVoterResponse) ProtoMessage

func (*AddVoterResponse) ProtoMessage()

func (*AddVoterResponse) ProtoReflect

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

func (*AddVoterResponse) Reset

func (x *AddVoterResponse) Reset()

func (*AddVoterResponse) String

func (x *AddVoterResponse) String() string

type AppendEntriesRequest

type AppendEntriesRequest struct {
	RpcHeader         *RPCHeader `protobuf:"bytes,1,opt,name=rpc_header,json=rpcHeader,proto3" json:"rpc_header,omitempty"`
	Term              uint64     `protobuf:"varint,2,opt,name=term,proto3" json:"term,omitempty"`
	PrevLogEntry      uint64     `protobuf:"varint,4,opt,name=prev_log_entry,json=prevLogEntry,proto3" json:"prev_log_entry,omitempty"`
	PrevLogTerm       uint64     `protobuf:"varint,5,opt,name=prev_log_term,json=prevLogTerm,proto3" json:"prev_log_term,omitempty"`
	Entries           []*Log     `protobuf:"bytes,6,rep,name=entries,proto3" json:"entries,omitempty"`
	LeaderCommitIndex uint64     `protobuf:"varint,7,opt,name=leader_commit_index,json=leaderCommitIndex,proto3" json:"leader_commit_index,omitempty"`
	TargetReplicaId   string     `protobuf:"bytes,8,opt,name=target_replica_id,json=targetReplicaId,proto3" json:"target_replica_id,omitempty"`
	// contains filtered or unexported fields
}

func (*AppendEntriesRequest) Descriptor deprecated

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

Deprecated: Use AppendEntriesRequest.ProtoReflect.Descriptor instead.

func (*AppendEntriesRequest) GetEntries

func (x *AppendEntriesRequest) GetEntries() []*Log

func (*AppendEntriesRequest) GetLeaderCommitIndex

func (x *AppendEntriesRequest) GetLeaderCommitIndex() uint64

func (*AppendEntriesRequest) GetPrevLogEntry

func (x *AppendEntriesRequest) GetPrevLogEntry() uint64

func (*AppendEntriesRequest) GetPrevLogTerm

func (x *AppendEntriesRequest) GetPrevLogTerm() uint64

func (*AppendEntriesRequest) GetRpcHeader

func (x *AppendEntriesRequest) GetRpcHeader() *RPCHeader

func (*AppendEntriesRequest) GetTargetReplicaId

func (x *AppendEntriesRequest) GetTargetReplicaId() string

func (*AppendEntriesRequest) GetTerm

func (x *AppendEntriesRequest) GetTerm() uint64

func (*AppendEntriesRequest) ProtoMessage

func (*AppendEntriesRequest) ProtoMessage()

func (*AppendEntriesRequest) ProtoReflect

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

func (*AppendEntriesRequest) Reset

func (x *AppendEntriesRequest) Reset()

func (*AppendEntriesRequest) String

func (x *AppendEntriesRequest) String() string

type AppendEntriesResponse

type AppendEntriesResponse struct {
	RpcHeader      *RPCHeader `protobuf:"bytes,1,opt,name=rpc_header,json=rpcHeader,proto3" json:"rpc_header,omitempty"`
	Term           uint64     `protobuf:"varint,2,opt,name=term,proto3" json:"term,omitempty"`
	LastLog        uint64     `protobuf:"varint,3,opt,name=last_log,json=lastLog,proto3" json:"last_log,omitempty"`
	Success        bool       `protobuf:"varint,4,opt,name=success,proto3" json:"success,omitempty"`
	NoRetryBackoff bool       `protobuf:"varint,5,opt,name=no_retry_backoff,json=noRetryBackoff,proto3" json:"no_retry_backoff,omitempty"`
	// contains filtered or unexported fields
}

func (*AppendEntriesResponse) Descriptor deprecated

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

Deprecated: Use AppendEntriesResponse.ProtoReflect.Descriptor instead.

func (*AppendEntriesResponse) GetLastLog

func (x *AppendEntriesResponse) GetLastLog() uint64

func (*AppendEntriesResponse) GetNoRetryBackoff

func (x *AppendEntriesResponse) GetNoRetryBackoff() bool

func (*AppendEntriesResponse) GetRpcHeader

func (x *AppendEntriesResponse) GetRpcHeader() *RPCHeader

func (*AppendEntriesResponse) GetSuccess

func (x *AppendEntriesResponse) GetSuccess() bool

func (*AppendEntriesResponse) GetTerm

func (x *AppendEntriesResponse) GetTerm() uint64

func (*AppendEntriesResponse) ProtoMessage

func (*AppendEntriesResponse) ProtoMessage()

func (*AppendEntriesResponse) ProtoReflect

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

func (*AppendEntriesResponse) Reset

func (x *AppendEntriesResponse) Reset()

func (*AppendEntriesResponse) String

func (x *AppendEntriesResponse) String() string

type Application

type Application struct {
	Name              string      `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Implementation    string      `protobuf:"bytes,2,opt,name=implementation,proto3" json:"implementation,omitempty"`
	Shards            []*Shard    `protobuf:"bytes,3,rep,name=shards,proto3" json:"shards,omitempty"`
	ReplicationFactor int32       `protobuf:"varint,4,opt,name=replication_factor,json=replicationFactor,proto3" json:"replication_factor,omitempty"`
	Metadata          []*Metadata `protobuf:"bytes,5,rep,name=metadata,proto3" json:"metadata,omitempty"`
	// contains filtered or unexported fields
}

func (*Application) Descriptor deprecated

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

Deprecated: Use Application.ProtoReflect.Descriptor instead.

func (*Application) GetImplementation

func (x *Application) GetImplementation() string

func (*Application) GetMetadata

func (x *Application) GetMetadata() []*Metadata

func (*Application) GetName

func (x *Application) GetName() string

func (*Application) GetReplicationFactor

func (x *Application) GetReplicationFactor() int32

func (*Application) GetShards

func (x *Application) GetShards() []*Shard

func (*Application) ProtoMessage

func (*Application) ProtoMessage()

func (*Application) ProtoReflect

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

func (*Application) Reset

func (x *Application) Reset()

func (*Application) String

func (x *Application) String() string

type ApplicationCore

type ApplicationCore interface {
	// Read is used to read a value directly from the application core.
	// Reads can be performed concurrently with updates, other reads,
	// and snapshots. Read should panic on internal errors.
	Read(request []byte) []byte

	// Update is used to update the application core state.
	// All updates are applied to the application core sequentially,
	// in the order they are committed to the Raft log. This method is called
	// by the Raft thread. Update should panic on internal errors.
	Update(request []byte) []byte

	// Snapshot returns an ApplicationCoreSnapshot used to: support Raft log compaction,
	// to restore the application core to a previous state, or to bring out-of-date
	// Raft followers up to a recent log index.
	//
	// The Snapshot implementation should return quickly, because Update can not
	// be called while Snapshot is running. Generally this means Snapshot should
	// only capture a pointer to the state, and any expensive IO should happen
	// as part of ApplicationCoreSnapshot.Write.
	//
	// Update and Snapshot are always called from the same thread, but Update will
	// be called concurrently with ApplicationCoreSnapshot.Write. This means the
	// application core should be implemented to allow for concurrent updates while
	// a snapshot is happening.
	Snapshot() ApplicationCoreSnapshot // TODO partition range

	// Restore is used to restore an application core from a snapshot. It is not
	// called concurrently with any other command. The application core must discard
	// all previous state before restoring the snapshot.
	Restore(reader io.ReadCloser) error

	// Close is used to clean up resources used by the application core. Do not
	// clean up resources that are shared by multiple cores. Close is called
	// after a shard split or a shard move while Monstera node is running, and
	// is called for each core after Monstera node is shutdown.
	Close()
}

ApplicationCore is the interface that must be implemented by clients to be used with Monstera framework.

type ApplicationCoreDescriptor

type ApplicationCoreDescriptor struct {
	// CoreFactoryFunc is a function that creates a new application core. It is called when
	// Monstera node starts for every replica on this node, and also for every new replica that
	// is added to the node while it is running.
	CoreFactoryFunc func(shard *Shard, replica *Replica) ApplicationCore

	// RestoreSnapshotOnStart is a flag that indicates if the application core should restore its
	// state from a snapshot on start (via ApplicationCore.Restore). For fully in-memory applications,
	// this flag should be true. For applications that are backed by an on-disk embedded storage this
	// might or might not be necessary, depending on implementation.
	RestoreSnapshotOnStart bool
}

ApplicationCoreDescriptor is used to register an application core with Monstera.

type ApplicationCoreDescriptors

type ApplicationCoreDescriptors = map[string]ApplicationCoreDescriptor

ApplicationCoreDescriptors map is used to register application cores with Monstera. Key: the name of the application core, it should match Application.Implementation in ClusterConfig. Value: application core descriptor.

type ApplicationCoreSnapshot

type ApplicationCoreSnapshot interface {
	Write(w io.Writer) error
	Release()
}

type BadgerStore

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

func NewBadgerInMemoryStore

func NewBadgerInMemoryStore() *BadgerStore

func NewBadgerStore

func NewBadgerStore(dir string) *BadgerStore

func (*BadgerStore) BatchUpdate

func (s *BadgerStore) BatchUpdate(fn func(batch *Batch) error) error

func (*BadgerStore) Close

func (s *BadgerStore) Close()

func (*BadgerStore) DropPrefix

func (s *BadgerStore) DropPrefix(prefix []byte) error

func (*BadgerStore) Flatten

func (s *BadgerStore) Flatten() error

func (*BadgerStore) Update

func (s *BadgerStore) Update() *Txn

func (*BadgerStore) View

func (s *BadgerStore) View() *Txn

type Batch

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

func (*Batch) Delete

func (b *Batch) Delete(key []byte) error

func (*Batch) Set

func (b *Batch) Set(key []byte, value []byte) error

type ClusterConfig

type ClusterConfig struct {
	Applications []*Application `protobuf:"bytes,1,rep,name=applications,proto3" json:"applications,omitempty"`
	Nodes        []*Node        `protobuf:"bytes,2,rep,name=nodes,proto3" json:"nodes,omitempty"`
	UpdatedAt    int64          `protobuf:"varint,3,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
	Metadata     []*Metadata    `protobuf:"bytes,4,rep,name=metadata,proto3" json:"metadata,omitempty"`
	// contains filtered or unexported fields
}

func CreateEmptyConfig

func CreateEmptyConfig() *ClusterConfig

func LoadConfig

func LoadConfig(applications []*Application, nodes []*Node, updatedAt int64) (*ClusterConfig, error)

LoadConfig loads monstera cluster config from separate components.

func LoadConfigFromFile

func LoadConfigFromFile(path string) (*ClusterConfig, error)

LoadConfigFromFile loads monstera cluster config from either a binary Protobuf `.pb` or a ProtoJSON `.json` file.

func LoadConfigFromJson

func LoadConfigFromJson(data []byte) (*ClusterConfig, error)

LoadConfigFromJson loads JSON serialized monstera cluster config.

func LoadConfigFromProto

func LoadConfigFromProto(data []byte) (*ClusterConfig, error)

LoadConfigFromProto loads binary serialized Protobuf monstera cluster config.

func (*ClusterConfig) CreateApplication

func (c *ClusterConfig) CreateApplication(applicationName string, implementation string, replicationFactor int32) (*Application, error)

func (*ClusterConfig) CreateNode

func (c *ClusterConfig) CreateNode(address string) (*Node, error)

func (*ClusterConfig) CreateReplica

func (c *ClusterConfig) CreateReplica(applicationName string, shardId string, nodeAddress string) (*Replica, error)

func (*ClusterConfig) CreateShard

func (c *ClusterConfig) CreateShard(applicationName string, lowerBound []byte, upperBound []byte, parentId string) (*Shard, error)

func (*ClusterConfig) Descriptor deprecated

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

Deprecated: Use ClusterConfig.ProtoReflect.Descriptor instead.

func (*ClusterConfig) FindShard

func (c *ClusterConfig) FindShard(applicationName string, shardKey []byte) (*Shard, error)

func (*ClusterConfig) GetApplications

func (x *ClusterConfig) GetApplications() []*Application

func (*ClusterConfig) GetMetadata

func (x *ClusterConfig) GetMetadata() []*Metadata

func (*ClusterConfig) GetNode

func (c *ClusterConfig) GetNode(nodeAddress string) (*Node, error)

func (*ClusterConfig) GetNodes

func (x *ClusterConfig) GetNodes() []*Node

func (*ClusterConfig) GetShard

func (c *ClusterConfig) GetShard(shardId string) (*Shard, error)

func (*ClusterConfig) GetUpdatedAt

func (x *ClusterConfig) GetUpdatedAt() int64

func (*ClusterConfig) ListApplications

func (c *ClusterConfig) ListApplications() []*Application

func (*ClusterConfig) ListNodes

func (c *ClusterConfig) ListNodes() []*Node

func (*ClusterConfig) ListShards

func (c *ClusterConfig) ListShards(applicationName string) ([]*Shard, error)

func (*ClusterConfig) ProtoMessage

func (*ClusterConfig) ProtoMessage()

func (*ClusterConfig) ProtoReflect

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

func (*ClusterConfig) Reset

func (x *ClusterConfig) Reset()

func (*ClusterConfig) String

func (x *ClusterConfig) String() string

func (*ClusterConfig) Validate

func (c *ClusterConfig) Validate() error

Validate checks if the config is valid according to the following invariants:

- UpdatedAt is not 0 - There are at least 3 nodes - Nodes have non-empty address - Nodes have unique addresses - Applications have non-empty names - Applications have globally unique names - Applications have non-empty implementation - Applications have replication factor of at least 3 - Shards have non-empty id - Shards have globally unique ids - Shards have no overlap in range - Shards have 4 bytes ranges - All shards together cover the full range of keys - Number of replicas is greater or equal to replication factor - Replicas have non-empty id - Replicas have globally unique ids - Replicas are assigned to existing nodes - Replicas are assigned to different nodes - Metadata has unique keys

Returns an error if any invariant is violated.

type HealthCheckRequest

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

func (*HealthCheckRequest) Descriptor deprecated

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

Deprecated: Use HealthCheckRequest.ProtoReflect.Descriptor instead.

func (*HealthCheckRequest) ProtoMessage

func (*HealthCheckRequest) ProtoMessage()

func (*HealthCheckRequest) ProtoReflect

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

func (*HealthCheckRequest) Reset

func (x *HealthCheckRequest) Reset()

func (*HealthCheckRequest) String

func (x *HealthCheckRequest) String() string

type HealthCheckResponse

type HealthCheckResponse struct {
	Replicas []*ReplicaState `protobuf:"bytes,1,rep,name=replicas,proto3" json:"replicas,omitempty"`
	// contains filtered or unexported fields
}

func (*HealthCheckResponse) Descriptor deprecated

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

Deprecated: Use HealthCheckResponse.ProtoReflect.Descriptor instead.

func (*HealthCheckResponse) GetReplicas

func (x *HealthCheckResponse) GetReplicas() []*ReplicaState

func (*HealthCheckResponse) ProtoMessage

func (*HealthCheckResponse) ProtoMessage()

func (*HealthCheckResponse) ProtoReflect

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

func (*HealthCheckResponse) Reset

func (x *HealthCheckResponse) Reset()

func (*HealthCheckResponse) String

func (x *HealthCheckResponse) String() string

type HraftBadgerStore

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

func NewHraftBadgerStore

func NewHraftBadgerStore(badgerStore *BadgerStore, keyPrefix []byte) *HraftBadgerStore

func (*HraftBadgerStore) DeleteRange

func (h *HraftBadgerStore) DeleteRange(min uint64, max uint64) error

DeleteRange deletes a range of log entries. The range is inclusive.

func (*HraftBadgerStore) FirstIndex

func (h *HraftBadgerStore) FirstIndex() (uint64, error)

FirstIndex returns the first index written. 0 for no entries.

func (*HraftBadgerStore) Get

func (h *HraftBadgerStore) Get(key []byte) ([]byte, error)

Get returns the value for key, or error if key was not found.

func (*HraftBadgerStore) GetLog

func (h *HraftBadgerStore) GetLog(index uint64, log *hraft.Log) error

GetLog gets a log entry at a given index.

func (*HraftBadgerStore) GetUint64

func (h *HraftBadgerStore) GetUint64(key []byte) (uint64, error)

GetUint64 returns the uint64 value for key, or error if key was not found.

func (*HraftBadgerStore) LastIndex

func (h *HraftBadgerStore) LastIndex() (uint64, error)

LastIndex returns the last index written. 0 for no entries.

func (*HraftBadgerStore) Set

func (h *HraftBadgerStore) Set(key []byte, val []byte) error

func (*HraftBadgerStore) SetUint64

func (h *HraftBadgerStore) SetUint64(key []byte, val uint64) error

func (*HraftBadgerStore) StoreLog

func (h *HraftBadgerStore) StoreLog(log *hraft.Log) error

StoreLog stores a log entry.

func (*HraftBadgerStore) StoreLogs

func (h *HraftBadgerStore) StoreLogs(logs []*hraft.Log) error

StoreLogs stores multiple log entries. By default, the logs stored may not be contiguous with previous logs (i.e. may have a gap in Index since the last log written). If an implementation can't tolerate this it may optionally implement `MonotonicLogStore` to indicate that this is not allowed. This changes Raft's behaviour after restoring a user snapshot to remove all previous logs instead of relying on a "gap" to signal the discontinuity between logs before the snapshot and logs after.

type InstallSnapshotRequest

type InstallSnapshotRequest struct {
	RpcHeader          *RPCHeader `protobuf:"bytes,1,opt,name=rpc_header,json=rpcHeader,proto3" json:"rpc_header,omitempty"`
	SnapshotVersion    int64      `protobuf:"varint,11,opt,name=snapshot_version,json=snapshotVersion,proto3" json:"snapshot_version,omitempty"`
	Term               uint64     `protobuf:"varint,2,opt,name=term,proto3" json:"term,omitempty"`
	Leader             []byte     `protobuf:"bytes,3,opt,name=leader,proto3" json:"leader,omitempty"`
	LastLogIndex       uint64     `protobuf:"varint,4,opt,name=last_log_index,json=lastLogIndex,proto3" json:"last_log_index,omitempty"`
	LastLogTerm        uint64     `protobuf:"varint,5,opt,name=last_log_term,json=lastLogTerm,proto3" json:"last_log_term,omitempty"`
	Peers              []byte     `protobuf:"bytes,6,opt,name=peers,proto3" json:"peers,omitempty"`
	Configuration      []byte     `protobuf:"bytes,7,opt,name=configuration,proto3" json:"configuration,omitempty"`
	ConfigurationIndex uint64     `protobuf:"varint,8,opt,name=configuration_index,json=configurationIndex,proto3" json:"configuration_index,omitempty"`
	Size               int64      `protobuf:"varint,9,opt,name=size,proto3" json:"size,omitempty"`
	Data               []byte     `protobuf:"bytes,10,opt,name=data,proto3" json:"data,omitempty"`
	TargetReplicaId    string     `protobuf:"bytes,12,opt,name=target_replica_id,json=targetReplicaId,proto3" json:"target_replica_id,omitempty"`
	// contains filtered or unexported fields
}

The first InstallSnapshotRequest on the stream contains all the metadata. All further messages contain only data.

func (*InstallSnapshotRequest) Descriptor deprecated

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

Deprecated: Use InstallSnapshotRequest.ProtoReflect.Descriptor instead.

func (*InstallSnapshotRequest) GetConfiguration

func (x *InstallSnapshotRequest) GetConfiguration() []byte

func (*InstallSnapshotRequest) GetConfigurationIndex

func (x *InstallSnapshotRequest) GetConfigurationIndex() uint64

func (*InstallSnapshotRequest) GetData

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

func (*InstallSnapshotRequest) GetLastLogIndex

func (x *InstallSnapshotRequest) GetLastLogIndex() uint64

func (*InstallSnapshotRequest) GetLastLogTerm

func (x *InstallSnapshotRequest) GetLastLogTerm() uint64

func (*InstallSnapshotRequest) GetLeader

func (x *InstallSnapshotRequest) GetLeader() []byte

func (*InstallSnapshotRequest) GetPeers

func (x *InstallSnapshotRequest) GetPeers() []byte

func (*InstallSnapshotRequest) GetRpcHeader

func (x *InstallSnapshotRequest) GetRpcHeader() *RPCHeader

func (*InstallSnapshotRequest) GetSize

func (x *InstallSnapshotRequest) GetSize() int64

func (*InstallSnapshotRequest) GetSnapshotVersion

func (x *InstallSnapshotRequest) GetSnapshotVersion() int64

func (*InstallSnapshotRequest) GetTargetReplicaId

func (x *InstallSnapshotRequest) GetTargetReplicaId() string

func (*InstallSnapshotRequest) GetTerm

func (x *InstallSnapshotRequest) GetTerm() uint64

func (*InstallSnapshotRequest) ProtoMessage

func (*InstallSnapshotRequest) ProtoMessage()

func (*InstallSnapshotRequest) ProtoReflect

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

func (*InstallSnapshotRequest) Reset

func (x *InstallSnapshotRequest) Reset()

func (*InstallSnapshotRequest) String

func (x *InstallSnapshotRequest) String() string

type InstallSnapshotResponse

type InstallSnapshotResponse struct {
	RpcHeader *RPCHeader `protobuf:"bytes,1,opt,name=rpc_header,json=rpcHeader,proto3" json:"rpc_header,omitempty"`
	Term      uint64     `protobuf:"varint,2,opt,name=term,proto3" json:"term,omitempty"`
	Success   bool       `protobuf:"varint,3,opt,name=success,proto3" json:"success,omitempty"`
	// contains filtered or unexported fields
}

func (*InstallSnapshotResponse) Descriptor deprecated

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

Deprecated: Use InstallSnapshotResponse.ProtoReflect.Descriptor instead.

func (*InstallSnapshotResponse) GetRpcHeader

func (x *InstallSnapshotResponse) GetRpcHeader() *RPCHeader

func (*InstallSnapshotResponse) GetSuccess

func (x *InstallSnapshotResponse) GetSuccess() bool

func (*InstallSnapshotResponse) GetTerm

func (x *InstallSnapshotResponse) GetTerm() uint64

func (*InstallSnapshotResponse) ProtoMessage

func (*InstallSnapshotResponse) ProtoMessage()

func (*InstallSnapshotResponse) ProtoReflect

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

func (*InstallSnapshotResponse) Reset

func (x *InstallSnapshotResponse) Reset()

func (*InstallSnapshotResponse) String

func (x *InstallSnapshotResponse) String() string

type KeyRange

type KeyRange struct {
	Lower []byte
	Upper []byte
}

type LeadershipTransferRequest

type LeadershipTransferRequest struct {
	ReplicaId string `protobuf:"bytes,1,opt,name=replica_id,json=replicaId,proto3" json:"replica_id,omitempty"`
	// contains filtered or unexported fields
}

func (*LeadershipTransferRequest) Descriptor deprecated

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

Deprecated: Use LeadershipTransferRequest.ProtoReflect.Descriptor instead.

func (*LeadershipTransferRequest) GetReplicaId

func (x *LeadershipTransferRequest) GetReplicaId() string

func (*LeadershipTransferRequest) ProtoMessage

func (*LeadershipTransferRequest) ProtoMessage()

func (*LeadershipTransferRequest) ProtoReflect

func (*LeadershipTransferRequest) Reset

func (x *LeadershipTransferRequest) Reset()

func (*LeadershipTransferRequest) String

func (x *LeadershipTransferRequest) String() string

type LeadershipTransferResponse

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

func (*LeadershipTransferResponse) Descriptor deprecated

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

Deprecated: Use LeadershipTransferResponse.ProtoReflect.Descriptor instead.

func (*LeadershipTransferResponse) ProtoMessage

func (*LeadershipTransferResponse) ProtoMessage()

func (*LeadershipTransferResponse) ProtoReflect

func (*LeadershipTransferResponse) Reset

func (x *LeadershipTransferResponse) Reset()

func (*LeadershipTransferResponse) String

func (x *LeadershipTransferResponse) String() string

type Log

type Log struct {
	Index      uint64                 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"`
	Term       uint64                 `protobuf:"varint,2,opt,name=term,proto3" json:"term,omitempty"`
	Type       Log_LogType            `protobuf:"varint,3,opt,name=type,proto3,enum=com.evrblk.monstera.Log_LogType" json:"type,omitempty"`
	Data       []byte                 `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"`
	Extensions []byte                 `protobuf:"bytes,5,opt,name=extensions,proto3" json:"extensions,omitempty"`
	AppendedAt *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=appended_at,json=appendedAt,proto3" json:"appended_at,omitempty"`
	// contains filtered or unexported fields
}

func (*Log) Descriptor deprecated

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

Deprecated: Use Log.ProtoReflect.Descriptor instead.

func (*Log) GetAppendedAt

func (x *Log) GetAppendedAt() *timestamppb.Timestamp

func (*Log) GetData

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

func (*Log) GetExtensions

func (x *Log) GetExtensions() []byte

func (*Log) GetIndex

func (x *Log) GetIndex() uint64

func (*Log) GetTerm

func (x *Log) GetTerm() uint64

func (*Log) GetType

func (x *Log) GetType() Log_LogType

func (*Log) ProtoMessage

func (*Log) ProtoMessage()

func (*Log) ProtoReflect

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

func (*Log) Reset

func (x *Log) Reset()

func (*Log) String

func (x *Log) String() string

type Log_LogType

type Log_LogType int32
const (
	Log_LOG_TYPE_COMMAND                Log_LogType = 0
	Log_LOG_TYPE_NOOP                   Log_LogType = 1
	Log_LOG_TYPE_ADD_PEER_DEPRECATED    Log_LogType = 2
	Log_LOG_TYPE_REMOVE_PEER_DEPRECATED Log_LogType = 3
	Log_LOG_TYPE_BARRIER                Log_LogType = 4
	Log_LOG_TYPE_CONFIGURATION          Log_LogType = 5
)

func (Log_LogType) Descriptor

func (Log_LogType) Enum

func (x Log_LogType) Enum() *Log_LogType

func (Log_LogType) EnumDescriptor deprecated

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

Deprecated: Use Log_LogType.Descriptor instead.

func (Log_LogType) Number

func (x Log_LogType) Number() protoreflect.EnumNumber

func (Log_LogType) String

func (x Log_LogType) String() string

func (Log_LogType) Type

type Metadata

type Metadata struct {
	Key   string `protobuf:"bytes,1,opt,name=Key,proto3" json:"Key,omitempty"`
	Value string `protobuf:"bytes,2,opt,name=Value,proto3" json:"Value,omitempty"`
	// contains filtered or unexported fields
}

func (*Metadata) Descriptor deprecated

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

Deprecated: Use Metadata.ProtoReflect.Descriptor instead.

func (*Metadata) GetKey

func (x *Metadata) GetKey() string

func (*Metadata) GetValue

func (x *Metadata) GetValue() string

func (*Metadata) ProtoMessage

func (*Metadata) ProtoMessage()

func (*Metadata) ProtoReflect

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

func (*Metadata) Reset

func (x *Metadata) Reset()

func (*Metadata) String

func (x *Metadata) String() string

type MonsteraApiClient

type MonsteraApiClient interface {
	Update(ctx context.Context, in *UpdateRequest, opts ...grpc.CallOption) (*UpdateResponse, error)
	Read(ctx context.Context, in *ReadRequest, opts ...grpc.CallOption) (*ReadResponse, error)
	// AppendEntriesPipeline opens an AppendEntries message stream.
	AppendEntriesPipeline(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[AppendEntriesRequest, AppendEntriesResponse], error)
	// AppendEntries performs a single append entries request / response.
	AppendEntries(ctx context.Context, in *AppendEntriesRequest, opts ...grpc.CallOption) (*AppendEntriesResponse, error)
	// RequestVote is the command used by a candidate to ask a Raft peer for a
	// vote in an election.
	RequestVote(ctx context.Context, in *RequestVoteRequest, opts ...grpc.CallOption) (*RequestVoteResponse, error)
	// TimeoutNow is used to start a leadership transfer to the target node.
	TimeoutNow(ctx context.Context, in *TimeoutNowRequest, opts ...grpc.CallOption) (*TimeoutNowResponse, error)
	// InstallSnapshot is the command sent to a Raft peer to bootstrap its log
	// (and state machine) from a snapshot on another peer.
	InstallSnapshot(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[InstallSnapshotRequest, InstallSnapshotResponse], error)
	HealthCheck(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error)
	LeadershipTransfer(ctx context.Context, in *LeadershipTransferRequest, opts ...grpc.CallOption) (*LeadershipTransferResponse, error)
	TriggerSnapshot(ctx context.Context, in *TriggerSnapshotRequest, opts ...grpc.CallOption) (*TriggerSnapshotResponse, error)
	AddVoter(ctx context.Context, in *AddVoterRequest, opts ...grpc.CallOption) (*AddVoterResponse, error)
	UpdateClusterConfig(ctx context.Context, in *UpdateClusterConfigRequest, opts ...grpc.CallOption) (*UpdateClusterConfigResponse, error)
}

MonsteraApiClient is the client API for MonsteraApi 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.

type MonsteraApiServer

type MonsteraApiServer interface {
	Update(context.Context, *UpdateRequest) (*UpdateResponse, error)
	Read(context.Context, *ReadRequest) (*ReadResponse, error)
	// AppendEntriesPipeline opens an AppendEntries message stream.
	AppendEntriesPipeline(grpc.BidiStreamingServer[AppendEntriesRequest, AppendEntriesResponse]) error
	// AppendEntries performs a single append entries request / response.
	AppendEntries(context.Context, *AppendEntriesRequest) (*AppendEntriesResponse, error)
	// RequestVote is the command used by a candidate to ask a Raft peer for a
	// vote in an election.
	RequestVote(context.Context, *RequestVoteRequest) (*RequestVoteResponse, error)
	// TimeoutNow is used to start a leadership transfer to the target node.
	TimeoutNow(context.Context, *TimeoutNowRequest) (*TimeoutNowResponse, error)
	// InstallSnapshot is the command sent to a Raft peer to bootstrap its log
	// (and state machine) from a snapshot on another peer.
	InstallSnapshot(grpc.ClientStreamingServer[InstallSnapshotRequest, InstallSnapshotResponse]) error
	HealthCheck(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error)
	LeadershipTransfer(context.Context, *LeadershipTransferRequest) (*LeadershipTransferResponse, error)
	TriggerSnapshot(context.Context, *TriggerSnapshotRequest) (*TriggerSnapshotResponse, error)
	AddVoter(context.Context, *AddVoterRequest) (*AddVoterResponse, error)
	UpdateClusterConfig(context.Context, *UpdateClusterConfigRequest) (*UpdateClusterConfigResponse, error)
	// contains filtered or unexported methods
}

MonsteraApiServer is the server API for MonsteraApi service. All implementations must embed UnimplementedMonsteraApiServer for forward compatibility.

type MonsteraApi_AppendEntriesPipelineClient

type MonsteraApi_AppendEntriesPipelineClient = grpc.BidiStreamingClient[AppendEntriesRequest, AppendEntriesResponse]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type MonsteraApi_AppendEntriesPipelineServer

type MonsteraApi_AppendEntriesPipelineServer = grpc.BidiStreamingServer[AppendEntriesRequest, AppendEntriesResponse]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type MonsteraApi_InstallSnapshotClient

type MonsteraApi_InstallSnapshotClient = grpc.ClientStreamingClient[InstallSnapshotRequest, InstallSnapshotResponse]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type MonsteraApi_InstallSnapshotServer

type MonsteraApi_InstallSnapshotServer = grpc.ClientStreamingServer[InstallSnapshotRequest, InstallSnapshotResponse]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type MonsteraClient

type MonsteraClient struct {
	ReplicaStates map[string]*ReplicaState
	// contains filtered or unexported fields
}

func NewMonsteraClient

func NewMonsteraClient(clusterConfig *ClusterConfig) *MonsteraClient

func (*MonsteraClient) LeadershipTransfer

func (c *MonsteraClient) LeadershipTransfer(applicationName string, shardId string, replicaId string) error

func (*MonsteraClient) ListShards

func (c *MonsteraClient) ListShards(applicationName string) ([]*Shard, error)

func (*MonsteraClient) Read

func (c *MonsteraClient) Read(ctx context.Context, applicationName string, shardKey []byte, allowReadFromFollowers bool, payload []byte) ([]byte, error)

func (*MonsteraClient) ReadShard

func (c *MonsteraClient) ReadShard(ctx context.Context, applicationName string, shardId string, allowReadFromFollowers bool, payload []byte) ([]byte, error)

func (*MonsteraClient) Start

func (c *MonsteraClient) Start()

func (*MonsteraClient) Stop

func (c *MonsteraClient) Stop()

func (*MonsteraClient) TriggerSnapshot

func (c *MonsteraClient) TriggerSnapshot(applicationName string, shardId string, replicaId string) error

func (*MonsteraClient) Update

func (c *MonsteraClient) Update(ctx context.Context, applicationName string, shardKey []byte, payload []byte) ([]byte, error)

func (*MonsteraClient) UpdateShard

func (c *MonsteraClient) UpdateShard(ctx context.Context, applicationName string, shardId string, payload []byte) ([]byte, error)

type MonsteraCommand

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

func (*MonsteraCommand) Descriptor deprecated

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

Deprecated: Use MonsteraCommand.ProtoReflect.Descriptor instead.

func (*MonsteraCommand) GetPayload

func (x *MonsteraCommand) GetPayload() []byte

func (*MonsteraCommand) ProtoMessage

func (*MonsteraCommand) ProtoMessage()

func (*MonsteraCommand) ProtoReflect

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

func (*MonsteraCommand) Reset

func (x *MonsteraCommand) Reset()

func (*MonsteraCommand) String

func (x *MonsteraCommand) String() string

type MonsteraConnectionPool

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

func NewMonsteraConnectionPool

func NewMonsteraConnectionPool() *MonsteraConnectionPool

func (*MonsteraConnectionPool) Close

func (p *MonsteraConnectionPool) Close()

func (*MonsteraConnectionPool) DeleteConnection

func (p *MonsteraConnectionPool) DeleteConnection(nodeAddress string)

func (*MonsteraConnectionPool) GetConnection

func (p *MonsteraConnectionPool) GetConnection(nodeAddress string) (MonsteraApiClient, error)

type MonsteraNode

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

func NewNode

func NewNode(baseDir string, nodeAddress string, clusterConfig *ClusterConfig, coreDescriptors ApplicationCoreDescriptors, monsteraNodeConfig MonsteraNodeConfig) (*MonsteraNode, error)

func (*MonsteraNode) AddVoter

func (n *MonsteraNode) AddVoter(ctx context.Context, replicaId string, voterReplicaId string, voterAddress string) error

func (*MonsteraNode) AppendEntries

func (n *MonsteraNode) AppendEntries(replicaId string, request *hraft.AppendEntriesRequest) (*hraft.AppendEntriesResponse, error)

func (*MonsteraNode) InstallSnapshot

func (n *MonsteraNode) InstallSnapshot(replicaId string, request *hraft.InstallSnapshotRequest, data io.Reader) (*hraft.InstallSnapshotResponse, error)

func (*MonsteraNode) LeadershipTransfer

func (n *MonsteraNode) LeadershipTransfer(replicaId string) error

func (*MonsteraNode) ListCores

func (n *MonsteraNode) ListCores() []*MonsteraReplica

func (*MonsteraNode) NodeState

func (n *MonsteraNode) NodeState() MonsteraNodeState

func (*MonsteraNode) Read

func (n *MonsteraNode) Read(ctx context.Context, request *ReadRequest) ([]byte, error)

func (*MonsteraNode) RequestVote

func (n *MonsteraNode) RequestVote(ctx context.Context, replicaId string, request *hraft.RequestVoteRequest) (*hraft.RequestVoteResponse, error)

func (*MonsteraNode) Start

func (n *MonsteraNode) Start()

func (*MonsteraNode) Stop

func (n *MonsteraNode) Stop()

func (*MonsteraNode) TimeoutNow

func (n *MonsteraNode) TimeoutNow(ctx context.Context, replicaId string, request *hraft.TimeoutNowRequest) (*hraft.TimeoutNowResponse, error)

func (*MonsteraNode) TriggerSnapshot

func (n *MonsteraNode) TriggerSnapshot(replicaId string) error

func (*MonsteraNode) Update

func (n *MonsteraNode) Update(ctx context.Context, request *UpdateRequest) ([]byte, error)

func (*MonsteraNode) UpdateClusterConfig

func (n *MonsteraNode) UpdateClusterConfig(ctx context.Context, newConfig *ClusterConfig) error

type MonsteraNodeConfig

type MonsteraNodeConfig struct {
	MaxHops          int32
	MaxReadTimeout   time.Duration
	MaxUpdateTimeout time.Duration

	// UseInMemoryRaftStore set to `true` should be used only in unit tests or dev environment and is not
	// recommended for production use, since in-memory Raft store is not durable.
	UseInMemoryRaftStore bool
}

type MonsteraNodeState

type MonsteraNodeState = int
const (
	INITIAL MonsteraNodeState = iota
	READY
	STOPPED
)

type MonsteraReplica

type MonsteraReplica struct {
	ApplicationName string
	ShardId         string
	ReplicaId       string
	// contains filtered or unexported fields
}

func NewMonsteraReplica

func NewMonsteraReplica(baseDir string, applicationName string, shardId string, replicaId string,
	myAddress string, core ApplicationCore, pool *MonsteraConnectionPool, raftStore *BadgerStore, restoreSnapshotOnStart bool) *MonsteraReplica

func (*MonsteraReplica) AddVoter

func (b *MonsteraReplica) AddVoter(replicaId string, address string) error

func (*MonsteraReplica) AppendEntries

func (*MonsteraReplica) Bootstrap

func (b *MonsteraReplica) Bootstrap(servers []hraft.Server)

func (*MonsteraReplica) Close

func (b *MonsteraReplica) Close()

func (*MonsteraReplica) GetRaftLeader

func (b *MonsteraReplica) GetRaftLeader() (hraft.ServerAddress, hraft.ServerID)

func (*MonsteraReplica) GetRaftState

func (b *MonsteraReplica) GetRaftState() hraft.RaftState

func (*MonsteraReplica) GetRaftStats

func (b *MonsteraReplica) GetRaftStats() map[string]string

func (*MonsteraReplica) InstallSnapshot

func (*MonsteraReplica) IsBootstrapped

func (b *MonsteraReplica) IsBootstrapped() bool

func (*MonsteraReplica) LeadershipTransfer

func (b *MonsteraReplica) LeadershipTransfer() error

func (*MonsteraReplica) ListSnapshots

func (b *MonsteraReplica) ListSnapshots() ([]*hraft.SnapshotMeta, error)

func (*MonsteraReplica) Read

func (b *MonsteraReplica) Read(request []byte) ([]byte, error)

func (*MonsteraReplica) RequestVote

func (*MonsteraReplica) TimeoutNow

func (*MonsteraReplica) TriggerSnapshot

func (b *MonsteraReplica) TriggerSnapshot()

func (*MonsteraReplica) Update

func (b *MonsteraReplica) Update(request []byte) ([]byte, error)

type MonsteraServer

type MonsteraServer struct {
	UnimplementedMonsteraApiServer
	// contains filtered or unexported fields
}

func NewMonsteraServer

func NewMonsteraServer(monsteraNode *MonsteraNode) *MonsteraServer

func (*MonsteraServer) AddVoter

func (s *MonsteraServer) AddVoter(ctx context.Context, request *AddVoterRequest) (*AddVoterResponse, error)

func (*MonsteraServer) AppendEntries

func (s *MonsteraServer) AppendEntries(ctx context.Context, request *AppendEntriesRequest) (*AppendEntriesResponse, error)

func (*MonsteraServer) AppendEntriesPipeline

func (s *MonsteraServer) AppendEntriesPipeline(stream MonsteraApi_AppendEntriesPipelineServer) error

func (*MonsteraServer) HealthCheck

func (s *MonsteraServer) HealthCheck(ctx context.Context, request *HealthCheckRequest) (*HealthCheckResponse, error)

func (*MonsteraServer) InstallSnapshot

func (s *MonsteraServer) InstallSnapshot(stream MonsteraApi_InstallSnapshotServer) error

func (*MonsteraServer) LeadershipTransfer

func (*MonsteraServer) Read

func (s *MonsteraServer) Read(ctx context.Context, request *ReadRequest) (*ReadResponse, error)

func (*MonsteraServer) RequestVote

func (s *MonsteraServer) RequestVote(ctx context.Context, request *RequestVoteRequest) (*RequestVoteResponse, error)

func (*MonsteraServer) TimeoutNow

func (s *MonsteraServer) TimeoutNow(ctx context.Context, request *TimeoutNowRequest) (*TimeoutNowResponse, error)

func (*MonsteraServer) TriggerSnapshot

func (s *MonsteraServer) TriggerSnapshot(ctx context.Context, request *TriggerSnapshotRequest) (*TriggerSnapshotResponse, error)

func (*MonsteraServer) Update

func (s *MonsteraServer) Update(ctx context.Context, request *UpdateRequest) (*UpdateResponse, error)

func (*MonsteraServer) UpdateClusterConfig

type Node

type Node struct {
	Address  string      `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	Metadata []*Metadata `protobuf:"bytes,2,rep,name=metadata,proto3" json:"metadata,omitempty"`
	// contains filtered or unexported fields
}

func (*Node) Descriptor deprecated

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

Deprecated: Use Node.ProtoReflect.Descriptor instead.

func (*Node) GetAddress

func (x *Node) GetAddress() string

func (*Node) GetMetadata

func (x *Node) GetMetadata() []*Metadata

func (*Node) ProtoMessage

func (*Node) ProtoMessage()

func (*Node) ProtoReflect

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

func (*Node) Reset

func (x *Node) Reset()

func (*Node) String

func (x *Node) String() string

type RPCHeader

type RPCHeader struct {
	ProtocolVersion int64  `protobuf:"varint,1,opt,name=protocol_version,json=protocolVersion,proto3" json:"protocol_version,omitempty"`
	Id              []byte `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
	Addr            []byte `protobuf:"bytes,3,opt,name=addr,proto3" json:"addr,omitempty"`
	// contains filtered or unexported fields
}

func (*RPCHeader) Descriptor deprecated

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

Deprecated: Use RPCHeader.ProtoReflect.Descriptor instead.

func (*RPCHeader) GetAddr

func (x *RPCHeader) GetAddr() []byte

func (*RPCHeader) GetId

func (x *RPCHeader) GetId() []byte

func (*RPCHeader) GetProtocolVersion

func (x *RPCHeader) GetProtocolVersion() int64

func (*RPCHeader) ProtoMessage

func (*RPCHeader) ProtoMessage()

func (*RPCHeader) ProtoReflect

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

func (*RPCHeader) Reset

func (x *RPCHeader) Reset()

func (*RPCHeader) String

func (x *RPCHeader) String() string

type RaftSnapshot

type RaftSnapshot struct {
	Id    string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Index uint64 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"`
	Term  uint64 `protobuf:"varint,3,opt,name=term,proto3" json:"term,omitempty"`
	Size  int64  `protobuf:"varint,4,opt,name=size,proto3" json:"size,omitempty"`
	// contains filtered or unexported fields
}

func (*RaftSnapshot) Descriptor deprecated

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

Deprecated: Use RaftSnapshot.ProtoReflect.Descriptor instead.

func (*RaftSnapshot) GetId

func (x *RaftSnapshot) GetId() string

func (*RaftSnapshot) GetIndex

func (x *RaftSnapshot) GetIndex() uint64

func (*RaftSnapshot) GetSize

func (x *RaftSnapshot) GetSize() int64

func (*RaftSnapshot) GetTerm

func (x *RaftSnapshot) GetTerm() uint64

func (*RaftSnapshot) ProtoMessage

func (*RaftSnapshot) ProtoMessage()

func (*RaftSnapshot) ProtoReflect

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

func (*RaftSnapshot) Reset

func (x *RaftSnapshot) Reset()

func (*RaftSnapshot) String

func (x *RaftSnapshot) String() string

type RaftState

type RaftState int32
const (
	RaftState_RAFT_STATE_INVALID   RaftState = 0
	RaftState_RAFT_STATE_FOLLOWER  RaftState = 1
	RaftState_RAFT_STATE_LEADER    RaftState = 2
	RaftState_RAFT_STATE_CANDIDATE RaftState = 3
	RaftState_RAFT_STATE_SHUTDOWN  RaftState = 4
)

func (RaftState) Descriptor

func (RaftState) Descriptor() protoreflect.EnumDescriptor

func (RaftState) Enum

func (x RaftState) Enum() *RaftState

func (RaftState) EnumDescriptor deprecated

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

Deprecated: Use RaftState.Descriptor instead.

func (RaftState) Number

func (x RaftState) Number() protoreflect.EnumNumber

func (RaftState) String

func (x RaftState) String() string

func (RaftState) Type

type ReadRequest

type ReadRequest struct {
	Payload                []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
	AllowReadFromFollowers bool   `` /* 132-byte string literal not displayed */
	ShardKey               []byte `protobuf:"bytes,3,opt,name=shard_key,json=shardKey,proto3" json:"shard_key,omitempty"`
	ApplicationName        string `protobuf:"bytes,4,opt,name=application_name,json=applicationName,proto3" json:"application_name,omitempty"`
	KeyspaceName           string `protobuf:"bytes,5,opt,name=keyspace_name,json=keyspaceName,proto3" json:"keyspace_name,omitempty"`
	ShardId                string `protobuf:"bytes,6,opt,name=shard_id,json=shardId,proto3" json:"shard_id,omitempty"`
	ReplicaId              string `protobuf:"bytes,7,opt,name=replica_id,json=replicaId,proto3" json:"replica_id,omitempty"`
	Hops                   int32  `protobuf:"varint,8,opt,name=hops,proto3" json:"hops,omitempty"`
	// contains filtered or unexported fields
}

func (*ReadRequest) Descriptor deprecated

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

Deprecated: Use ReadRequest.ProtoReflect.Descriptor instead.

func (*ReadRequest) GetAllowReadFromFollowers

func (x *ReadRequest) GetAllowReadFromFollowers() bool

func (*ReadRequest) GetApplicationName

func (x *ReadRequest) GetApplicationName() string

func (*ReadRequest) GetHops

func (x *ReadRequest) GetHops() int32

func (*ReadRequest) GetKeyspaceName

func (x *ReadRequest) GetKeyspaceName() string

func (*ReadRequest) GetPayload

func (x *ReadRequest) GetPayload() []byte

func (*ReadRequest) GetReplicaId

func (x *ReadRequest) GetReplicaId() string

func (*ReadRequest) GetShardId

func (x *ReadRequest) GetShardId() string

func (*ReadRequest) GetShardKey

func (x *ReadRequest) GetShardKey() []byte

func (*ReadRequest) ProtoMessage

func (*ReadRequest) ProtoMessage()

func (*ReadRequest) ProtoReflect

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

func (*ReadRequest) Reset

func (x *ReadRequest) Reset()

func (*ReadRequest) String

func (x *ReadRequest) String() string

type ReadResponse

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

func (*ReadResponse) Descriptor deprecated

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

Deprecated: Use ReadResponse.ProtoReflect.Descriptor instead.

func (*ReadResponse) GetPayload

func (x *ReadResponse) GetPayload() []byte

func (*ReadResponse) ProtoMessage

func (*ReadResponse) ProtoMessage()

func (*ReadResponse) ProtoReflect

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

func (*ReadResponse) Reset

func (x *ReadResponse) Reset()

func (*ReadResponse) String

func (x *ReadResponse) String() string

type Replica

type Replica struct {
	Id          string      `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	NodeAddress string      `protobuf:"bytes,2,opt,name=node_address,json=nodeAddress,proto3" json:"node_address,omitempty"`
	Metadata    []*Metadata `protobuf:"bytes,3,rep,name=metadata,proto3" json:"metadata,omitempty"`
	// contains filtered or unexported fields
}

func (*Replica) Descriptor deprecated

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

Deprecated: Use Replica.ProtoReflect.Descriptor instead.

func (*Replica) GetId

func (x *Replica) GetId() string

func (*Replica) GetMetadata

func (x *Replica) GetMetadata() []*Metadata

func (*Replica) GetNodeAddress

func (x *Replica) GetNodeAddress() string

func (*Replica) ProtoMessage

func (*Replica) ProtoMessage()

func (*Replica) ProtoReflect

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

func (*Replica) Reset

func (x *Replica) Reset()

func (*Replica) String

func (x *Replica) String() string

type ReplicaState

type ReplicaState struct {
	ReplicaId string            `protobuf:"bytes,1,opt,name=replica_id,json=replicaId,proto3" json:"replica_id,omitempty"`
	RaftState RaftState         `protobuf:"varint,2,opt,name=raft_state,json=raftState,proto3,enum=com.evrblk.monstera.RaftState" json:"raft_state,omitempty"`
	RaftStats map[string]string `` /* 162-byte string literal not displayed */
	Snapshots []*RaftSnapshot   `protobuf:"bytes,4,rep,name=snapshots,proto3" json:"snapshots,omitempty"`
	// contains filtered or unexported fields
}

func (*ReplicaState) Descriptor deprecated

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

Deprecated: Use ReplicaState.ProtoReflect.Descriptor instead.

func (*ReplicaState) GetRaftState

func (x *ReplicaState) GetRaftState() RaftState

func (*ReplicaState) GetRaftStats

func (x *ReplicaState) GetRaftStats() map[string]string

func (*ReplicaState) GetReplicaId

func (x *ReplicaState) GetReplicaId() string

func (*ReplicaState) GetSnapshots

func (x *ReplicaState) GetSnapshots() []*RaftSnapshot

func (*ReplicaState) ProtoMessage

func (*ReplicaState) ProtoMessage()

func (*ReplicaState) ProtoReflect

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

func (*ReplicaState) Reset

func (x *ReplicaState) Reset()

func (*ReplicaState) String

func (x *ReplicaState) String() string

type RequestVoteRequest

type RequestVoteRequest struct {
	RpcHeader          *RPCHeader `protobuf:"bytes,1,opt,name=rpc_header,json=rpcHeader,proto3" json:"rpc_header,omitempty"`
	Term               uint64     `protobuf:"varint,2,opt,name=term,proto3" json:"term,omitempty"`
	LastLogIndex       uint64     `protobuf:"varint,4,opt,name=last_log_index,json=lastLogIndex,proto3" json:"last_log_index,omitempty"`
	LastLogTerm        uint64     `protobuf:"varint,5,opt,name=last_log_term,json=lastLogTerm,proto3" json:"last_log_term,omitempty"`
	LeadershipTransfer bool       `protobuf:"varint,6,opt,name=leadership_transfer,json=leadershipTransfer,proto3" json:"leadership_transfer,omitempty"`
	TargetReplicaId    string     `protobuf:"bytes,7,opt,name=target_replica_id,json=targetReplicaId,proto3" json:"target_replica_id,omitempty"`
	// contains filtered or unexported fields
}

func (*RequestVoteRequest) Descriptor deprecated

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

Deprecated: Use RequestVoteRequest.ProtoReflect.Descriptor instead.

func (*RequestVoteRequest) GetLastLogIndex

func (x *RequestVoteRequest) GetLastLogIndex() uint64

func (*RequestVoteRequest) GetLastLogTerm

func (x *RequestVoteRequest) GetLastLogTerm() uint64

func (*RequestVoteRequest) GetLeadershipTransfer

func (x *RequestVoteRequest) GetLeadershipTransfer() bool

func (*RequestVoteRequest) GetRpcHeader

func (x *RequestVoteRequest) GetRpcHeader() *RPCHeader

func (*RequestVoteRequest) GetTargetReplicaId

func (x *RequestVoteRequest) GetTargetReplicaId() string

func (*RequestVoteRequest) GetTerm

func (x *RequestVoteRequest) GetTerm() uint64

func (*RequestVoteRequest) ProtoMessage

func (*RequestVoteRequest) ProtoMessage()

func (*RequestVoteRequest) ProtoReflect

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

func (*RequestVoteRequest) Reset

func (x *RequestVoteRequest) Reset()

func (*RequestVoteRequest) String

func (x *RequestVoteRequest) String() string

type RequestVoteResponse

type RequestVoteResponse struct {
	RpcHeader *RPCHeader `protobuf:"bytes,1,opt,name=rpc_header,json=rpcHeader,proto3" json:"rpc_header,omitempty"`
	Term      uint64     `protobuf:"varint,2,opt,name=term,proto3" json:"term,omitempty"`
	Peers     []byte     `protobuf:"bytes,3,opt,name=peers,proto3" json:"peers,omitempty"`
	Granted   bool       `protobuf:"varint,4,opt,name=granted,proto3" json:"granted,omitempty"`
	// contains filtered or unexported fields
}

func (*RequestVoteResponse) Descriptor deprecated

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

Deprecated: Use RequestVoteResponse.ProtoReflect.Descriptor instead.

func (*RequestVoteResponse) GetGranted

func (x *RequestVoteResponse) GetGranted() bool

func (*RequestVoteResponse) GetPeers

func (x *RequestVoteResponse) GetPeers() []byte

func (*RequestVoteResponse) GetRpcHeader

func (x *RequestVoteResponse) GetRpcHeader() *RPCHeader

func (*RequestVoteResponse) GetTerm

func (x *RequestVoteResponse) GetTerm() uint64

func (*RequestVoteResponse) ProtoMessage

func (*RequestVoteResponse) ProtoMessage()

func (*RequestVoteResponse) ProtoReflect

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

func (*RequestVoteResponse) Reset

func (x *RequestVoteResponse) Reset()

func (*RequestVoteResponse) String

func (x *RequestVoteResponse) String() string

type Shard

type Shard struct {
	Id         string      `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	LowerBound []byte      `protobuf:"bytes,2,opt,name=lower_bound,json=lowerBound,proto3" json:"lower_bound,omitempty"`
	UpperBound []byte      `protobuf:"bytes,3,opt,name=upper_bound,json=upperBound,proto3" json:"upper_bound,omitempty"`
	ParentId   string      `protobuf:"bytes,4,opt,name=parent_id,json=parentId,proto3" json:"parent_id,omitempty"`
	Replicas   []*Replica  `protobuf:"bytes,5,rep,name=replicas,proto3" json:"replicas,omitempty"`
	Metadata   []*Metadata `protobuf:"bytes,6,rep,name=metadata,proto3" json:"metadata,omitempty"`
	// contains filtered or unexported fields
}

func (*Shard) Descriptor deprecated

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

Deprecated: Use Shard.ProtoReflect.Descriptor instead.

func (*Shard) GetId

func (x *Shard) GetId() string

func (*Shard) GetLowerBound

func (x *Shard) GetLowerBound() []byte

func (*Shard) GetMetadata

func (x *Shard) GetMetadata() []*Metadata

func (*Shard) GetParentId

func (x *Shard) GetParentId() string

func (*Shard) GetReplicas

func (x *Shard) GetReplicas() []*Replica

func (*Shard) GetUpperBound

func (x *Shard) GetUpperBound() []byte

func (*Shard) MarshalJSON

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

func (*Shard) ProtoMessage

func (*Shard) ProtoMessage()

func (*Shard) ProtoReflect

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

func (*Shard) Reset

func (x *Shard) Reset()

func (*Shard) String

func (x *Shard) String() string

func (*Shard) UnmarshalJSON

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

type TimeoutNowRequest

type TimeoutNowRequest struct {
	RpcHeader       *RPCHeader `protobuf:"bytes,1,opt,name=rpc_header,json=rpcHeader,proto3" json:"rpc_header,omitempty"`
	TargetReplicaId string     `protobuf:"bytes,2,opt,name=target_replica_id,json=targetReplicaId,proto3" json:"target_replica_id,omitempty"`
	// contains filtered or unexported fields
}

func (*TimeoutNowRequest) Descriptor deprecated

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

Deprecated: Use TimeoutNowRequest.ProtoReflect.Descriptor instead.

func (*TimeoutNowRequest) GetRpcHeader

func (x *TimeoutNowRequest) GetRpcHeader() *RPCHeader

func (*TimeoutNowRequest) GetTargetReplicaId

func (x *TimeoutNowRequest) GetTargetReplicaId() string

func (*TimeoutNowRequest) ProtoMessage

func (*TimeoutNowRequest) ProtoMessage()

func (*TimeoutNowRequest) ProtoReflect

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

func (*TimeoutNowRequest) Reset

func (x *TimeoutNowRequest) Reset()

func (*TimeoutNowRequest) String

func (x *TimeoutNowRequest) String() string

type TimeoutNowResponse

type TimeoutNowResponse struct {
	RpcHeader *RPCHeader `protobuf:"bytes,1,opt,name=rpc_header,json=rpcHeader,proto3" json:"rpc_header,omitempty"`
	// contains filtered or unexported fields
}

func (*TimeoutNowResponse) Descriptor deprecated

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

Deprecated: Use TimeoutNowResponse.ProtoReflect.Descriptor instead.

func (*TimeoutNowResponse) GetRpcHeader

func (x *TimeoutNowResponse) GetRpcHeader() *RPCHeader

func (*TimeoutNowResponse) ProtoMessage

func (*TimeoutNowResponse) ProtoMessage()

func (*TimeoutNowResponse) ProtoReflect

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

func (*TimeoutNowResponse) Reset

func (x *TimeoutNowResponse) Reset()

func (*TimeoutNowResponse) String

func (x *TimeoutNowResponse) String() string

type TriggerSnapshotRequest

type TriggerSnapshotRequest struct {
	ReplicaId string `protobuf:"bytes,1,opt,name=replica_id,json=replicaId,proto3" json:"replica_id,omitempty"`
	// contains filtered or unexported fields
}

func (*TriggerSnapshotRequest) Descriptor deprecated

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

Deprecated: Use TriggerSnapshotRequest.ProtoReflect.Descriptor instead.

func (*TriggerSnapshotRequest) GetReplicaId

func (x *TriggerSnapshotRequest) GetReplicaId() string

func (*TriggerSnapshotRequest) ProtoMessage

func (*TriggerSnapshotRequest) ProtoMessage()

func (*TriggerSnapshotRequest) ProtoReflect

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

func (*TriggerSnapshotRequest) Reset

func (x *TriggerSnapshotRequest) Reset()

func (*TriggerSnapshotRequest) String

func (x *TriggerSnapshotRequest) String() string

type TriggerSnapshotResponse

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

func (*TriggerSnapshotResponse) Descriptor deprecated

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

Deprecated: Use TriggerSnapshotResponse.ProtoReflect.Descriptor instead.

func (*TriggerSnapshotResponse) ProtoMessage

func (*TriggerSnapshotResponse) ProtoMessage()

func (*TriggerSnapshotResponse) ProtoReflect

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

func (*TriggerSnapshotResponse) Reset

func (x *TriggerSnapshotResponse) Reset()

func (*TriggerSnapshotResponse) String

func (x *TriggerSnapshotResponse) String() string

type Txn

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

func (*Txn) Commit

func (t *Txn) Commit() error

func (*Txn) Delete

func (t *Txn) Delete(key []byte) error

func (*Txn) Discard

func (t *Txn) Discard()

func (*Txn) EachPrefix

func (t *Txn) EachPrefix(prefix []byte, fn func(key []byte, value []byte) (bool, error)) error

func (*Txn) EachPrefixKeys

func (t *Txn) EachPrefixKeys(prefix []byte, fn func(key []byte) (bool, error)) error

func (*Txn) EachRange

func (t *Txn) EachRange(lowerBound []byte, upperBound []byte, reverse bool, fn func(key []byte, value []byte) (bool, error)) error

func (*Txn) Get

func (t *Txn) Get(key []byte) ([]byte, error)

func (*Txn) PrefixExists

func (t *Txn) PrefixExists(prefix []byte) (bool, error)

func (*Txn) Set

func (t *Txn) Set(key []byte, value []byte) error

type UnimplementedMonsteraApiServer

type UnimplementedMonsteraApiServer struct{}

UnimplementedMonsteraApiServer 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 (UnimplementedMonsteraApiServer) AddVoter

func (UnimplementedMonsteraApiServer) AppendEntries

func (UnimplementedMonsteraApiServer) HealthCheck

func (UnimplementedMonsteraApiServer) LeadershipTransfer

func (UnimplementedMonsteraApiServer) Read

func (UnimplementedMonsteraApiServer) RequestVote

func (UnimplementedMonsteraApiServer) TimeoutNow

func (UnimplementedMonsteraApiServer) TriggerSnapshot

func (UnimplementedMonsteraApiServer) Update

type UnsafeMonsteraApiServer

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

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

type UpdateClusterConfigRequest

type UpdateClusterConfigRequest struct {
	Config *ClusterConfig `protobuf:"bytes,1,opt,name=config,proto3" json:"config,omitempty"`
	// contains filtered or unexported fields
}

func (*UpdateClusterConfigRequest) Descriptor deprecated

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

Deprecated: Use UpdateClusterConfigRequest.ProtoReflect.Descriptor instead.

func (*UpdateClusterConfigRequest) GetConfig

func (x *UpdateClusterConfigRequest) GetConfig() *ClusterConfig

func (*UpdateClusterConfigRequest) ProtoMessage

func (*UpdateClusterConfigRequest) ProtoMessage()

func (*UpdateClusterConfigRequest) ProtoReflect

func (*UpdateClusterConfigRequest) Reset

func (x *UpdateClusterConfigRequest) Reset()

func (*UpdateClusterConfigRequest) String

func (x *UpdateClusterConfigRequest) String() string

type UpdateClusterConfigResponse

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

func (*UpdateClusterConfigResponse) Descriptor deprecated

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

Deprecated: Use UpdateClusterConfigResponse.ProtoReflect.Descriptor instead.

func (*UpdateClusterConfigResponse) ProtoMessage

func (*UpdateClusterConfigResponse) ProtoMessage()

func (*UpdateClusterConfigResponse) ProtoReflect

func (*UpdateClusterConfigResponse) Reset

func (x *UpdateClusterConfigResponse) Reset()

func (*UpdateClusterConfigResponse) String

func (x *UpdateClusterConfigResponse) String() string

type UpdateRequest

type UpdateRequest struct {
	Payload         []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
	ShardKey        []byte `protobuf:"bytes,2,opt,name=shard_key,json=shardKey,proto3" json:"shard_key,omitempty"`
	ApplicationName string `protobuf:"bytes,3,opt,name=application_name,json=applicationName,proto3" json:"application_name,omitempty"`
	KeyspaceName    string `protobuf:"bytes,4,opt,name=keyspace_name,json=keyspaceName,proto3" json:"keyspace_name,omitempty"`
	ShardId         string `protobuf:"bytes,5,opt,name=shard_id,json=shardId,proto3" json:"shard_id,omitempty"`
	ReplicaId       string `protobuf:"bytes,6,opt,name=replica_id,json=replicaId,proto3" json:"replica_id,omitempty"`
	Hops            int32  `protobuf:"varint,8,opt,name=hops,proto3" json:"hops,omitempty"`
	// contains filtered or unexported fields
}

func (*UpdateRequest) Descriptor deprecated

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

Deprecated: Use UpdateRequest.ProtoReflect.Descriptor instead.

func (*UpdateRequest) GetApplicationName

func (x *UpdateRequest) GetApplicationName() string

func (*UpdateRequest) GetHops

func (x *UpdateRequest) GetHops() int32

func (*UpdateRequest) GetKeyspaceName

func (x *UpdateRequest) GetKeyspaceName() string

func (*UpdateRequest) GetPayload

func (x *UpdateRequest) GetPayload() []byte

func (*UpdateRequest) GetReplicaId

func (x *UpdateRequest) GetReplicaId() string

func (*UpdateRequest) GetShardId

func (x *UpdateRequest) GetShardId() string

func (*UpdateRequest) GetShardKey

func (x *UpdateRequest) GetShardKey() []byte

func (*UpdateRequest) ProtoMessage

func (*UpdateRequest) ProtoMessage()

func (*UpdateRequest) ProtoReflect

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

func (*UpdateRequest) Reset

func (x *UpdateRequest) Reset()

func (*UpdateRequest) String

func (x *UpdateRequest) String() string

type UpdateResponse

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

func (*UpdateResponse) Descriptor deprecated

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

Deprecated: Use UpdateResponse.ProtoReflect.Descriptor instead.

func (*UpdateResponse) GetPayload

func (x *UpdateResponse) GetPayload() []byte

func (*UpdateResponse) ProtoMessage

func (*UpdateResponse) ProtoMessage()

func (*UpdateResponse) ProtoReflect

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

func (*UpdateResponse) Reset

func (x *UpdateResponse) Reset()

func (*UpdateResponse) String

func (x *UpdateResponse) String() string

Directories

Path Synopsis
cmd
monstera command
internal
x

Jump to

Keyboard shortcuts

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