diff options
Diffstat (limited to 'server/peer.go')
-rw-r--r-- | server/peer.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/server/peer.go b/server/peer.go index 6ead5fbe..a629a16d 100644 --- a/server/peer.go +++ b/server/peer.go @@ -31,6 +31,26 @@ const ( MIN_CONNECT_RETRY = 10 ) +type PeerGroup struct { + Conf *config.PeerGroup + members map[string]config.Neighbor +} + +func NewPeerGroup(c *config.PeerGroup) *PeerGroup { + return &PeerGroup{ + Conf: c, + members: make(map[string]config.Neighbor, 0), + } +} + +func (pg *PeerGroup) AddMember(c config.Neighbor) { + pg.members[c.Config.NeighborAddress] = c +} + +func (pg *PeerGroup) DeleteMember(c config.Neighbor) { + delete(pg.members, c.Config.NeighborAddress) +} + type Peer struct { tableId string fsm *FSM |