github.com/insolar/vanilla@v0.0.0-20201023172447-248fdf805322/watchdog/heartbeat.go (about) 1 // Copyright 2020 Insolar Network Ltd. 2 // All rights reserved. 3 // This material is licensed under the Insolar License version 1.0, 4 // available at https://github.com/insolar/assured-ledger/blob/master/LICENSE.md. 5 6 package watchdog 7 8 import "math" 9 10 const DisabledHeartbeat = math.MinInt64 11 12 type HeartbeatID uint32 13 14 type Heartbeat struct { 15 From HeartbeatID 16 PreviousUnixTime int64 17 UpdateUnixTime int64 18 } 19 20 func (h Heartbeat) IsCancelled() bool { 21 return h.UpdateUnixTime == DisabledHeartbeat 22 } 23 24 func (h Heartbeat) IsFirst() bool { 25 return h.PreviousUnixTime == 0 26 }