func NewServicesState() *ServicesState {
	var err error
	state := &ServicesState{
		Servers:             make(map[string]*Server, 5),
		Broadcasts:          make(chan [][]byte),
		LastChanged:         time.Unix(0, 0),
		tombstoneRetransmit: TOMBSTONE_RETRANSMIT,
		ServiceMsgs:         make(chan service.Service, 25),
		listeners:           make(map[string]Listener),
	}
	state.Hostname, err = os.Hostname()
	if err != nil {
		log.Errorf("Error getting hostname! %s", err.Error())
	}
	return state
}
Returns a pointer to a properly configured ServicesState
package catalog
import (
	"encoding/json"
	"fmt"
	"io"
	"os"
	"sort"
	"sync"
	"time"
	"github.com/NinesStack/memberlist"
	"github.com/NinesStack/sidecar/output"
	"github.com/NinesStack/sidecar/service"
	"github.com/armon/go-metrics"
	"github.com/relistan/go-director"
	log "github.com/sirupsen/logrus"
)
const (
	TOMBSTONE_LIFESPAN         = 3 * time.Hour                   
	TOMBSTONE_COUNT            = 10                              
	ALIVE_COUNT                = 5                               
	TOMBSTONE_SLEEP_INTERVAL   = 2 * time.Second                 
	TOMBSTONE_RETRANSMIT       = 1 * time.Second                 
	ALIVE_LIFESPAN             = 1*time.Minute + 20*time.Second  
	DRAINING_LIFESPAN          = 10 * time.Minute                
	ALIVE_SLEEP_INTERVAL       = 1 * time.Second                 
	ALIVE_BROADCAST_INTERVAL   = 1 * time.Minute                 
	LISTENER_EVENT_BUFFER_SIZE = 20                              
)
type ChangeEvent struct {
	Service        service.Service
	PreviousStatus int
	Time           time.Time
}
type Server struct {
	Name        string
	Services    map[string]*service.Service
	LastUpdated time.Time
	LastChanged time.Time
}
func NewServer(name string) *Server {
	server := &Server{
		Name: name,
		Services:    make(map[string]*service.Service, 5),
		LastUpdated: time.Unix(0, 0),
		LastChanged: time.Unix(0, 0),
	}
	return server
}
type ServicesState struct {
	Servers             map[string]*Server
	LastChanged         time.Time
	ClusterName         string
	Hostname            string
	Broadcasts          chan [][]byte        `json:"-"`
	ServiceMsgs         chan service.Service `json:"-"`
	listeners           map[string]Listener
	tombstoneRetransmit time.Duration
	sync.RWMutex
}
type Listener interface {
	Chan() chan ChangeEvent  
	Name() string            
	Managed() bool           
}