Documentation ¶
Index ¶
- Constants
- Variables
- type GetOptions
- type GetReq
- type GetResp
- type KVRequest
- func (*KVRequest) Descriptor() ([]byte, []int)deprecated
- func (x *KVRequest) GetOriginNode() string
- func (m *KVRequest) GetRequest() isKVRequest_Request
- func (x *KVRequest) GetSet() *SetRequest
- func (*KVRequest) ProtoMessage()
- func (x *KVRequest) ProtoReflect() protoreflect.Message
- func (x *KVRequest) Reset()
- func (x *KVRequest) String() string
- type KVRequest_Set
- type KVStore
- type MemKvStore
- type SetOptions
- type SetReq
- type SetRequest
- func (*SetRequest) Descriptor() ([]byte, []int)deprecated
- func (x *SetRequest) GetDelete() bool
- func (x *SetRequest) GetIfExistsIs() bool
- func (x *SetRequest) GetIfLsnIs() int64
- func (x *SetRequest) GetIfValueIs() []byte
- func (x *SetRequest) GetKey() string
- func (x *SetRequest) GetRequestId() string
- func (x *SetRequest) GetValue() []byte
- func (*SetRequest) ProtoMessage()
- func (x *SetRequest) ProtoReflect() protoreflect.Message
- func (x *SetRequest) Reset()
- func (x *SetRequest) String() string
- type SetResp
- type StoreConfig
Constants ¶
View Source
const CheckpointInterval = time.Minute
Variables ¶
View Source
var File_message_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type GetOptions ¶
type GetOptions struct { // Requires strong consistent read // Guarentees to see all the writes that happens before this read request in physical time Linearizability bool // The last seen LSN // By default session consistency is provided by connecting to the same replica // however, in case of failover, a provided SessionLSN will provide the same session // consistency guarentee by blocking the request until LSN has been observed by the replica // Session consistency provides the following guarentees: Read-your-write, Monotic Read, Read after write // Will be ignored if Linearizability is true SessionLSN *int64 }
type GetReq ¶
type GetReq struct { Key string Options GetOptions }
type KVRequest ¶
type KVRequest struct { OriginNode string `protobuf:"bytes,1,opt,name=origin_node,json=originNode,proto3" json:"origin_node,omitempty"` // Types that are assignable to Request: // // *KVRequest_Set Request isKVRequest_Request `protobuf_oneof:"request"` // contains filtered or unexported fields }
func (*KVRequest) Descriptor
deprecated
func (*KVRequest) GetOriginNode ¶
func (*KVRequest) GetRequest ¶
func (m *KVRequest) GetRequest() isKVRequest_Request
func (*KVRequest) GetSet ¶
func (x *KVRequest) GetSet() *SetRequest
func (*KVRequest) ProtoMessage ¶
func (*KVRequest) ProtoMessage()
func (*KVRequest) ProtoReflect ¶
func (x *KVRequest) ProtoReflect() protoreflect.Message
type KVRequest_Set ¶
type KVRequest_Set struct {
Set *SetRequest `protobuf:"bytes,2,opt,name=set,proto3,oneof"`
}
type MemKvStore ¶
type MemKvStore struct {
// contains filtered or unexported fields
}
A memory based key/value store using Raft All data will be held in memory and we use checkpointing to periodically persist data back to disk along with the last seen LSN. Upon recovery we'll reload the data into memory and replay all raft messages since the last know LSN. So we literally use Raft replication log as the write ahead log for the database
func NewMemKVStore ¶
func NewMemKVStore(config StoreConfig, raft raft.Raft, logger *log.Logger) *MemKvStore
func (*MemKvStore) Start ¶
func (s *MemKvStore) Start()
func (*MemKvStore) Stop ¶
func (s *MemKvStore) Stop()
type SetOptions ¶
type SetReq ¶
type SetReq struct { Key string Value []byte // Set true to delete the value Delete bool Options SetOptions }
type SetRequest ¶
type SetRequest struct { RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` Value []byte `protobuf:"bytes,3,opt,name=value,proto3,oneof" json:"value,omitempty"` Delete *bool `protobuf:"varint,4,opt,name=delete,proto3,oneof" json:"delete,omitempty"` IfValueIs []byte `protobuf:"bytes,5,opt,name=if_value_is,json=ifValueIs,proto3,oneof" json:"if_value_is,omitempty"` IfLsnIs *int64 `protobuf:"varint,6,opt,name=if_lsn_is,json=ifLsnIs,proto3,oneof" json:"if_lsn_is,omitempty"` IfExistsIs *bool `protobuf:"varint,7,opt,name=if_exists_is,json=ifExistsIs,proto3,oneof" json:"if_exists_is,omitempty"` // contains filtered or unexported fields }
func (*SetRequest) Descriptor
deprecated
func (*SetRequest) Descriptor() ([]byte, []int)
Deprecated: Use SetRequest.ProtoReflect.Descriptor instead.
func (*SetRequest) GetDelete ¶
func (x *SetRequest) GetDelete() bool
func (*SetRequest) GetIfExistsIs ¶
func (x *SetRequest) GetIfExistsIs() bool
func (*SetRequest) GetIfLsnIs ¶
func (x *SetRequest) GetIfLsnIs() int64
func (*SetRequest) GetIfValueIs ¶
func (x *SetRequest) GetIfValueIs() []byte
func (*SetRequest) GetKey ¶
func (x *SetRequest) GetKey() string
func (*SetRequest) GetRequestId ¶
func (x *SetRequest) GetRequestId() string
func (*SetRequest) GetValue ¶
func (x *SetRequest) GetValue() []byte
func (*SetRequest) ProtoMessage ¶
func (*SetRequest) ProtoMessage()
func (*SetRequest) ProtoReflect ¶
func (x *SetRequest) ProtoReflect() protoreflect.Message
func (*SetRequest) Reset ¶
func (x *SetRequest) Reset()
func (*SetRequest) String ¶
func (x *SetRequest) String() string
type StoreConfig ¶
Click to show internal directories.
Click to hide internal directories.