func GetCachedMachineNumber() int64
GetCachedMachineNumber returns the number of machines of the last call to machine list
func GetCachedMachinesIpsList() ([]string, error)
func GetMachineIpAtIndex(i int64, cached bool) (string, error)
GetMachineIpAtIndex returns the machine ip at index i
func GetMachinesIpsList() ([]string, error)
GetMachinesIpsList get the list of known server by asking the backend stack-service that is running in the same machine of this service
func GetNRandomMachines(n uint, cached bool) ([]string, error)
GetNRandomMachines returns N different random servers (ip addresses) from the list
func GetPeerDescriptor(timings *types.Timings) types.PeersListMember
GetPeerDescriptor Generates the PeerListMember for the current node
func Start()
type ErrorCannotGetServerList struct {
// contains filtered or unexported fields
}
func (e ErrorCannotGetServerList) Error() string
type Machine struct {
ID int64 `json:"_id" bson:"_id"`
IP string `json:"ip" bson:"ip"`
Name string `json:"name" bson:"name"`
GroupName string `json:"group_name" bson:"group_name"`
// Ping tells the ping, in seconds, of the last poll
Ping float64 `json:"ping" bson:"ping"` // ms
// LastUpdate tells the time of the last update
LastUpdate int64 `json:"last_update" bson:"last_update"`
// Alive tells if the machine can currently be returned in the list of machine that we known. This parameter is set
// to false is the machine has been just added or it timed out
Alive bool `json:"alive" bson:"alive"` // set to not alive when the machine has to be polled
// DeadPolls tells the number of consecutive times the machine timed out. This is set to 0 when the machine replies
// correctly
DeadPolls uint `json:"dead_polls" bson:"dead_polls"`
}
type ServiceConfiguration struct {
MachineIp string `json:"machine_ip" bson:"machine_ip"`
MachineId string `json:"machine_id" bson:"machine_id"`
MachineFogNetId string `json:"machine_fog_net_id" bson:"machine_fog_net_id"`
InitServers []string `json:"init_servers" bson:"init_servers"`
}
var Configuration *ServiceConfiguration
func GetConfiguration() (*ServiceConfiguration, error)