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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
//! ABCI requests and request data.
//!

// IMPORTANT NOTE ON DOCUMENTATION:
//
// The documentation for each request type is adapted from the ABCI Methods and
// Types spec document. However, the same logical request may appear three
// times, as a struct with the request data, as a Request variant, and as a
// CategoryRequest variant.
//
// To avoid duplication, this documentation is stored in the doc/ folder in
// individual .md files, which are pasted onto the relevant items using #[doc =
// include_str!(...)].
//
// This is also why certain submodules have #[allow(unused)] imports to bring
// items into scope for doc links, rather than changing the doc links -- it
// allows the doc comments to be copied without editing.

// bring into scope for doc links
#[allow(unused)]
use super::types::Snapshot;

pub(super) mod apply_snapshot_chunk;
pub(super) mod begin_block;
pub(super) mod check_tx;
pub(super) mod deliver_tx;
pub(super) mod echo;
pub(super) mod end_block;
pub(super) mod info;
pub(super) mod init_chain;
pub(super) mod load_snapshot_chunk;
pub(super) mod offer_snapshot;
pub(super) mod prepare_proposal;
pub(super) mod process_proposal;
pub(super) mod query;
pub(super) mod set_option;

pub use apply_snapshot_chunk::ApplySnapshotChunk;
pub use begin_block::BeginBlock;
pub use check_tx::{CheckTx, CheckTxKind};
pub use deliver_tx::DeliverTx;
pub use echo::Echo;
pub use end_block::EndBlock;
pub use info::Info;
pub use init_chain::InitChain;
pub use load_snapshot_chunk::LoadSnapshotChunk;
pub use offer_snapshot::OfferSnapshot;
pub use prepare_proposal::PrepareProposal;
pub use process_proposal::ProcessProposal;
pub use query::Query;
pub use set_option::SetOption;

/// The consensus category of ABCI requests.
#[allow(clippy::large_enum_variant)]
#[derive(Clone, PartialEq, Eq, Debug)]
pub enum ConsensusRequest {
    #[doc = include_str!("doc/request-initchain.md")]
    InitChain(InitChain),
    #[doc = include_str!("doc/request-prepareproposal.md")]
    PrepareProposal(PrepareProposal),
    #[doc = include_str!("doc/request-processproposal.md")]
    ProcessProposal(ProcessProposal),
    #[doc = include_str!("doc/request-beginblock.md")]
    BeginBlock(BeginBlock),
    #[doc = include_str!("doc/request-delivertx.md")]
    DeliverTx(DeliverTx),
    #[doc = include_str!("doc/request-endblock.md")]
    EndBlock(EndBlock),
    #[doc = include_str!("doc/request-commit.md")]
    Commit,
}

/// The mempool category of ABCI requests.
#[derive(Clone, PartialEq, Eq, Debug)]
pub enum MempoolRequest {
    #[doc = include_str!("doc/request-checktx.md")]
    CheckTx(CheckTx),
}

/// The info category of ABCI requests.
#[derive(Clone, PartialEq, Eq, Debug)]
pub enum InfoRequest {
    #[doc = include_str!("doc/request-info.md")]
    Info(Info),
    #[doc = include_str!("doc/request-query.md")]
    Query(Query),
    #[doc = include_str!("doc/request-echo.md")]
    Echo(Echo),
    #[doc = include_str!("doc/request-setoption.md")]
    SetOption(SetOption),
}

/// The snapshot category of ABCI requests.
#[derive(Clone, PartialEq, Eq, Debug)]
pub enum SnapshotRequest {
    #[doc = include_str!("doc/request-listsnapshots.md")]
    ListSnapshots,
    #[doc = include_str!("doc/request-offersnapshot.md")]
    OfferSnapshot(OfferSnapshot),
    #[doc = include_str!("doc/request-loadsnapshotchunk.md")]
    LoadSnapshotChunk(LoadSnapshotChunk),
    #[doc = include_str!("doc/request-applysnapshotchunk.md")]
    ApplySnapshotChunk(ApplySnapshotChunk),
}