Implementation of Nodes method. First take on full handler

This commit is contained in:
Milos Gajdos
2019-09-02 17:06:21 +01:00
parent 4f5a849211
commit 86665454e7
5 changed files with 146 additions and 107 deletions

View File

@@ -19,6 +19,18 @@ var (
AnnounceTime = 30 * time.Second
)
// Node is network node
type Node interface {
// Id is node id
Id() string
// Address is node bind address
Address() string
// Neighbourhood is node neighbourhood
Neighbourhood() []Node
// Network is the network node is in
Network() Network
}
// Network is micro network
type Network interface {
// Node is network node
@@ -39,16 +51,6 @@ type Network interface {
Server() server.Server
}
// Node is network node
type Node interface {
// Id is node id
Id() string
// Address is node bind address
Address() string
// Network is the network node is in
Network() Network
}
// NewNetwork returns a new network interface
func NewNetwork(opts ...Option) Network {
return newNetwork(opts...)