mirror of
https://github.com/anyproto/any-sync.git
synced 2025-06-09 09:35:03 +09:00
coord nodeconf source, nodeconf service updates
This commit is contained in:
parent
18db36a70a
commit
93cd6897d3
7 changed files with 414 additions and 85 deletions
|
@ -21,8 +21,8 @@ type NodeConf interface {
|
|||
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
|
||||
// PeerAddresses returns peer addresses by peer id
|
||||
PeerAddresses(peerId string) (addrs []string, ok bool)
|
||||
// CHash returns nodes consistent table
|
||||
CHash() chash.CHash
|
||||
// Partition returns partition number by spaceId
|
||||
|
@ -40,6 +40,7 @@ type nodeConf struct {
|
|||
chash chash.CHash
|
||||
allMembers []Node
|
||||
c Configuration
|
||||
addrs map[string][]string
|
||||
}
|
||||
|
||||
func (c *nodeConf) Id() string {
|
||||
|
@ -82,12 +83,9 @@ func (c *nodeConf) CoordinatorPeers() []string {
|
|||
return c.coordinatorPeers
|
||||
}
|
||||
|
||||
func (c *nodeConf) Addresses() map[string][]string {
|
||||
res := make(map[string][]string)
|
||||
for _, m := range c.allMembers {
|
||||
res[m.PeerId] = m.Addresses
|
||||
}
|
||||
return res
|
||||
func (c *nodeConf) PeerAddresses(peerId string) (addrs []string, ok bool) {
|
||||
addrs, ok = c.addrs[peerId]
|
||||
return
|
||||
}
|
||||
|
||||
func (c *nodeConf) CHash() chash.CHash {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue