Documentation ¶
Index ¶
- Constants
- Variables
- func BytesAsId(buffer []byte) uint64
- func IdAsBytes(id uint64, buffer []byte)
- func IsFileExists(filePath string) (bool, error)
- func LoadConfig(config *Config) (err error)
- func NewClusterNodeService(raft *raft.RaftNode)
- func NewGrpcKVService(numConcurrentReq int) kv_client.KVStoreServer
- func NewRaftPersistentStorage(w *wal.WAL, s *snap.Snapshotter) *raftPersistentStorage
- type ApiServer
- type CliftonDbServer
- func (s *CliftonDbServer) AddNode(context.Context, *cluster_services.AddNodeReq) (*cluster_services.AddNodeRes, error)
- func (s *CliftonDbServer) Boostrap() error
- func (s *CliftonDbServer) GetNodeList(context.Context, *interface{}) (*cluster_services.PeerListRes, error)
- func (s *CliftonDbServer) LookupPartitions(key string) (kv *kvstore.CliftonDBKVStore, ok bool)
- func (s *CliftonDbServer) RemoveNode(context.Context, *cluster_services.RemoveNodeReq) (*cluster_services.RemoveNodeRes, error)
- func (s *CliftonDbServer) ServeClusterNodeApi()
- func (s *CliftonDbServer) Shutdown()
- func (s *CliftonDbServer) WriteLockFile(data KvServerLockFileData) error
- type ClusterConfig
- type ClusterOptions
- type Config
- type DirPathOption
- type GetOptions
- type GrpcClusterNodeService
- func (GrpcClusterNodeService) AddNode(context.Context, *cluster_node.AddNodeReq) (*cluster_node.AddNodeRes, error)
- func (GrpcClusterNodeService) GetNodeList(context.Context, *interface{}) (*cluster_node.PeerListRes, error)
- func (GrpcClusterNodeService) RemoveNode(context.Context, *cluster_node.RemoveNodeReq) (*cluster_node.RemoveNodeRes, error)
- type GrpcKVService
- func (s *GrpcKVService) Delete(ctx context.Context, req *kv_client.DelReq) (*kv_client.DelRes, error)
- func (s GrpcKVService) Get(ctx context.Context, get *kv_client.GetReq) (*kv_client.Value, error)
- func (s GrpcKVService) Put(ctx context.Context, put *kv_client.PutReq) (*kv_client.PutRes, error)
- func (s *GrpcKVService) Register(grpcServer *grpc.Server)
- type JoinClusterOption
- type KvServerLockFileData
- type Options
- type PartitionId
- type Peer
- type PeerEntry
- type RaftNode
- func (r *RaftNode) CommitC() chan *string
- func (r *RaftNode) ErrorC() chan error
- func (rc *RaftNode) IsIDRemoved(id uint64) bool
- func (r *RaftNode) Loop(ticker *time.Ticker) error
- func (rc *RaftNode) Process(ctx context.Context, m raftpb.Message) error
- func (r *RaftNode) ProcessEntries(entry []raftpb.Entry) bool
- func (r *RaftNode) Propose(ctx context.Context, entryData []byte) error
- func (r *RaftNode) ProposeConfChange(ctx context.Context, change raftpb.ConfChange) error
- func (r *RaftNode) PublishEntries(entries []raftpb.Entry) bool
- func (r *RaftNode) PublishSnapshot(snapshot raftpb.Snapshot) error
- func (rc *RaftNode) ReportSnapshot(id uint64, status raft.SnapshotStatus)
- func (rc *RaftNode) ReportUnreachable(id uint64)
- func (r *RaftNode) Restart()
- func (r *RaftNode) Start()
- func (r *RaftNode) StartRaftServer() error
- func (r *RaftNode) Stop()
- func (r *RaftNode) TriggerSnapshot()
- type RaftNodes
- type RaftPersistentStorage
- type ReadConsistencyLevel
- type ReplicatedKvStore
- func (s *ReplicatedKvStore) Apply(entryData []byte)
- func (st *ReplicatedKvStore) Get(ctx context.Context, key string, options GetOptions) ([]byte, error)
- func (kv *ReplicatedKvStore) KvGrpcServer() kv_client.KVStoreServer
- func (p *ReplicatedKvStore) NewReplicatedKvStore(conf ClusterConfig) (*ReplicatedKvStore, error)
- func (st *ReplicatedKvStore) ProposeC() chan<- string
- func (st *ReplicatedKvStore) ProposeDelete(ctx context.Context, key []byte) (*internal_request.InternalResponse, error)
- func (kv *ReplicatedKvStore) ProposePut(ctx context.Context, key []byte, value []byte) (*internal_request.InternalResponse, error)
- func (kv *ReplicatedKvStore) RaftHandler() http.Handler
- func (s *ReplicatedKvStore) ServeKvStoreApi()
- func (s *ReplicatedKvStore) Stop()
- type RequestBuilder
- type RequestIdGenerator
- type StoppableListener
Constants ¶
View Source
const (
DefaultReadConsistency = Quorum
)
View Source
const PartionLockFileName = "partition.lock.file"
View Source
const TESTING = true
Variables ¶
View Source
var ConsistencyLevelNotSupportedErr = errors.New("consistency level not supported")
View Source
var DefaultGetOption = GetOptions{ DefaultReadConsistency, }
View Source
var StoppedErr = errors.New("listener stopped")
Functions ¶
func IsFileExists ¶
func LoadConfig ¶
func NewClusterNodeService ¶
func NewGrpcKVService ¶
func NewGrpcKVService(numConcurrentReq int) kv_client.KVStoreServer
func NewRaftPersistentStorage ¶
func NewRaftPersistentStorage(w *wal.WAL, s *snap.Snapshotter) *raftPersistentStorage
Types ¶
type CliftonDbServer ¶
type CliftonDbServer struct { Conf Config Partitions []PartitionId DbRootPath string LockFilePath string LogsPath string MetadatPath string PartitionPath string Logger *zap.Logger // contains filtered or unexported fields }
func NewCliftonDbServer ¶
func NewCliftonDbServer(conf Config) (*CliftonDbServer, error)
func (*CliftonDbServer) AddNode ¶
func (s *CliftonDbServer) AddNode(context.Context, *cluster_services.AddNodeReq) (*cluster_services.AddNodeRes, error)
func (*CliftonDbServer) Boostrap ¶
func (s *CliftonDbServer) Boostrap() error
func (*CliftonDbServer) GetNodeList ¶
func (s *CliftonDbServer) GetNodeList(context.Context, *interface{}) (*cluster_services.PeerListRes, error)
func (*CliftonDbServer) LookupPartitions ¶
func (s *CliftonDbServer) LookupPartitions(key string) (kv *kvstore.CliftonDBKVStore, ok bool)
func (*CliftonDbServer) RemoveNode ¶
func (s *CliftonDbServer) RemoveNode(context.Context, *cluster_services.RemoveNodeReq) (*cluster_services.RemoveNodeRes, error)
func (*CliftonDbServer) ServeClusterNodeApi ¶
func (s *CliftonDbServer) ServeClusterNodeApi()
func (*CliftonDbServer) Shutdown ¶
func (s *CliftonDbServer) Shutdown()
func (*CliftonDbServer) WriteLockFile ¶
func (s *CliftonDbServer) WriteLockFile(data KvServerLockFileData) error
type ClusterConfig ¶
func RaftClusterConfig ¶
func RaftClusterConfig(id uint, peers []PeerEntry, path string) ClusterConfig
func RaftStandaloneConfig ¶
func RaftStandaloneConfig(id uint, path string) ClusterConfig
type ClusterOptions ¶
type ClusterOptions struct {
// contains filtered or unexported fields
}
type DirPathOption ¶
type DirPathOption struct {
// contains filtered or unexported fields
}
type GetOptions ¶
type GetOptions struct {
ReadConsistencyLevel ReadConsistencyLevel
}
type GrpcClusterNodeService ¶
type GrpcClusterNodeService struct {
// contains filtered or unexported fields
}
func (GrpcClusterNodeService) AddNode ¶
func (GrpcClusterNodeService) AddNode(context.Context, *cluster_node.AddNodeReq) (*cluster_node.AddNodeRes, error)
func (GrpcClusterNodeService) GetNodeList ¶
func (GrpcClusterNodeService) GetNodeList(context.Context, *interface{}) (*cluster_node.PeerListRes, error)
func (GrpcClusterNodeService) RemoveNode ¶
func (GrpcClusterNodeService) RemoveNode(context.Context, *cluster_node.RemoveNodeReq) (*cluster_node.RemoveNodeRes, error)
type GrpcKVService ¶
type GrpcKVService struct {
// contains filtered or unexported fields
}
func (*GrpcKVService) Delete ¶
func (s *GrpcKVService) Delete(ctx context.Context, req *kv_client.DelReq) (*kv_client.DelRes, error)
func (GrpcKVService) Get ¶
func (s GrpcKVService) Get(ctx context.Context, get *kv_client.GetReq) (*kv_client.Value, error)
func (GrpcKVService) Put ¶
func (s GrpcKVService) Put(ctx context.Context, put *kv_client.PutReq) (*kv_client.PutRes, error)
func (*GrpcKVService) Register ¶
func (s *GrpcKVService) Register(grpcServer *grpc.Server)
type JoinClusterOption ¶
type JoinClusterOption struct{}
type KvServerLockFileData ¶
type KvServerLockFileData struct {
Partitions []PartitionId
}
type Options ¶
type Options interface {
// contains filtered or unexported methods
}
func JoinCluster ¶
func JoinCluster() Options
func WithDirPath ¶
type PartitionId ¶
type PartitionId int
type RaftNode ¶
type RaftNode struct { Id types.ID Peers []PeerEntry ClusterId types.ID WalDir string SnapDir string LastIndex uint64 Node raft.Node RaftURL string // contains filtered or unexported fields }
func NewRaftNode ¶
func NewRaftNode(conf ClusterConfig, proposeC <-chan string, confChangeC <-chan raftpb.ConfChange, options ...Options) (*RaftNode, error)
func (*RaftNode) IsIDRemoved ¶
func (*RaftNode) ProposeConfChange ¶
func (*RaftNode) PublishSnapshot ¶
func (*RaftNode) ReportSnapshot ¶
func (rc *RaftNode) ReportSnapshot(id uint64, status raft.SnapshotStatus)
func (*RaftNode) ReportUnreachable ¶
func (*RaftNode) StartRaftServer ¶
func (*RaftNode) TriggerSnapshot ¶
func (r *RaftNode) TriggerSnapshot()
type RaftPersistentStorage ¶
type ReadConsistencyLevel ¶
type ReadConsistencyLevel int
const ( Serializable ReadConsistencyLevel = iota Quorum Linearizable )
type ReplicatedKvStore ¶
type ReplicatedKvStore struct {
// contains filtered or unexported fields
}
func (*ReplicatedKvStore) Apply ¶
func (s *ReplicatedKvStore) Apply(entryData []byte)
func (*ReplicatedKvStore) Get ¶
func (st *ReplicatedKvStore) Get(ctx context.Context, key string, options GetOptions) ([]byte, error)
func (*ReplicatedKvStore) KvGrpcServer ¶
func (kv *ReplicatedKvStore) KvGrpcServer() kv_client.KVStoreServer
func (*ReplicatedKvStore) NewReplicatedKvStore ¶
func (p *ReplicatedKvStore) NewReplicatedKvStore(conf ClusterConfig) (*ReplicatedKvStore, error)
func (*ReplicatedKvStore) ProposeC ¶
func (st *ReplicatedKvStore) ProposeC() chan<- string
func (*ReplicatedKvStore) ProposeDelete ¶
func (st *ReplicatedKvStore) ProposeDelete(ctx context.Context, key []byte) ( *internal_request.InternalResponse, error)
func (*ReplicatedKvStore) ProposePut ¶
func (kv *ReplicatedKvStore) ProposePut(ctx context.Context, key []byte, value []byte) ( *internal_request.InternalResponse, error)
func (*ReplicatedKvStore) RaftHandler ¶
func (kv *ReplicatedKvStore) RaftHandler() http.Handler
func (*ReplicatedKvStore) ServeKvStoreApi ¶
func (s *ReplicatedKvStore) ServeKvStoreApi()
func (*ReplicatedKvStore) Stop ¶
func (s *ReplicatedKvStore) Stop()
type RequestBuilder ¶
type RequestBuilder struct {
// contains filtered or unexported fields
}
func NewRequestBuilder ¶
func NewRequestBuilder(gen RequestIdGenerator) *RequestBuilder
func (*RequestBuilder) NewDeleteRequest ¶
func (b *RequestBuilder) NewDeleteRequest(key []byte) *internal_request.InternalRequest
func (*RequestBuilder) NewGetRequest ¶
func (b *RequestBuilder) NewGetRequest(key []byte) *internal_request.InternalRequest
func (*RequestBuilder) NewPutRequest ¶
func (b *RequestBuilder) NewPutRequest(key []byte, value []byte) *internal_request.InternalRequest
type RequestIdGenerator ¶
type RequestIdGenerator interface {
NextId() uint64
}
func NewRequestIdGenerator ¶
func NewRequestIdGenerator(initial uint64) RequestIdGenerator
type StoppableListener ¶
type StoppableListener struct { *net.TCPListener // contains filtered or unexported fields }
func NewStoppableListener ¶
func NewStoppableListener(l net.Listener) (*StoppableListener, error)
func (*StoppableListener) Stop ¶
func (l *StoppableListener) Stop()
Click to show internal directories.
Click to hide internal directories.