Skip to content
Snippets Groups Projects
Commit d65d469d authored by ale's avatar ale
Browse files

Add a note on what the Node implementation does

parent 1b202d9d
No related branches found
No related tags found
1 merge request!1v2.0
...@@ -48,6 +48,26 @@ type Node struct { ...@@ -48,6 +48,26 @@ type Node struct {
// New returns a new Node with a controlling Context, scoped to an etcd // New returns a new Node with a controlling Context, scoped to an etcd
// Session. // Session.
func New(parentCtx context.Context, session *concurrency.Session, ice Icecast, nodeID string, publicAddrs []net.IP, peerAddr net.IP, gossipPort int, lbSpec string, maxBandwidth, maxListeners int) (*Node, error) { func New(parentCtx context.Context, session *concurrency.Session, ice Icecast, nodeID string, publicAddrs []net.IP, peerAddr net.IP, gossipPort int, lbSpec string, maxBandwidth, maxListeners int) (*Node, error) {
// Creating a Node starts a number of background goroutines and etcd
// watchers. Here's how those parts interact:
//
// The main task of the Node is to manage the Icecast daemon by
// ensuring its configuration is in sync with the contents of our
// configuration (in etcd). The Node controls Icecast by generating
// its configuration and sending it a SIGHUP to reload it.
//
// Changes in the Icecast configuration originate from two sources:
// changes in the mount configuration, or state transitions of the
// Icecast leader. So we listen on both the configuration and the
// election notification channels, and use a third channel to send the
// new configuration to Icecast: in both cases, the other half of the
// configuration is cached and looked up asynchronously.
//
// The second part of the Node functionality has to do with
// maintaining a view of the state of all nodes so that we can use it
// for load balancing decisions. This is delegated to the loadBalancer
// type.
// Create a sub-Context that can be canceled when Stop is called. This // Create a sub-Context that can be canceled when Stop is called. This
// Context controls the lifetime of the Node itself, and all the // Context controls the lifetime of the Node itself, and all the
// associated background goroutines: canceling it immediately // associated background goroutines: canceling it immediately
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment