Documentation ¶
Index ¶
- Variables
- type GossipRegistry
- func (n *GossipRegistry) Add(shardID uint64, replicaID uint64, target string)
- func (n *GossipRegistry) AdvertiseAddress() string
- func (n *GossipRegistry) Close() error
- func (n *GossipRegistry) GetNodeHostRegistry() *NodeHostRegistry
- func (n *GossipRegistry) NumMembers() int
- func (n *GossipRegistry) Remove(shardID uint64, replicaID uint64)
- func (n *GossipRegistry) RemoveShard(shardID uint64)
- func (n *GossipRegistry) Resolve(shardID uint64, replicaID uint64) (string, string, error)
- type IResolver
- type NodeHostRegistry
- type Registry
- type ShardInfo
- type ShardView
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnknownTarget is the error returned when the target address of the node // is unknown. ErrUnknownTarget = errors.New("target address unknown") )
Functions ¶
This section is empty.
Types ¶
type GossipRegistry ¶
type GossipRegistry struct {
// contains filtered or unexported fields
}
GossipRegistry is a node registry backed by gossip. It is capable of supporting NodeHosts with dynamic RaftAddress values.
func NewGossipRegistry ¶
func NewGossipRegistry(nhid string, f getShardInfo, nhConfig config.NodeHostConfig, streamConnections uint64, v config.TargetValidator) (*GossipRegistry, error)
NewGossipRegistry creates a new GossipRegistry instance.
func (*GossipRegistry) Add ¶
func (n *GossipRegistry) Add(shardID uint64, replicaID uint64, target string)
Add adds a new node with its known NodeHostID to the registry.
func (*GossipRegistry) AdvertiseAddress ¶
func (n *GossipRegistry) AdvertiseAddress() string
AdvertiseAddress returns the advertise address of the gossip service.
func (*GossipRegistry) Close ¶
func (n *GossipRegistry) Close() error
Close closes the GossipRegistry instance.
func (*GossipRegistry) GetNodeHostRegistry ¶
func (n *GossipRegistry) GetNodeHostRegistry() *NodeHostRegistry
GetNodeHostRegistry returns the NodeHostRegistry backed by gossip.
func (*GossipRegistry) NumMembers ¶
func (n *GossipRegistry) NumMembers() int
NumMembers returns the number of live nodes known by the gossip service.
func (*GossipRegistry) Remove ¶
func (n *GossipRegistry) Remove(shardID uint64, replicaID uint64)
Remove removes the specified node from the registry.
func (*GossipRegistry) RemoveShard ¶
func (n *GossipRegistry) RemoveShard(shardID uint64)
RemoveShard removes the specified shard from the registry.
type IResolver ¶
type IResolver interface { Resolve(uint64, uint64) (string, string, error) Add(uint64, uint64, string) }
IResolver converts the (shard id, replica id) tuple to network address.
type NodeHostRegistry ¶
type NodeHostRegistry struct {
// contains filtered or unexported fields
}
NodeHostRegistry is a NodeHost info registry backed by gossip.
func (*NodeHostRegistry) GetMeta ¶
func (r *NodeHostRegistry) GetMeta(nhID string) ([]byte, bool)
GetMeta returns gossip metadata associated with the specified NodeHost instance.
func (*NodeHostRegistry) GetShardInfo ¶
func (r *NodeHostRegistry) GetShardInfo(shardID uint64) (ShardView, bool)
GetShardInfo returns the shard info for the specified shard if it is available in the gossip view.
func (*NodeHostRegistry) NumOfShards ¶
func (r *NodeHostRegistry) NumOfShards() int
NumOfShards returns the number of shards known to the current NodeHost instance.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is used to manage all known node addresses in the multi raft system. The transport layer uses this address registry to locate nodes.
func NewNodeRegistry ¶
func NewNodeRegistry(streamConnections uint64, v config.TargetValidator) *Registry
NewNodeRegistry returns a new Registry object.
func (*Registry) RemoveShard ¶
RemoveShard removes info associated with the specified shard.
type ShardInfo ¶
type ShardInfo struct { // Replicas is a map of member replica IDs to their Raft addresses. Replicas map[uint64]string // ShardID is the shard ID of the Raft shard. ShardID uint64 // ReplicaID is the replica ID of the Raft replica. ReplicaID uint64 // ConfigChangeIndex is the current config change index of the Raft node. // ConfigChangeIndex is Raft Log index of the last applied membership // change entry. ConfigChangeIndex uint64 // StateMachineType is the type of the state machine. StateMachineType sm.Type // IsLeader indicates whether this is a leader node. // Deprecated: Use LeaderID and Term instead. IsLeader bool // LeaderID is the replica ID of the current leader LeaderID uint64 // Term is the term of the current leader Term uint64 // IsNonVoting indicates whether this is a non-voting nonVoting node. IsNonVoting bool // IsWitness indicates whether this is a witness node without actual log. IsWitness bool // Pending is a boolean flag indicating whether details of the shard node // is not available. The Pending flag is set to true usually because the node // has not had anything applied yet. Pending bool }
ShardInfo is a record for representing the state of a Raft shard based on the knowledge of the local NodeHost instance.