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
20#ifndef RIPPLE_TEST_CSF_EVENTS_H_INCLUDED
21#define RIPPLE_TEST_CSF_EVENTS_H_INCLUDED
22
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#include <chrono>
29
30namespace ripple {
31namespace test {
32namespace csf {
33
34// Events are emitted by peers at a variety of points during the simulation.
35// Each event is emitted by a particlar peer at a particular time. Collectors
36// process these events, perhaps calculating statistics or storing events to
37// a log for post-processing.
38//
39// The Event types can be arbitrary, but should be copyable and lightweight.
40//
41// Example collectors can be found in collectors.h, but have the general
42// interface:
43//
44// @code
45// template <class T>
46// struct Collector
47// {
48// template <class Event>
49// void
50// on(peerID who, SimTime when, Event e);
51// };
52// @endcode
53//
54// CollectorRef.f defines a type-erased holder for arbitrary Collectors. If
55// any new events are added, the interface there needs to be updated.
56
59template <class V>
60struct Share
61{
63 V val;
64};
65
68template <class V>
69struct Relay
70{
73
75 V val;
76};
77
80template <class V>
81struct Receive
82{
85
87 V val;
88};
89
92{
95};
96
100{
103
106};
107
111{
112 // The ledger closed on
114
115 // Initial txs for including in ledger
117};
118
121{
122 // The newly created ledger
124
125 // The prior ledger (this is a jump if prior.id() != ledger.parentID())
127};
128
131{
132 // ID of wrong ledger we had
134 // ID of what we think is the correct ledger
136};
137
140{
143
147};
148
149} // namespace csf
150} // namespace test
151} // namespace ripple
152
153#endif
A ledger is a set of observed transactions and a sequence number identifying the ledger.
Definition: ledgers.h:64
A single transaction.
Definition: Tx.h:42
boost::container::flat_set< Tx > TxSetType
Definition: Tx.h:79
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:121
Peer closed the open ledger.
Definition: events.h:111
Peer fully validated a new ledger.
Definition: events.h:140
Ledger prior
The prior fully validated ledger This is a jump if prior.id() != ledger.parentID()
Definition: events.h:146
Ledger ledger
The new fully validated ledger.
Definition: events.h:142
A value received from another peer as part of flooding.
Definition: events.h:82
PeerID from
Peer that sent the value.
Definition: events.h:84
V val
The received value.
Definition: events.h:87
A value relayed to another peer as part of flooding.
Definition: events.h:70
PeerID to
Peer relaying to.
Definition: events.h:72
V val
The value to relay.
Definition: events.h:75
A value to be flooded to all other peers starting from this peer.
Definition: events.h:61
V val
Event that is shared.
Definition: events.h:63
Peer starts a new consensus round.
Definition: events.h:100
Ledger prevLedger
The prior ledger on hand.
Definition: events.h:105
Ledger::ID bestLedger
The preferred ledger for the start of consensus.
Definition: events.h:102
A transaction submitted to a peer.
Definition: events.h:92
Tx tx
The submitted transaction.
Definition: events.h:94
Peer detected a wrong prior ledger during consensus.
Definition: events.h:131