rippled
events.h
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2012-2017 Ripple Labs Inc
5 
6  Permission to use, copy, modify, and/or distribute this software for any
7  purpose with or without fee is hereby granted, provided that the above
8  copyright notice and this permission notice appear in all copies.
9 
10  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18 //==============================================================================
19 #ifndef RIPPLE_TEST_CSF_EVENTS_H_INCLUDED
20 #define RIPPLE_TEST_CSF_EVENTS_H_INCLUDED
21 
22 #include <chrono>
23 #include <test/csf/Proposal.h>
24 #include <test/csf/Tx.h>
25 #include <test/csf/Validation.h>
26 #include <test/csf/ledgers.h>
27 
28 namespace ripple {
29 namespace test {
30 namespace csf {
31 
32 // Events are emitted by peers at a variety of points during the simulation.
33 // Each event is emitted by a particlar peer at a particular time. Collectors
34 // process these events, perhaps calculating statistics or storing events to
35 // a log for post-processing.
36 //
37 // The Event types can be arbitrary, but should be copyable and lightweight.
38 //
39 // Example collectors can be found in collectors.h, but have the general
40 // interface:
41 //
42 // @code
43 // template <class T>
44 // struct Collector
45 // {
46 // template <class Event>
47 // void
48 // on(peerID who, SimTime when, Event e);
49 // };
50 // @endcode
51 //
52 // CollectorRef.f defines a type-erased holder for arbitrary Collectors. If
53 // any new events are added, the interface there needs to be updated.
54 
57 template <class V>
58 struct Share
59 {
61  V val;
62 };
63 
66 template <class V>
67 struct Relay
68 {
71 
73  V val;
74 };
75 
78 template <class V>
79 struct Receive
80 {
83 
85  V val;
86 };
87 
89 struct SubmitTx
90 {
92  Tx tx;
93 };
94 
97 struct StartRound
98 {
101 
104 };
105 
109 {
110  // The ledger closed on
112 
113  // Initial txs for including in ledger
115 };
116 
119 {
120  // The newly created ledger
122 
123  // The prior ledger (this is a jump if prior.id() != ledger.parentID())
125 };
126 
129 {
130  // ID of wrong ledger we had
132  // ID of what we think is the correct ledger
134 };
135 
138 {
141 
145 };
146 
147 } // namespace csf
148 } // namespace test
149 } // namespace ripple
150 
151 #endif
ripple::test::csf::CloseLedger::txs
TxSetType txs
Definition: events.h:114
ripple::test::csf::WrongPrevLedger::right
Ledger::ID right
Definition: events.h:133
ripple::test::csf::TxSetType
boost::container::flat_set< Tx > TxSetType
Definition: Tx.h:73
ripple::test::csf::FullyValidateLedger
Peer fully validated a new ledger.
Definition: events.h:137
ripple::test::csf::FullyValidateLedger::prior
Ledger prior
The prior fully validated ledger This is a jump if prior.id() != ledger.parentID()
Definition: events.h:144
ripple::test::csf::Receive::from
PeerID from
Peer that sent the value.
Definition: events.h:82
ripple::test::csf::Ledger
A ledger is a set of observed transactions and a sequence number identifying the ledger.
Definition: ledgers.h:58
ripple::test::csf::FullyValidateLedger::ledger
Ledger ledger
The new fully validated ledger.
Definition: events.h:140
ripple::test::csf::AcceptLedger
Peer accepted consensus results.
Definition: events.h:118
ripple::test::csf::WrongPrevLedger::wrong
Ledger::ID wrong
Definition: events.h:131
chrono
ripple::test::csf::AcceptLedger::ledger
Ledger ledger
Definition: events.h:121
ripple::test::csf::CloseLedger
Peer closed the open ledger.
Definition: events.h:108
ripple::test::csf::Tx
A single transaction.
Definition: Tx.h:35
ripple::test::csf::SubmitTx::tx
Tx tx
The submitted transaction.
Definition: events.h:92
ripple::test::csf::Relay
A value relayed to another peer as part of flooding.
Definition: events.h:67
ripple::test::csf::Relay::to
PeerID to
Peer relaying to.
Definition: events.h:70
ripple::test::csf::Receive
A value received from another peer as part of flooding.
Definition: events.h:79
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::test::csf::StartRound::bestLedger
Ledger::ID bestLedger
The preferred ledger for the start of consensus.
Definition: events.h:100
ripple::test::csf::Relay::val
V val
The value to relay.
Definition: events.h:73
ripple::test::csf::WrongPrevLedger
Peer detected a wrong prior ledger during consensus.
Definition: events.h:128
ripple::test::csf::StartRound::prevLedger
Ledger prevLedger
The prior ledger on hand.
Definition: events.h:103
ripple::test::csf::Share
A value to be flooded to all other peers starting from this peer.
Definition: events.h:58
ripple::test::csf::StartRound
Peer starts a new consensus round.
Definition: events.h:97
ripple::tagged_integer< std::uint32_t, PeerIDTag >
ripple::test::csf::Share::val
V val
Event that is shared.
Definition: events.h:61
ripple::test::csf::Receive::val
V val
The received value.
Definition: events.h:85
ripple::test::csf::CloseLedger::prevLedger
Ledger prevLedger
Definition: events.h:111
ripple::test::csf::SubmitTx
A transaction submitted to a peer.
Definition: events.h:89
ripple::test::csf::AcceptLedger::prior
Ledger prior
Definition: events.h:124