-
Notifications
You must be signed in to change notification settings - Fork 6
/
ConsensusEvent.scala
73 lines (58 loc) · 2.36 KB
/
ConsensusEvent.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package io.iohk.metronome.hotstuff.service.tracing
import io.iohk.metronome.hotstuff.consensus.ViewNumber
import io.iohk.metronome.hotstuff.consensus.basic.{
Agreement,
Event,
ProtocolError
}
import io.iohk.metronome.hotstuff.consensus.basic.QuorumCertificate
import io.iohk.metronome.hotstuff.service.ConsensusService.MessageCounter
import io.iohk.metronome.hotstuff.service.Status
sealed trait ConsensusEvent[+A <: Agreement]
object ConsensusEvent {
/** The round ended without having reached decision. */
case class Timeout(
viewNumber: ViewNumber,
messageCounter: MessageCounter
) extends ConsensusEvent[Nothing]
/** A full view synchronization was requested after timing out without any in-sync messages. */
case class ViewSync(
viewNumber: ViewNumber
) extends ConsensusEvent[Nothing]
/** Adopting the view of the federation after a sync. */
case class AdoptView[A <: Agreement](
status: Status[A]
) extends ConsensusEvent[A]
/** The state advanced to a new view. */
case class NewView(viewNumber: ViewNumber) extends ConsensusEvent[Nothing]
/** Quorum over some block. */
case class Quorum[A <: Agreement](quorumCertificate: QuorumCertificate[A])
extends ConsensusEvent[A]
/** A formally valid message was received from an earlier view number. */
case class FromPast[A <: Agreement](message: Event.MessageReceived[A])
extends ConsensusEvent[A]
/** A formally valid message was received from a future view number. */
case class FromFuture[A <: Agreement](message: Event.MessageReceived[A])
extends ConsensusEvent[A]
/** An event that arrived too early but got stashed and will be redelivered. */
case class Stashed[A <: Agreement](
error: ProtocolError.TooEarly[A]
) extends ConsensusEvent[A]
/** A rejected event. */
case class Rejected[A <: Agreement](
error: ProtocolError[A]
) extends ConsensusEvent[A]
/** A block has been removed from storage by the time it was to be executed. */
case class ExecutionSkipped[A <: Agreement](
blockHash: A#Hash
) extends ConsensusEvent[A]
/** A block has been executed. */
case class BlockExecuted[A <: Agreement](
blockHash: A#Hash
) extends ConsensusEvent[A]
/** An unexpected error in one of the background tasks. */
case class Error(
message: String,
error: Throwable
) extends ConsensusEvent[Nothing]
}