rippled
Loading...
Searching...
No Matches
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 <test/csf/Proposal.h>
23#include <test/csf/Tx.h>
24#include <test/csf/Validation.h>
25#include <test/csf/ledgers.h>
26#include <chrono>
27
28namespace ripple {
29namespace test {
30namespace 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
57template <class V>
58struct Share
59{
61 V val;
62};
63
66template <class V>
67struct Relay
68{
71
73 V val;
74};
75
78template <class V>
79struct Receive
80{
83
85 V val;
86};
87
90{
93};
94
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
A ledger is a set of observed transactions and a sequence number identifying the ledger.
Definition: ledgers.h:59
A single transaction.
Definition: Tx.h:38
boost::container::flat_set< Tx > TxSetType
Definition: Tx.h:75
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:26
Peer accepted consensus results.
Definition: events.h:119
Peer closed the open ledger.
Definition: events.h:109
Peer fully validated a new ledger.
Definition: events.h:138
Ledger prior
The prior fully validated ledger This is a jump if prior.id() != ledger.parentID()
Definition: events.h:144
Ledger ledger
The new fully validated ledger.
Definition: events.h:140
A value received from another peer as part of flooding.
Definition: events.h:80
PeerID from
Peer that sent the value.
Definition: events.h:82
V val
The received value.
Definition: events.h:85
A value relayed to another peer as part of flooding.
Definition: events.h:68
PeerID to
Peer relaying to.
Definition: events.h:70
V val
The value to relay.
Definition: events.h:73
A value to be flooded to all other peers starting from this peer.
Definition: events.h:59
V val
Event that is shared.
Definition: events.h:61
Peer starts a new consensus round.
Definition: events.h:98
Ledger prevLedger
The prior ledger on hand.
Definition: events.h:103
Ledger::ID bestLedger
The preferred ledger for the start of consensus.
Definition: events.h:100
A transaction submitted to a peer.
Definition: events.h:90
Tx tx
The submitted transaction.
Definition: events.h:92
Peer detected a wrong prior ledger during consensus.
Definition: events.h:129