Versions in this module Expand all Collapse all v1 v1.0.4 Jun 30, 2023 Changes in this version type Master + func (m *Master) ReceiveHeartbeat(ctx context.Context, in *proto.MasterHeartbeatRequest) (*proto.MasterHeartbeatResponse, error) type Slave + WorkPool chan struct{} v1.0.3 Jun 13, 2023 Changes in this version + var DefaultOptions = config.Options + func SendMessage(addr string, msg T, msgType interface{}) (interface{}, error) + type Cluster struct + Leader string + Master []Master + Slave []Slave + func NewRaftCluster(masterList []string, slaveList []string) *Cluster + func (c *Cluster) Apply(log *raft.Log) interface{} + func (c *Cluster) Restore(snapshot io.ReadCloser) error + func (c *Cluster) Snapshot() (raft.FSMSnapshot, error) + type FSMSnapshot struct + func (F *FSMSnapshot) Persist(sink raft.SnapshotSink) error + func (F *FSMSnapshot) Release() + type Impl struct + func (i *Impl) AddServer(addr string) error + func (i *Impl) Apply(b []byte) error + func (i *Impl) Close() error + func (i *Impl) Get(key []byte) ([]byte, error) + func (i *Impl) IsCandidate() bool + func (i *Impl) IsLeader() bool + func (i *Impl) Leader() string + func (i *Impl) Peers() ([]string, error) + func (i *Impl) Put(key, value []byte) error + func (i *Impl) ShowDebugInfo(witch string) ([]byte, error) + func (i *Impl) State() raft.RaftState + func (i *Impl) UserSnapshot() error + type IndexerType = int8 + const Btree + const DefaultDbDir + type Interface interface + AddServer func(addr string) error + Apply func(b []byte) error + Close func() error + Get func(key []byte) ([]byte, error) + IsCandidate func() bool + IsLeader func() bool + Leader func() string + Peers func() ([]string, error) + Put func(key, value []byte) error + ShowDebugInfo func(witch string) ([]byte, error) + State func() raft.RaftState + UserSnapshot func() error + type Master struct + Addr string + DirTree *dirtree.DirTree + FilenameToNode map[string]string + Heartbeat map[string]string + ID string + Peers []string + Raft raft.Raft + RaftLog *boltdb.BoltStore + Slave []Slave + func (m *Master) CurrentLeader(ctx context.Context, in *proto.MasterCurrentLeaderRequest) (*proto.MasterCurrentLeaderResponse, error) + func (m *Master) Del(ctx context.Context, in *proto.MasterDelRequest) (*proto.MasterDelResponse, error) + func (m *Master) Expire(ctx context.Context, in *proto.MasterExpireRequest) (*proto.MasterExpireResponse, error) + func (m *Master) Get(ctx context.Context, in *proto.MasterGetRequest) (*proto.MasterGetResponse, error) + func (m *Master) Keys(ctx context.Context, in *proto.MasterKeysRequest) (*proto.MasterKeysResponse, error) + func (m *Master) ListenRequest() + func (m *Master) ListenSlave(slaves []Slave) + func (m *Master) NewRaft() + func (m *Master) Ping(ctx context.Context, in *proto.MasterPingRequest) (*proto.MasterPingResponse, error) + func (m *Master) RegisterSlave(ctx context.Context, in *proto.MasterRegisterSlaveRequest) (*proto.MasterRegisterSlaveResponse, error) + func (m *Master) Scan(ctx context.Context, in *proto.MasterScanRequest) (*proto.MasterScanResponse, error) + func (m *Master) Set(ctx context.Context, in *proto.MasterSetRequest) (*proto.MasterSetResponse, error) + func (m *Master) Shutdown(ctx context.Context, in *proto.MasterShutdownRequest) (*proto.MasterShutdownResponse, error) + func (m *Master) StartGrpcServer() + func (m *Master) TTL(ctx context.Context, in *proto.MasterTTLRequest) (*proto.MasterTTLResponse, error) + func (m *Master) WaitForLeader() + type Slave struct + Addr string + DB *engine.DB + ID string + Leader string + Peers []string + SlaveMessage SlaveMessage + func (s *Slave) Del(ctx context.Context, in *proto.SlaveDelRequest) (*proto.SlaveDelResponse, error) + func (s *Slave) Exists(ctx context.Context, in *proto.SlaveExistsRequest) (*proto.SlaveExistsResponse, error) + func (s *Slave) Expire(ctx context.Context, in *proto.SlaveExpireRequest) (*proto.SlaveExpireResponse, error) + func (s *Slave) Get(ctx context.Context, in *proto.SlaveGetRequest) (*proto.SlaveGetResponse, error) + func (s *Slave) Heartbeat(ctx context.Context, in *proto.SlaveHeartbeatRequest) (*proto.SlaveHeartbeatResponse, error) + func (s *Slave) Keys(ctx context.Context, in *proto.SlaveKeysRequest) (*proto.SlaveKeysResponse, error) + func (s *Slave) ListenLeader() + func (s *Slave) RegisterToMaster() + func (s *Slave) SendHeartbeat() + func (s *Slave) Set(ctx context.Context, in *proto.SlaveSetRequest) (*proto.SlaveSetResponse, error) + func (s *Slave) StartGrpcServer() + func (s *Slave) TTL(ctx context.Context, in *proto.SlaveTTLRequest) (*proto.SlaveTTLResponse, error) + func (s *Slave) UpdateSlaveMessage() + type SlaveMessage struct + CpuPercent float32 + TotalDisk uint64 + TotalMem uint64 + UsedDisk uint64 + UsedMem uint64