Version: v0.0.0-...-5ae6e0f Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2021 License: GPL-3.0 Imports: 9 Imported by: 0



Package discovery implements all functions that made possible the communication with the discovery service.

The package when init checks if the discovery service is available for getting its configuration, if it is not then the scheduler is not started and the check is done every 5 seconds.



This section is empty.


This section is empty.


func GetListOfMachines

func GetListOfMachines() ([]string, error)

getListOfServers get the list of known server by asking to the backend stack-service that is running in the same machine of this service

func GetNRandomMachines

func GetNRandomMachines(n uint) ([]string, error)

GetRandomServer returns a N different random servers from the list

func GetPeerDescriptor

func GetPeerDescriptor(timings *types.Timings) types.PeersListMember

GetPeerDescriptor Generates the PeerListMember for the current node

func Start

func Start()


type ErrorCannotGetServerList

type ErrorCannotGetServerList struct{}

func (ErrorCannotGetServerList) Error

type Machine

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

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

func GetConfiguration() (*ServiceConfiguration, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL