1 /* 2 * P2PFaaS - A framework for FaaS Load Balancing 3 * Copyright (c) 2019. 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 types implements object models 20 package types 21 22 const MachinesCollectionName = "machines" 23 24 type Machine struct { 25 ID int64 `json:"_id" bson:"_id"` 26 IP string `json:"ip" bson:"ip"` 27 Name string `json:"name" bson:"name"` 28 GroupName string `json:"group_name" bson:"group_name"` 29 // Ping tells the ping, in seconds, of the last poll 30 Ping float64 `json:"ping" bson:"ping"` // ms 31 // LastUpdate tells the time of the last update 32 LastUpdate int64 `json:"last_update" bson:"last_update"` 33 // Alive tells if the machine can currently be returned in the list of machine that we known. This parameter is set 34 // to false is the machine has been just added or it timed out 35 Alive bool `json:"alive" bson:"alive"` // set to not alive when the machine has to be polled 36 // DeadPolls tells the number of consecutive times the machine timed out. This is set to 0 when the machine replies 37 // correctly 38 DeadPolls uint `json:"dead_polls" bson:"dead_polls"` 39 } 40