Skip to main content

thruput_node_rpc/
db_sched.rs

1// -*-Rust-*-
2// Generated Code: DO NOT CHECK IN
3
4// Generated from xdrc commit: cb9cab8a8d69ace37c18d49b505f1e93ec802af8
5
6#![allow(non_camel_case_types)]
7#![allow(non_snake_case)]
8#![allow(non_upper_case_globals)]
9#![allow(unused_imports)]
10#![allow(dead_code)]
11#![allow(unused_variables)]
12#![allow(clippy::unnecessary_cast)]
13
14use crate::*;
15use core::option::Option;
16use core::ops::{Deref, DerefMut};
17
18#[cfg(feature = "std")]
19use std::io::{Read, Write};
20use xdrs::*;
21
22
23#[cfg(feature = "serde")]
24use ::serde::{{Serialize, Deserialize}};
25
26
27
28#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
29#[cfg_attr(feature = "serde", serde(transparent))]
30#[derive(ReadXDR, WriteXDR, ConstXDRSize)]
31#[derive(schemars::JsonSchema)]
32#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
33#[derive(Copy)]
34#[repr(transparent)]
35pub struct DbSchedResult(pub i32);
36
37impl DbSchedResult {
38    pub const DbSchedResultOK: Self = Self(0);
39    pub const DbSchedResultError: Self = Self(1);
40    pub const DbSchedResultInvalidParentId: Self = Self(2);
41}
42impl From<i32> for DbSchedResult {
43    fn from(v: i32) -> Self {
44        Self(v)
45    }
46}
47#[cfg(feature = "std")]
48impl core::fmt::Display for DbSchedResult {
49    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
50        match self.0 {
51            x if x == Self::DbSchedResultOK.0 => {
52                write!(f, "DbSchedResult::DbSchedResultOK")
53            },
54            x if x == Self::DbSchedResultError.0 => {
55                write!(f, "DbSchedResult::DbSchedResultError")
56            },
57            x if x == Self::DbSchedResultInvalidParentId.0 => {
58                write!(f, "DbSchedResult::DbSchedResultInvalidParentId")
59            },
60            _ => {
61                write!(f, "DbSchedResult({})", self.0)
62            }
63        }
64    }
65}
66
67
68pub const kNativeTokenAgeGroupToSchedule : u32 = 0;
69
70pub const kNativeTokenAgeGroupAlreadyScheduled : u32 = 1;
71
72pub const kNativeTokenAgeGroupReceived : u32 = 2;
73
74pub const kNativeTokenAgeNumGroups : u32 = 3;
75
76#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
77#[derive(ReadXDR, WriteXDR, ConstXDRSize)]
78#[derive(schemars::JsonSchema)]
79#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
80#[repr(C)]
81pub struct NativeTokenAge {
82    pub address: ContractAddress,
83    pub num_native_tokens: [uint128_xdr; kNativeTokenAgeNumGroups as usize],
84    pub average_ages: [BlockHeight; kNativeTokenAgeNumGroups as usize],
85}
86
87pub type NativeTokenAgeBatch = VecM::<NativeTokenAge>;
88
89#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
90#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
91#[derive(ReadXDR, WriteXDR, ConstXDRSize)]
92#[derive(schemars::JsonSchema)]
93#[repr(i32)]
94#[non_exhaustive]
95pub enum NativeTokenAgeResult {
96    // case DbSchedResultOK:
97    //   NativeTokenAge native_token_age;
98    DbSchedResultOK { native_token_age: NativeTokenAge } = DbSchedResult::DbSchedResultOK.0 as i32,
99    // default:
100    //   void;
101    #[xdr(default_variant)] Default { result: i32 },
102}
103
104pub type NativeTokenAgeResults = VecM::<NativeTokenAgeResult>;
105
106#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
107#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
108#[derive(ReadXDR, WriteXDR, ConstXDRSize)]
109#[derive(schemars::JsonSchema)]
110#[repr(i32)]
111#[non_exhaustive]
112pub enum DbAddressAuthDataBatchResult {
113    // case DbSchedResultOK:
114    //   VecM<AddressAuthData> address_auth_data_batch;
115    DbSchedResultOK { address_auth_data_batch: VecM<AddressAuthData> } = DbSchedResult::DbSchedResultOK.0 as i32,
116    // default:
117    //   void;
118    #[xdr(default_variant)] Default { result: i32 },
119}
120
121#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
122#[derive(ReadXDR, WriteXDR, ConstXDRSize)]
123#[derive(schemars::JsonSchema)]
124#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
125#[repr(C)]
126pub struct DbBlockOk {
127    pub storage_hash: StorageShortHash,
128    pub storage_long_hash: StorageLongHash,
129    pub config_hash_preimage: ConfigHashPreimage,
130}
131
132#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
133#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
134#[derive(ReadXDR, WriteXDR, ConstXDRSize)]
135#[derive(schemars::JsonSchema)]
136#[repr(i32)]
137#[non_exhaustive]
138pub enum DbBlockResult {
139    // case DbSchedResultOK:
140    //   DbBlockOk block;
141    DbSchedResultOK { block: DbBlockOk } = DbSchedResult::DbSchedResultOK.0 as i32,
142    // default:
143    //   void;
144    #[xdr(default_variant)] Default { result: i32 },
145}
146
147#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
148#[cfg_attr(feature = "serde", serde(transparent))]
149#[derive(ReadXDR, WriteXDR, ConstXDRSize)]
150#[derive(schemars::JsonSchema)]
151#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
152#[derive(Copy)]
153#[repr(transparent)]
154pub struct DbShardResult(pub i32);
155
156impl DbShardResult {
157    pub const ShardOK: Self = Self(0);
158}
159impl From<i32> for DbShardResult {
160    fn from(v: i32) -> Self {
161        Self(v)
162    }
163}
164#[cfg(feature = "std")]
165impl core::fmt::Display for DbShardResult {
166    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
167        match self.0 {
168            x if x == Self::ShardOK.0 => {
169                write!(f, "DbShardResult::ShardOK")
170            },
171            _ => {
172                write!(f, "DbShardResult({})", self.0)
173            }
174        }
175    }
176}
177
178
179#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
180#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
181#[derive(ReadXDR, WriteXDR, ConstXDRSize)]
182#[derive(schemars::JsonSchema)]
183#[repr(i32)]
184#[non_exhaustive]
185pub enum DbTipResult {
186    // case DbSchedResultOK:
187    //   DbTip db_tip;
188    DbSchedResultOK { db_tip: DbTip } = DbSchedResult::DbSchedResultOK.0 as i32,
189    // default:
190    //   void;
191    #[xdr(default_variant)] Default { result: i32 },
192}
193
194
195/// Each handler replies with anything that encodes like the reply type.
196/// Implementations can be plain `async fn`s returning a concrete reply type
197/// under `#[allow(refining_impl_trait)]`.
198#[allow(non_camel_case_types)]
199pub trait DbSched_DbSched1: Send + Sync {    
200    fn dbsched_null(&self) -> impl ::core::future::Future<Output = Result<impl xdrs::EncodesAs<()>, ::thruput_rpc_api::ProgramError>> + Send;
201    
202    fn dbsched_get_address_auth_data(&self, arg0 : BlockID, arg1 : ContractAddressBatch) -> impl ::core::future::Future<Output = Result<impl xdrs::EncodesAs<DbAddressAuthDataBatchResult>, ::thruput_rpc_api::ProgramError>> + Send;
203    
204    fn dbsched_get_native_token_ages(&self, arg0 : ContractAddressBatch) -> impl ::core::future::Future<Output = Result<impl xdrs::EncodesAs<NativeTokenAgeResults>, ::thruput_rpc_api::ProgramError>> + Send;
205    
206    fn dbsched_write_native_token_ages(&self, arg0 : NativeTokenAgeBatch) -> impl ::core::future::Future<Output = Result<impl xdrs::EncodesAs<DbSchedResult>, ::thruput_rpc_api::ProgramError>> + Send;
207        // Examples of valid call sequences to the db:
208    //
209    // dbsched_create_snapshot
210    //   ... calls to executor
211    // dbsched_close_snapshot
212    // dbsched_commit_snapshot
213    //
214    // dbsched_create_snapshot
215    //   ... calls to executor
216    // dbsched_abandon_snapshot
217
218    // Called when creating a new block.
219    // The first argument is the ID of the parent block.
220    // The database will surface requests from the snapshot
221    // that would be created if the parent block commits.
222    // Parent block must be closed.
223
224    fn dbsched_create_snapshot(&self, arg0 : BlockID, arg1 : BlockID, arg2 : BlockExecutionMode) -> impl ::core::future::Future<Output = Result<impl xdrs::EncodesAs<DbSchedResult>, ::thruput_rpc_api::ProgramError>> + Send;
225        // Commits the block with the specified block ID to disk. Should only be
226    // called for e.g. finalized blocks. At a minimum, the block must be closed
227    // before being committed. Any BlockID that is not a descendant of this
228    // block will return an error if accessed. This BlockID must be the
229    // immediate descendant of the most recently committed block.
230
231    fn dbsched_commit_snapshot(&self, arg0 : BlockID, arg1 : ConsensusValue) -> impl ::core::future::Future<Output = Result<impl xdrs::EncodesAs<DbBlockResult>, ::thruput_rpc_api::ProgramError>> + Send;
232        // Call to close a block. This indicates that no more transactions
233    // will be added to this block. The block must have been previously opened
234    // with dbsched_create_snapshot().
235    // A block cannot have a child opened before it is closed.
236    // Error if the block has been pruned or contains an item in an invalid
237    // state (due to e.g. a block validation failure).
238
239    fn dbsched_close_snapshot(&self, arg0 : BlockID) -> impl ::core::future::Future<Output = Result<impl xdrs::EncodesAs<DbBlockResult>, ::thruput_rpc_api::ProgramError>> + Send;
240        // Call to abandon a block.
241
242    fn dbsched_abandon_snapshot(&self, arg0 : BlockID) -> impl ::core::future::Future<Output = Result<impl xdrs::EncodesAs<DbSchedResult>, ::thruput_rpc_api::ProgramError>> + Send;
243    
244    fn dbsched_load_genesis_configuration(&self, arg0 : GenesisConfiguration, arg1 : ConsensusValue) -> impl ::core::future::Future<Output = Result<impl xdrs::EncodesAs<DbSchedResult>, ::thruput_rpc_api::ProgramError>> + Send;
245    
246    fn dbsched_get_tip(&self) -> impl ::core::future::Future<Output = Result<impl xdrs::EncodesAs<DbTipResult>, ::thruput_rpc_api::ProgramError>> + Send;
247}
248
249
250#[allow(non_camel_case_types)]
251pub struct DbSched_DbSched1_Dispatcher<__Handler> {
252  inner: Box<__Handler>,
253}
254
255impl<__Handler: DbSched_DbSched1> DbSched_DbSched1_Dispatcher<__Handler> {
256  pub fn new(inner: Box<__Handler>) -> Self {
257    Self { inner }
258  }
259}
260
261#[async_trait::async_trait]
262impl<__Handler: DbSched_DbSched1> ::thruput_rpc_api::RpcHandler for DbSched_DbSched1_Dispatcher<__Handler> {
263    fn prog_vers(&self) -> ::thruput_rpc_api::ProgVers {
264        ::thruput_rpc_api::ProgVers::new(0x88887ee7, 1)
265    }
266    async fn dispatch(&self, proc: u32, data: &[u8]) -> Result<Vec<u8>, ::thruput_rpc_api::RpcError> {
267        match proc {
268            // dbsched_null
269            0 => {
270                let args: () =
271                    xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
272                let res = self.inner.dbsched_null().await.map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?;
273                xdrs::txs::encode(&res).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)
274            }
275            // dbsched_get_address_auth_data
276            1 => {
277                let args: (BlockID, ContractAddressBatch, ) =
278                    xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
279                let res = self.inner.dbsched_get_address_auth_data(args.0, args.1).await.map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?;
280                xdrs::txs::encode(&res).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)
281            }
282            // dbsched_get_native_token_ages
283            2 => {
284                let args: (ContractAddressBatch, ) =
285                    xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
286                let res = self.inner.dbsched_get_native_token_ages(args.0).await.map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?;
287                xdrs::txs::encode(&res).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)
288            }
289            // dbsched_write_native_token_ages
290            3 => {
291                let args: (NativeTokenAgeBatch, ) =
292                    xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
293                let res = self.inner.dbsched_write_native_token_ages(args.0).await.map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?;
294                xdrs::txs::encode(&res).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)
295            }
296            // dbsched_create_snapshot
297            5 => {
298                let args: (BlockID, BlockID, BlockExecutionMode, ) =
299                    xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
300                let res = self.inner.dbsched_create_snapshot(args.0, args.1, args.2).await.map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?;
301                xdrs::txs::encode(&res).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)
302            }
303            // dbsched_commit_snapshot
304            6 => {
305                let args: (BlockID, ConsensusValue, ) =
306                    xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
307                let res = self.inner.dbsched_commit_snapshot(args.0, args.1).await.map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?;
308                xdrs::txs::encode(&res).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)
309            }
310            // dbsched_close_snapshot
311            7 => {
312                let args: (BlockID, ) =
313                    xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
314                let res = self.inner.dbsched_close_snapshot(args.0).await.map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?;
315                xdrs::txs::encode(&res).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)
316            }
317            // dbsched_abandon_snapshot
318            8 => {
319                let args: (BlockID, ) =
320                    xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
321                let res = self.inner.dbsched_abandon_snapshot(args.0).await.map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?;
322                xdrs::txs::encode(&res).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)
323            }
324            // dbsched_load_genesis_configuration
325            9 => {
326                let args: (GenesisConfiguration, ConsensusValue, ) =
327                    xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
328                let res = self.inner.dbsched_load_genesis_configuration(args.0, args.1).await.map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?;
329                xdrs::txs::encode(&res).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)
330            }
331            // dbsched_get_tip
332            10 => {
333                let args: () =
334                    xdrs::txs::decode(data).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
335                let res = self.inner.dbsched_get_tip().await.map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?;
336                xdrs::txs::encode(&res).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)
337            }
338            _ => Err(::thruput_rpc_api::RpcError::InvalidProcedure),
339        }
340    }
341}
342
343#[derive(Clone)]
344pub struct DbSched_DbSched1_Client {
345    handle: ::std::sync::Arc<dyn ::thruput_rpc_api::RpcSender>,
346}
347
348impl DbSched_DbSched1_Client {
349    pub fn new(handle: ::std::sync::Arc<dyn ::thruput_rpc_api::RpcSender>) -> Self {
350        Self { handle }
351    }
352
353    fn prog_vers() -> ::thruput_rpc_api::ProgVers {
354        ::thruput_rpc_api::ProgVers::new(0x88887ee7, 1)
355    }
356    pub async fn dbsched_null(&self) -> Result<(), ::thruput_rpc_api::RpcError> {
357         let mut call = self.handle.call_buf();
358         call.append_with(|buf| {
359             let mut w = xdrs::txs::buf_writer::BufWriter::from(::core::mem::take(buf));
360             let r = xdrs::write_xdr(&(), &mut w);
361             *buf = w.into();
362             r
363         }).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
364         let mut out = ::core::option::Option::None;
365         let mut decode = |reply: &[u8]| -> ::core::result::Result<(), ::thruput_rpc_api::RpcError> {
366             out = ::core::option::Option::Some(xdrs::txs::decode(reply).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?);
367             Ok(())
368         };
369         // SAFETY: the call future is awaited right here, so it lives in
370         // this method's future along with `out` and `decode`. Once that
371         // is polled it is pinned, so neither can be freed without the
372         // call future being dropped first. Decoding never blocks.
373         unsafe { self.handle.send_call_decoded(Self::prog_vers(), 0, call, &mut decode) }.await?;
374         out.ok_or(::thruput_rpc_api::RpcError::SystemError)
375    }
376    pub async fn dbsched_get_address_auth_data(&self, arg0 : &(impl xdrs::EncodesAs<BlockID> + ?Sized), arg1 : &(impl xdrs::EncodesAs<ContractAddressBatch> + ?Sized)) -> Result<DbAddressAuthDataBatchResult, ::thruput_rpc_api::RpcError> {
377         let mut call = self.handle.call_buf();
378         call.append_with(|buf| {
379             let mut w = xdrs::txs::buf_writer::BufWriter::from(::core::mem::take(buf));
380             let r = xdrs::write_xdr(&(arg0, arg1), &mut w);
381             *buf = w.into();
382             r
383         }).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
384         let mut out = ::core::option::Option::None;
385         let mut decode = |reply: &[u8]| -> ::core::result::Result<(), ::thruput_rpc_api::RpcError> {
386             out = ::core::option::Option::Some(xdrs::txs::decode(reply).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?);
387             Ok(())
388         };
389         // SAFETY: the call future is awaited right here, so it lives in
390         // this method's future along with `out` and `decode`. Once that
391         // is polled it is pinned, so neither can be freed without the
392         // call future being dropped first. Decoding never blocks.
393         unsafe { self.handle.send_call_decoded(Self::prog_vers(), 1, call, &mut decode) }.await?;
394         out.ok_or(::thruput_rpc_api::RpcError::SystemError)
395    }
396    pub async fn dbsched_get_native_token_ages(&self, arg0 : &(impl xdrs::EncodesAs<ContractAddressBatch> + ?Sized)) -> Result<NativeTokenAgeResults, ::thruput_rpc_api::RpcError> {
397         let mut call = self.handle.call_buf();
398         call.append_with(|buf| {
399             let mut w = xdrs::txs::buf_writer::BufWriter::from(::core::mem::take(buf));
400             let r = xdrs::write_xdr(&(arg0), &mut w);
401             *buf = w.into();
402             r
403         }).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
404         let mut out = ::core::option::Option::None;
405         let mut decode = |reply: &[u8]| -> ::core::result::Result<(), ::thruput_rpc_api::RpcError> {
406             out = ::core::option::Option::Some(xdrs::txs::decode(reply).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?);
407             Ok(())
408         };
409         // SAFETY: the call future is awaited right here, so it lives in
410         // this method's future along with `out` and `decode`. Once that
411         // is polled it is pinned, so neither can be freed without the
412         // call future being dropped first. Decoding never blocks.
413         unsafe { self.handle.send_call_decoded(Self::prog_vers(), 2, call, &mut decode) }.await?;
414         out.ok_or(::thruput_rpc_api::RpcError::SystemError)
415    }
416    pub async fn dbsched_write_native_token_ages(&self, arg0 : &(impl xdrs::EncodesAs<NativeTokenAgeBatch> + ?Sized)) -> Result<DbSchedResult, ::thruput_rpc_api::RpcError> {
417         let mut call = self.handle.call_buf();
418         call.append_with(|buf| {
419             let mut w = xdrs::txs::buf_writer::BufWriter::from(::core::mem::take(buf));
420             let r = xdrs::write_xdr(&(arg0), &mut w);
421             *buf = w.into();
422             r
423         }).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
424         let mut out = ::core::option::Option::None;
425         let mut decode = |reply: &[u8]| -> ::core::result::Result<(), ::thruput_rpc_api::RpcError> {
426             out = ::core::option::Option::Some(xdrs::txs::decode(reply).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?);
427             Ok(())
428         };
429         // SAFETY: the call future is awaited right here, so it lives in
430         // this method's future along with `out` and `decode`. Once that
431         // is polled it is pinned, so neither can be freed without the
432         // call future being dropped first. Decoding never blocks.
433         unsafe { self.handle.send_call_decoded(Self::prog_vers(), 3, call, &mut decode) }.await?;
434         out.ok_or(::thruput_rpc_api::RpcError::SystemError)
435    }
436    pub async fn dbsched_create_snapshot(&self, arg0 : &(impl xdrs::EncodesAs<BlockID> + ?Sized), arg1 : &(impl xdrs::EncodesAs<BlockID> + ?Sized), arg2 : &(impl xdrs::EncodesAs<BlockExecutionMode> + ?Sized)) -> Result<DbSchedResult, ::thruput_rpc_api::RpcError> {
437         let mut call = self.handle.call_buf();
438         call.append_with(|buf| {
439             let mut w = xdrs::txs::buf_writer::BufWriter::from(::core::mem::take(buf));
440             let r = xdrs::write_xdr(&(arg0, arg1, arg2), &mut w);
441             *buf = w.into();
442             r
443         }).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
444         let mut out = ::core::option::Option::None;
445         let mut decode = |reply: &[u8]| -> ::core::result::Result<(), ::thruput_rpc_api::RpcError> {
446             out = ::core::option::Option::Some(xdrs::txs::decode(reply).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?);
447             Ok(())
448         };
449         // SAFETY: the call future is awaited right here, so it lives in
450         // this method's future along with `out` and `decode`. Once that
451         // is polled it is pinned, so neither can be freed without the
452         // call future being dropped first. Decoding never blocks.
453         unsafe { self.handle.send_call_decoded(Self::prog_vers(), 5, call, &mut decode) }.await?;
454         out.ok_or(::thruput_rpc_api::RpcError::SystemError)
455    }
456    pub async fn dbsched_commit_snapshot(&self, arg0 : &(impl xdrs::EncodesAs<BlockID> + ?Sized), arg1 : &(impl xdrs::EncodesAs<ConsensusValue> + ?Sized)) -> Result<DbBlockResult, ::thruput_rpc_api::RpcError> {
457         let mut call = self.handle.call_buf();
458         call.append_with(|buf| {
459             let mut w = xdrs::txs::buf_writer::BufWriter::from(::core::mem::take(buf));
460             let r = xdrs::write_xdr(&(arg0, arg1), &mut w);
461             *buf = w.into();
462             r
463         }).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
464         let mut out = ::core::option::Option::None;
465         let mut decode = |reply: &[u8]| -> ::core::result::Result<(), ::thruput_rpc_api::RpcError> {
466             out = ::core::option::Option::Some(xdrs::txs::decode(reply).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?);
467             Ok(())
468         };
469         // SAFETY: the call future is awaited right here, so it lives in
470         // this method's future along with `out` and `decode`. Once that
471         // is polled it is pinned, so neither can be freed without the
472         // call future being dropped first. Decoding never blocks.
473         unsafe { self.handle.send_call_decoded(Self::prog_vers(), 6, call, &mut decode) }.await?;
474         out.ok_or(::thruput_rpc_api::RpcError::SystemError)
475    }
476    pub async fn dbsched_close_snapshot(&self, arg0 : &(impl xdrs::EncodesAs<BlockID> + ?Sized)) -> Result<DbBlockResult, ::thruput_rpc_api::RpcError> {
477         let mut call = self.handle.call_buf();
478         call.append_with(|buf| {
479             let mut w = xdrs::txs::buf_writer::BufWriter::from(::core::mem::take(buf));
480             let r = xdrs::write_xdr(&(arg0), &mut w);
481             *buf = w.into();
482             r
483         }).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
484         let mut out = ::core::option::Option::None;
485         let mut decode = |reply: &[u8]| -> ::core::result::Result<(), ::thruput_rpc_api::RpcError> {
486             out = ::core::option::Option::Some(xdrs::txs::decode(reply).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?);
487             Ok(())
488         };
489         // SAFETY: the call future is awaited right here, so it lives in
490         // this method's future along with `out` and `decode`. Once that
491         // is polled it is pinned, so neither can be freed without the
492         // call future being dropped first. Decoding never blocks.
493         unsafe { self.handle.send_call_decoded(Self::prog_vers(), 7, call, &mut decode) }.await?;
494         out.ok_or(::thruput_rpc_api::RpcError::SystemError)
495    }
496    pub async fn dbsched_abandon_snapshot(&self, arg0 : &(impl xdrs::EncodesAs<BlockID> + ?Sized)) -> Result<DbSchedResult, ::thruput_rpc_api::RpcError> {
497         let mut call = self.handle.call_buf();
498         call.append_with(|buf| {
499             let mut w = xdrs::txs::buf_writer::BufWriter::from(::core::mem::take(buf));
500             let r = xdrs::write_xdr(&(arg0), &mut w);
501             *buf = w.into();
502             r
503         }).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
504         let mut out = ::core::option::Option::None;
505         let mut decode = |reply: &[u8]| -> ::core::result::Result<(), ::thruput_rpc_api::RpcError> {
506             out = ::core::option::Option::Some(xdrs::txs::decode(reply).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?);
507             Ok(())
508         };
509         // SAFETY: the call future is awaited right here, so it lives in
510         // this method's future along with `out` and `decode`. Once that
511         // is polled it is pinned, so neither can be freed without the
512         // call future being dropped first. Decoding never blocks.
513         unsafe { self.handle.send_call_decoded(Self::prog_vers(), 8, call, &mut decode) }.await?;
514         out.ok_or(::thruput_rpc_api::RpcError::SystemError)
515    }
516    pub async fn dbsched_load_genesis_configuration(&self, arg0 : &(impl xdrs::EncodesAs<GenesisConfiguration> + ?Sized), arg1 : &(impl xdrs::EncodesAs<ConsensusValue> + ?Sized)) -> Result<DbSchedResult, ::thruput_rpc_api::RpcError> {
517         let mut call = self.handle.call_buf();
518         call.append_with(|buf| {
519             let mut w = xdrs::txs::buf_writer::BufWriter::from(::core::mem::take(buf));
520             let r = xdrs::write_xdr(&(arg0, arg1), &mut w);
521             *buf = w.into();
522             r
523         }).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
524         let mut out = ::core::option::Option::None;
525         let mut decode = |reply: &[u8]| -> ::core::result::Result<(), ::thruput_rpc_api::RpcError> {
526             out = ::core::option::Option::Some(xdrs::txs::decode(reply).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?);
527             Ok(())
528         };
529         // SAFETY: the call future is awaited right here, so it lives in
530         // this method's future along with `out` and `decode`. Once that
531         // is polled it is pinned, so neither can be freed without the
532         // call future being dropped first. Decoding never blocks.
533         unsafe { self.handle.send_call_decoded(Self::prog_vers(), 9, call, &mut decode) }.await?;
534         out.ok_or(::thruput_rpc_api::RpcError::SystemError)
535    }
536    pub async fn dbsched_get_tip(&self) -> Result<DbTipResult, ::thruput_rpc_api::RpcError> {
537         let mut call = self.handle.call_buf();
538         call.append_with(|buf| {
539             let mut w = xdrs::txs::buf_writer::BufWriter::from(::core::mem::take(buf));
540             let r = xdrs::write_xdr(&(), &mut w);
541             *buf = w.into();
542             r
543         }).map_err(|_| ::thruput_rpc_api::RpcError::GarbageArguments)?;
544         let mut out = ::core::option::Option::None;
545         let mut decode = |reply: &[u8]| -> ::core::result::Result<(), ::thruput_rpc_api::RpcError> {
546             out = ::core::option::Option::Some(xdrs::txs::decode(reply).map_err(|_| ::thruput_rpc_api::RpcError::SystemError)?);
547             Ok(())
548         };
549         // SAFETY: the call future is awaited right here, so it lives in
550         // this method's future along with `out` and `decode`. Once that
551         // is polled it is pinned, so neither can be freed without the
552         // call future being dropped first. Decoding never blocks.
553         unsafe { self.handle.send_call_decoded(Self::prog_vers(), 10, call, &mut decode) }.await?;
554         out.ok_or(::thruput_rpc_api::RpcError::SystemError)
555    }
556}
557
558impl From<::std::sync::Arc<dyn ::thruput_rpc_api::RpcSender>> for DbSched_DbSched1_Client {
559    fn from(handle: ::std::sync::Arc<dyn ::thruput_rpc_api::RpcSender>) -> Self {
560        Self::new(handle)
561    }
562}
563
564
565
566//
567// XDR internals below this point
568//
569
570impl NativeTokenAgeResult {
571    #[allow(clippy::match_single_binding)]
572    pub fn result(&self) -> DbSchedResult {
573        match self {
574            NativeTokenAgeResult::Default{ result } => (*result).into(),
575
576            _ => (unsafe { *(self as *const Self as *const i32) }).into(),
577        }
578    }
579}
580
581impl DbAddressAuthDataBatchResult {
582    #[allow(clippy::match_single_binding)]
583    pub fn result(&self) -> DbSchedResult {
584        match self {
585            DbAddressAuthDataBatchResult::Default{ result } => (*result).into(),
586
587            _ => (unsafe { *(self as *const Self as *const i32) }).into(),
588        }
589    }
590}
591
592impl DbBlockResult {
593    #[allow(clippy::match_single_binding)]
594    pub fn result(&self) -> DbSchedResult {
595        match self {
596            DbBlockResult::Default{ result } => (*result).into(),
597
598            _ => (unsafe { *(self as *const Self as *const i32) }).into(),
599        }
600    }
601}
602
603impl DbTipResult {
604    #[allow(clippy::match_single_binding)]
605    pub fn result(&self) -> DbSchedResult {
606        match self {
607            DbTipResult::Default{ result } => (*result).into(),
608
609            _ => (unsafe { *(self as *const Self as *const i32) }).into(),
610        }
611    }
612}
613
614