1 /* 2 * P2PFaaS - A framework for FaaS Load Balancing 3 * Copyright (c) 2019 - 2022. Gabriele Proietti Mattia <pm.gabriele@outlook.com> 4 * 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <https://www.gnu.org/licenses/>. 17 */ 18 19 package service_discovery 20 21 type ServiceConfiguration struct { 22 MachineIp string `json:"machine_ip" bson:"machine_ip"` 23 MachineId string `json:"machine_id" bson:"machine_id"` 24 MachineFogNetId string `json:"machine_fog_net_id" bson:"machine_fog_net_id"` 25 InitServers []string `json:"init_servers" bson:"init_servers"` 26 } 27 28 type Machine struct { 29 ID int64 `json:"_id" bson:"_id"` 30 IP string `json:"ip" bson:"ip"` 31 Name string `json:"name" bson:"name"` 32 GroupName string `json:"group_name" bson:"group_name"` 33 // Ping tells the ping, in seconds, of the last poll 34 Ping float64 `json:"ping" bson:"ping"` // ms 35 // LastUpdate tells the time of the last update 36 LastUpdate int64 `json:"last_update" bson:"last_update"` 37 // Alive tells if the machine can currently be returned in the list of machine that we known. This parameter is set 38 // to false is the machine has been just added or it timed out 39 Alive bool `json:"alive" bson:"alive"` // set to not alive when the machine has to be polled 40 // DeadPolls tells the number of consecutive times the machine timed out. This is set to 0 when the machine replies 41 // correctly 42 DeadPolls uint `json:"dead_polls" bson:"dead_polls"` 43 } 44