Documentation ¶
Index ¶
- func CreateClusterClient(address string) (clusterPb.ClusterMetaServiceClient, error)
- func RemovePeer(i *RpcInterface, peerId string) error
- func ReplicatePeer(i *RpcInterface, update raft.PeerObservation) error
- type ClusterDelegate
- func (c ClusterDelegate) GetBroadcasts(overhead, limit int) [][]byte
- func (c ClusterDelegate) LocalState(join bool) []byte
- func (c ClusterDelegate) Logger() *zerolog.Logger
- func (c ClusterDelegate) MergeRemoteState(buf []byte, join bool)
- func (c ClusterDelegate) NodeMeta(limit int) []byte
- func (c ClusterDelegate) NotifyMsg(bytes []byte)
- type ClusterListener
- type ClusterState
- type MemberInfo
- type RpcInterface
- type ShardInfo
- type ShardState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateClusterClient ¶
func CreateClusterClient(address string) (clusterPb.ClusterMetaServiceClient, error)
func RemovePeer ¶
func RemovePeer(i *RpcInterface, peerId string) error
func ReplicatePeer ¶
func ReplicatePeer(i *RpcInterface, update raft.PeerObservation) error
Types ¶
type ClusterDelegate ¶
type ClusterDelegate struct {
ClusterState *ClusterState
}
func (ClusterDelegate) GetBroadcasts ¶
func (c ClusterDelegate) GetBroadcasts(overhead, limit int) [][]byte
func (ClusterDelegate) LocalState ¶
func (c ClusterDelegate) LocalState(join bool) []byte
func (ClusterDelegate) Logger ¶
func (c ClusterDelegate) Logger() *zerolog.Logger
func (ClusterDelegate) MergeRemoteState ¶
func (c ClusterDelegate) MergeRemoteState(buf []byte, join bool)
func (ClusterDelegate) NodeMeta ¶
func (c ClusterDelegate) NodeMeta(limit int) []byte
func (ClusterDelegate) NotifyMsg ¶
func (c ClusterDelegate) NotifyMsg(bytes []byte)
type ClusterListener ¶
type ClusterListener struct {
// contains filtered or unexported fields
}
func InitClusterListener ¶
func InitClusterListener(clusterState *ClusterState) *ClusterListener
func (ClusterListener) Find ¶
func (c ClusterListener) Find(node *memberlist.Node)
func (ClusterListener) Logger ¶
func (c ClusterListener) Logger() *zerolog.Logger
func (ClusterListener) NotifyJoin ¶
func (c ClusterListener) NotifyJoin(node *memberlist.Node)
func (ClusterListener) NotifyLeave ¶
func (c ClusterListener) NotifyLeave(node *memberlist.Node)
func (ClusterListener) NotifyUpdate ¶
func (c ClusterListener) NotifyUpdate(node *memberlist.Node)
type ClusterState ¶
type ClusterState struct { ShardId string CurShardState *ShardState ClusterInfo *util.Map[string, *ShardInfo] Logger *zerolog.Logger }
func InitClusterState ¶
func InitClusterState(i *RpcInterface, nodeName string, address string, shardId string, logger *zerolog.Logger, raftPtr *raft.Raft) *ClusterState
func (ClusterState) GetShardInfo ¶
func (c ClusterState) GetShardInfo() *ShardInfo
type MemberInfo ¶
type RpcInterface ¶
type RpcInterface struct { Raft *raft.Raft ClusterState *ClusterState Logger *zerolog.Logger MemberList *memberlist.Memberlist pb.UnimplementedClusterMetaServiceServer }
func (RpcInterface) GetClusterInfo ¶
func (r RpcInterface) GetClusterInfo(context.Context, *pb.GetClusterInfoRequest) (*pb.GetClusterInfoResponse, error)
func (RpcInterface) GetShardInfo ¶
func (r RpcInterface) GetShardInfo(_ context.Context, req *pb.GetShardInfoRequest) (*pb.GetShardInfoResponse, error)
type ShardInfo ¶
type ShardInfo struct { Leader string MemberMap *util.Map[string, *MemberInfo] // contains filtered or unexported fields }
type ShardState ¶
type ShardState struct { ShardInfo *ShardInfo MemberInfo *MemberInfo RaftChan chan raft.Observation Raft *raft.Raft }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.