diff --git a/types/swarm/swarm.go b/types/swarm/swarm.go index e120140..23b2e6a 100644 --- a/types/swarm/swarm.go +++ b/types/swarm/swarm.go @@ -54,13 +54,27 @@ type RaftConfig struct { SnapshotInterval uint64 `json:",omitempty"` KeepOldSnapshots uint64 `json:",omitempty"` LogEntriesForSlowFollowers uint64 `json:",omitempty"` - HeartbeatTick uint32 `json:",omitempty"` - ElectionTick uint32 `json:",omitempty"` + + // ElectionTick is the number of ticks that a follower will wait for a message + // from the leader before becoming a candidate and starting an election. + // ElectionTick must be greater than HeartbeatTick. + // + // A tick currently defaults to one second, so these translate directly to + // seconds currently, but this is NOT guaranteed. + ElectionTick int + + // HeartbeatTick is the number of ticks between heartbeats. Every + // HeartbeatTick ticks, the leader will send a heartbeat to the + // followers. + // + // A tick currently defaults to one second, so these translate directly to + // seconds currently, but this is NOT guaranteed. + HeartbeatTick int } // DispatcherConfig represents dispatcher configuration. type DispatcherConfig struct { - HeartbeatPeriod uint64 `json:",omitempty"` + HeartbeatPeriod time.Duration `json:",omitempty"` } // CAConfig represents CA configuration.