Documentation
¶
Index ¶
- Constants
- type GossipConfig
- type GossipManager
- func (g *GossipManager) Close() error
- func (g *GossipManager) GetAliveInstances() map[string]bool
- func (g *GossipManager) GetCachedCoordinate(name string) (coord *coordinate.Coordinate, ok bool)
- func (g *GossipManager) GetCoordinate() (*coordinate.Coordinate, error)
- func (g *GossipManager) GetMembershipMessage(shardId uint64) *MemberInfo
- func (g *GossipManager) GetMembershipMessages() map[uint64]*MemberInfo
- func (g *GossipManager) GetShardMessage() *RaftShardMessage
- func (g *GossipManager) GetserverInstances() map[string]bool
- func (g *GossipManager) SetNodeMeta(meta Meta) error
- func (g *GossipManager) UpdateMembershipMessage(membership *RaftMembershipMessage)
- func (g *GossipManager) UpdateShardMessage(shard *RaftShardMessage)
- type GossipOptions
- type MemberInfo
- type Meta
- type PushPullMessage
- type RaftMembershipMessage
- type RaftShardMessage
- type ShardCallback
- type TargetShardId
Constants ¶
View Source
const ( // PingVersion is an internal version for the ping message, above the normal // versioning we get from the protocol version. This enables small updates // to the ping message without a full protocol bump. PingVersion = 1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GossipConfig ¶
type GossipConfig struct { // GossipProbeInterval define the probe interval used by the gossip // service in tests. // GossipProbeInterval time.Duration `json:"gossipProbeInterval"` // BindAddress is the address for the gossip service to bind to and listen on. // Both UDP and TCP ports are used by the gossip service. The local gossip // service should be able to receive gossip service related messages by // binding to and listening on this address. BindAddress is usually in the // format of IP:Port, Hostname:Port or DNS Name:Port. BindAddress string `json:"-"` BindPort uint16 `json:"bindPort"` // AdvertiseAddress is the address to advertise to other NodeHost instances // used for NAT traversal. Gossip services running on remote NodeHost // instances will use AdvertiseAddress to exchange gossip service related // messages. AdvertiseAddress is in the format of IP:Port. // AdvertiseAddress string // Seed is a list of AdvertiseAddress of remote NodeHost instances. Local // NodeHost instance will try to contact all of them to bootstrap the gossip // service. At least one reachable NodeHost instance is required to // successfully bootstrap the gossip service. Each seed address is in the // format of IP:Port, Hostname:Port or DNS Name:Port. // // It is ok to include seed addresses that are temporarily unreachable, e.g. // when launching the first NodeHost instance in your deployment, you can // include AdvertiseAddresses from other NodeHost instances that you plan to // launch shortly afterwards. Seeds []string `json:"seeds"` // contains filtered or unexported fields }
func (*GossipConfig) IsEmpty ¶
func (g *GossipConfig) IsEmpty() bool
IsEmpty returns a boolean flag indicating whether the GossipConfig instance is empty.
func (*GossipConfig) SetShardCallback ¶
func (g *GossipConfig) SetShardCallback(fn ShardCallback)
func (*GossipConfig) Validate ¶
func (g *GossipConfig) Validate() error
Validate validates the GossipConfig instance.
type GossipManager ¶
type GossipManager struct {
// contains filtered or unexported fields
}
func NewGossipManager ¶
func NewGossipManager(config GossipConfig, opts GossipOptions) (*GossipManager, error)
func (*GossipManager) Close ¶
func (g *GossipManager) Close() error
func (*GossipManager) GetAliveInstances ¶
func (g *GossipManager) GetAliveInstances() map[string]bool
func (*GossipManager) GetCachedCoordinate ¶
func (g *GossipManager) GetCachedCoordinate(name string) (coord *coordinate.Coordinate, ok bool)
func (*GossipManager) GetCoordinate ¶
func (g *GossipManager) GetCoordinate() (*coordinate.Coordinate, error)
GetCoordinate returns the network coordinate of the local node.
func (*GossipManager) GetMembershipMessage ¶
func (g *GossipManager) GetMembershipMessage(shardId uint64) *MemberInfo
func (*GossipManager) GetMembershipMessages ¶
func (g *GossipManager) GetMembershipMessages() map[uint64]*MemberInfo
func (*GossipManager) GetShardMessage ¶
func (g *GossipManager) GetShardMessage() *RaftShardMessage
func (*GossipManager) GetserverInstances ¶
func (g *GossipManager) GetserverInstances() map[string]bool
func (*GossipManager) SetNodeMeta ¶
func (g *GossipManager) SetNodeMeta(meta Meta) error
func (*GossipManager) UpdateMembershipMessage ¶
func (g *GossipManager) UpdateMembershipMessage(membership *RaftMembershipMessage)
func (*GossipManager) UpdateShardMessage ¶
func (g *GossipManager) UpdateShardMessage(shard *RaftShardMessage)
type GossipOptions ¶
type MemberInfo ¶
type MemberInfo struct { ShardId uint64 ConfigChangeId uint64 Replicas map[uint64]string Observers map[uint64]string LeaderId uint64 LeaderValid bool }
func (*MemberInfo) String ¶
func (mi *MemberInfo) String() string
type PushPullMessage ¶
type PushPullMessage struct { Shard *RaftShardMessage Membership *RaftMembershipMessage }
func (*PushPullMessage) String ¶
func (pp *PushPullMessage) String() string
type RaftMembershipMessage ¶
type RaftMembershipMessage struct { // key: shardId MemberInfos map[uint64]*MemberInfo }
func (*RaftMembershipMessage) String ¶
func (rm *RaftMembershipMessage) String() string
type RaftShardMessage ¶
type RaftShardMessage struct { Revision int64 `json:"revision"` // 机器ID对应的MoveTo的GRPC地址 // key: 当raft以nodehostid=true的方式起的时候是机器ID,以固定地址方式起是raftAddr Targets map[string]TargetShardId `json:"targets"` // 每个raft shard对应的机器ID|raftAddr Shards map[uint64][]string `json:"shards"` // 每个raft shard的initial members // key: shardId, key: replicaId, val: raftAddr或nodeHostID InitialMembers map[uint64]map[uint64]string `json:"initial_members"` Join map[uint64]map[uint64]bool `json:"join"` }
func (*RaftShardMessage) String ¶
func (rm *RaftShardMessage) String() string
type ShardCallback ¶
type ShardCallback func(shard *RaftShardMessage) error
type TargetShardId ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.