coordinator node type
This commit is contained in:
parent
aa5566c010
commit
d6737cc547
@ -6,6 +6,8 @@ const (
|
||||
NodeTypeTree NodeType = "tree"
|
||||
NodeTypeConsensus NodeType = "consensus"
|
||||
NodeTypeFile NodeType = "file"
|
||||
|
||||
NodeTypeCoordinator NodeType = "coordinator"
|
||||
)
|
||||
|
||||
type configGetter interface {
|
||||
|
||||
@ -17,6 +17,8 @@ type Configuration interface {
|
||||
FilePeers() []string
|
||||
// ConsensusPeers returns list of consensusnodes
|
||||
ConsensusPeers() []string
|
||||
// CoordinatorPeers returns list of coordinator nodes
|
||||
CoordinatorPeers() []string
|
||||
// Addresses returns map[peerId][]addr with connection addresses for all known nodes
|
||||
Addresses() map[string][]string
|
||||
// CHash returns nodes consistent table
|
||||
@ -28,12 +30,13 @@ type Configuration interface {
|
||||
}
|
||||
|
||||
type configuration struct {
|
||||
id string
|
||||
accountId string
|
||||
filePeers []string
|
||||
consensusPeers []string
|
||||
chash chash.CHash
|
||||
allMembers []NodeConfig
|
||||
id string
|
||||
accountId string
|
||||
filePeers []string
|
||||
consensusPeers []string
|
||||
coordinatorPeers []string
|
||||
chash chash.CHash
|
||||
allMembers []NodeConfig
|
||||
}
|
||||
|
||||
func (c *configuration) Id() string {
|
||||
@ -68,6 +71,10 @@ func (c *configuration) ConsensusPeers() []string {
|
||||
return c.consensusPeers
|
||||
}
|
||||
|
||||
func (c *configuration) CoordinatorPeers() []string {
|
||||
return c.coordinatorPeers
|
||||
}
|
||||
|
||||
func (c *configuration) Addresses() map[string][]string {
|
||||
res := make(map[string][]string)
|
||||
for _, m := range c.allMembers {
|
||||
|
||||
@ -80,6 +80,9 @@ func (s *service) Init(a *app.App) (err error) {
|
||||
if n.HasType(NodeTypeFile) {
|
||||
fileConfig.filePeers = append(fileConfig.filePeers, n.PeerId)
|
||||
}
|
||||
if n.HasType(NodeTypeCoordinator) {
|
||||
fileConfig.coordinatorPeers = append(fileConfig.coordinatorPeers, n.PeerId)
|
||||
}
|
||||
fileConfig.allMembers = append(fileConfig.allMembers, n)
|
||||
}
|
||||
if err = fileConfig.chash.AddMembers(members...); err != nil {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user