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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#![feature(min_specialization)]
use serde::{Deserialize, Serialize};
use tea_actor_txns::{pre_args::ArgSlots, tsid::Tsid, txn::FullTxn};
use tea_codec::pricing::Priced;
use tea_codec::serde::TypeId;
use tea_tapp_common::{Hash, ReplicaId};
pub mod error;
extern crate tea_codec as tea_sdk;
#[derive(Debug, Clone, Serialize, Deserialize, TypeId)]
pub struct TxnItem {
pub txn: FullTxn,
pub tsid: Tsid,
}
#[derive(Debug, Clone, Serialize, Deserialize, TypeId)]
pub struct HistoryItem {
pub txn_item: TxnItem,
pub err_msg: Option<String>,
}
pub const NAME: &[u8] = b"tea:replica";
#[derive(Debug, Clone, Serialize, Deserialize, TypeId, Priced)]
#[price(10000)]
pub struct GenerateSyncMessageRequest(pub Vec<u8>);
#[derive(Debug, Clone, Serialize, Deserialize, TypeId)]
pub struct GenerateSyncMessageResponse(pub Vec<u8>);
#[derive(Debug, Clone, Serialize, Deserialize, TypeId, Priced)]
#[price(10000)]
#[response(())]
pub struct ReceiveSyncMessageRequest(pub Vec<u8>);
#[derive(Debug, Clone, Serialize, Deserialize, TypeId, Priced)]
#[price(10000)]
#[response(())]
pub struct CleanUpSyncReplicaRequest;
#[derive(Debug, Clone, Serialize, Deserialize, TypeId, Priced)]
#[price(10000)]
pub struct GetReplicaCountRequest;
#[derive(Debug, Clone, Serialize, Deserialize, TypeId)]
pub struct GetReplicaCountResponse {
pub count: u32,
}
#[derive(Debug, Clone, Serialize, Deserialize, TypeId, Priced)]
#[price(10000)]
pub struct ReceiveFollowupRequest(pub Vec<u8>);
#[derive(Debug, Clone, Serialize, Deserialize, TypeId)]
pub struct ReceiveFollowupResponse(pub Option<Tsid>);
#[derive(Debug, Clone, Serialize, Deserialize, TypeId, Priced)]
#[price(10000)]
pub struct ReceiveTxnRequest(pub Vec<u8>);
#[derive(Debug, Clone, Serialize, Deserialize, TypeId)]
pub struct ReceiveTxnResponse(pub Option<Tsid>);
#[derive(Debug, Clone, Serialize, Deserialize, TypeId, Priced)]
#[price(10000)]
pub struct FetchHistoryRequest {
pub end_tsid: Vec<u8>,
}
#[derive(Debug, Clone, Serialize, Deserialize, TypeId)]
pub struct FetchHistoryResponse {
pub history_items: Vec<TxnItem>,
}
#[derive(Debug, Clone, Serialize, Deserialize, TypeId, Priced)]
#[price(10000)]
#[response(())]
pub struct RecoverHistoryRequest(pub Vec<u8>);
#[derive(Debug, Clone, Serialize, Deserialize, TypeId, Priced)]
#[price(10000)]
pub struct GetHistorySinceRequest(pub Vec<u8>);
#[derive(Debug, Clone, Serialize, Deserialize, TypeId)]
pub struct GetHistorySinceResponse(pub Vec<u8>);
#[derive(Debug, Clone, Serialize, Deserialize, TypeId, Priced)]
#[price(10000)]
#[response(())]
pub struct ResetReplicasCountRequest(pub Vec<u8>);
#[derive(Debug, Clone, Serialize, Deserialize, TypeId, Priced)]
#[price(10000)]
pub struct FindExecutedTxnRequest(pub Vec<u8>);
#[derive(Debug, Clone, Serialize, Deserialize, TypeId)]
pub struct FindExecutedTxnResponse(pub Vec<u8>);
#[derive(Debug, Clone, Serialize, Deserialize, TypeId, Priced)]
#[price(10000)]
pub struct GetConsensusReplicasRequest;
#[derive(Debug, Clone, Serialize, Deserialize, TypeId)]
pub struct GetConsensusReplicasResponse(pub Vec<u8>);
#[derive(Debug, Clone, Serialize, Deserialize, TypeId, Priced)]
#[price(0)]
#[response(())]
pub struct SetSingleModeRequest {
pub single_mode: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize, TypeId, Priced)]
#[price(10000)]
pub struct GetSingleModeRequest;
#[derive(Debug, Clone, Serialize, Deserialize, TypeId)]
pub struct GetSingleModeResponse(pub Vec<u8>);
#[derive(Debug, Clone, Serialize, Deserialize, TypeId, Priced)]
#[price(10000)]
#[response(())]
pub struct ReportTxnExecErrorRequest(pub Hash, pub String);
#[derive(Debug, Clone, Serialize, Deserialize, TypeId, Priced)]
#[price(10000)]
pub struct GetExecCursorRequest;
#[derive(Debug, Clone, Serialize, Deserialize, TypeId)]
pub struct GetExecCursorResponse(pub Option<Tsid>);
#[derive(Debug, Clone, Serialize, Deserialize, TypeId, Priced)]
#[price(10000)]
#[response(())]
pub struct ResetExecCursorRequest(pub Tsid);
#[derive(Debug, Clone, Serialize, Deserialize, TypeId, Priced)]
#[price(0)]
pub struct DumpTxnSeqRequest(pub Vec<u8>);
#[derive(Debug, Clone, Serialize, Deserialize, TypeId)]
pub struct DumpTxnSeqResponse(pub Vec<u8>);
#[derive(Debug, Clone, Serialize, Deserialize, TypeId, Priced)]
#[price(10000)]
#[response(())]
pub struct ResetMagicNumberRequest(pub u64);
#[derive(Debug, Clone, Serialize, Deserialize, TypeId, Priced)]
#[price(0)]
pub struct IdleCleanupRequest;
#[derive(Debug, Clone, Serialize, Deserialize, TypeId)]
pub struct IdleCleanupResponse(pub Vec<ReplicaId>);
#[derive(Debug, Clone, Serialize, Deserialize, TypeId, Priced)]
#[price(10000)]
pub struct TryPopupReadyTxnRequest;
#[derive(Debug, Clone, Serialize, Deserialize, TypeId)]
pub struct TryPopupReadyTxnResponse(pub Option<(Tsid, FullTxn)>);
#[derive(Debug, Clone, Serialize, Deserialize, TypeId, Priced)]
#[price(10000)]
#[response(())]
pub struct AppendToHistoryRequest(pub HistoryItem);
#[derive(Debug, Clone, Serialize, Deserialize, TypeId, Priced)]
#[price(10000)]
pub struct IsTxnAlreadyExecutedRequest(pub Tsid);
#[derive(Debug, Clone, Serialize, Deserialize, TypeId)]
pub struct IsTxnAlreadyExecutedResponse(pub bool);
#[derive(Debug, Clone, Serialize, Deserialize, TypeId, Priced)]
#[price(10)]
#[response(())]
pub struct ExecTxnCast(pub Tsid, pub Vec<u8>, pub Option<ArgSlots>);