pub struct Context { /* private fields */ }Implementations§
Source§impl Context
impl Context
pub async fn with_config_and_socket( config: Config, socket: Arc<dyn UdpSocketExt>, ) -> Result<Arc<Self>, Error>
pub fn get_prometheus_metrics(&self) -> String
pub fn get_json_health(&self) -> Value
Sourcepub async fn send_message_to(
&self,
message: &Protocol,
dst: Ipv4Addr,
) -> Result<(), Error>
pub async fn send_message_to( &self, message: &Protocol, dst: Ipv4Addr, ) -> Result<(), Error>
Convenience function to send UDP data with metrics tracking
Sourcepub async fn recv_from(&self, buf: &mut [u8]) -> Result<(usize, SocketAddr)>
pub async fn recv_from(&self, buf: &mut [u8]) -> Result<(usize, SocketAddr)>
Convenience function to receive UDP data with metrics tracking
pub async fn is_peer_handshaked(&self, ip: Ipv4Addr) -> bool
pub async fn get_peers_summary(&self) -> Result<PeersSummary, Error>
pub fn get_softfork_status(&self) -> SoftforkStatus
pub fn get_config(&self) -> &Config
pub fn get_socket(&self) -> Arc<dyn UdpSocketExt>
pub fn get_metrics(&self) -> &Metrics
pub fn get_metrics_snapshot(&self) -> MetricsSnapshot
pub fn get_system_stats(&self) -> SystemStats
pub fn get_uptime(&self) -> String
Sourcepub fn get_temporal_height(&self) -> u64
pub fn get_temporal_height(&self) -> u64
Get temporal height from fabric
Sourcepub fn get_rooted_height(&self) -> u64
pub fn get_rooted_height(&self) -> u64
Get rooted height from fabric
pub async fn get_entries(&self) -> Vec<(u64, u64, u64)>
Sourcepub async fn set_peer_handshake_status(
&self,
ip: Ipv4Addr,
status: HandshakeStatus,
) -> Result<(), Error>
pub async fn set_peer_handshake_status( &self, ip: Ipv4Addr, status: HandshakeStatus, ) -> Result<(), Error>
Set handshake status for a peer by IP address
Sourcepub async fn update_peer_from_anr(
&self,
ip: Ipv4Addr,
pk: &PublicKey,
version: &Ver,
status: Option<HandshakeStatus>,
)
pub async fn update_peer_from_anr( &self, ip: Ipv4Addr, pk: &PublicKey, version: &Ver, status: Option<HandshakeStatus>, )
Update peer information from ANR data
Sourcepub async fn get_all_anrs(&self) -> Vec<Anr>
pub async fn get_all_anrs(&self) -> Vec<Anr>
Get all ANRs
Sourcepub async fn get_anr_by_pk_b58(&self, pk_b58: &str) -> Option<Anr>
pub async fn get_anr_by_pk_b58(&self, pk_b58: &str) -> Option<Anr>
Get ANR by public key (Base58 encoded)
Sourcepub async fn get_anr_by_pk(&self, pk: &PublicKey) -> Option<Anr>
pub async fn get_anr_by_pk(&self, pk: &PublicKey) -> Option<Anr>
Get ANR by public key bytes
Sourcepub async fn get_validator_anrs(&self) -> Vec<Anr>
pub async fn get_validator_anrs(&self) -> Vec<Anr>
Get all handshaked ANRs (validators)
Sourcepub fn get_entries_by_height(&self, height: u64) -> Result<Vec<Entry>, Error>
pub fn get_entries_by_height(&self, height: u64) -> Result<Vec<Entry>, Error>
Get entries by height from fabric
Sourcepub fn get_temporal_entry(&self) -> Result<Option<Entry>, Error>
pub fn get_temporal_entry(&self) -> Result<Option<Entry>, Error>
Get temporal entry from fabric
Sourcepub fn get_trainers_for_height(&self, height: u64) -> Option<Vec<PublicKey>>
pub fn get_trainers_for_height(&self, height: u64) -> Option<Vec<PublicKey>>
Get trainers for height
Sourcepub fn get_wallet_balance(&self, public_key: &PublicKey, symbol: &[u8]) -> i128
pub fn get_wallet_balance(&self, public_key: &PublicKey, symbol: &[u8]) -> i128
Get wallet balance - wrapper around fabric.chain_balance_symbol
Sourcepub fn get_contract_state(
&self,
contract: &PublicKey,
key: &[u8],
) -> Option<Vec<u8>>
pub fn get_contract_state( &self, contract: &PublicKey, key: &[u8], ) -> Option<Vec<u8>>
Get contract state from CF_CONTRACTSTATE
Sourcepub fn get_chain_diff_bits(&self) -> u32
pub fn get_chain_diff_bits(&self) -> u32
Get chain difficulty bits
Sourcepub fn get_chain_total_sols(&self) -> i128
pub fn get_chain_total_sols(&self) -> i128
Get total sols
Sourcepub fn get_all_wallet_balances(
&self,
public_key: &PublicKey,
) -> Vec<(Vec<u8>, i128)>
pub fn get_all_wallet_balances( &self, public_key: &PublicKey, ) -> Vec<(Vec<u8>, i128)>
Get all balances for a wallet using prefix scan
Sourcepub fn get_entry_by_hash(&self, hash: &Hash) -> Option<Entry>
pub fn get_entry_by_hash(&self, hash: &Hash) -> Option<Entry>
Get entry by hash
Sourcepub fn db_get(&self, cf: &str, key: &[u8]) -> Result<Option<Vec<u8>>, Error>
pub fn db_get(&self, cf: &str, key: &[u8]) -> Result<Option<Vec<u8>>, Error>
Get value from database column family
Sourcepub fn db_iter_prefix(
&self,
cf: &str,
prefix: &[u8],
) -> Result<Vec<(Vec<u8>, Vec<u8>)>, Error>
pub fn db_iter_prefix( &self, cf: &str, prefix: &[u8], ) -> Result<Vec<(Vec<u8>, Vec<u8>)>, Error>
Iterate over keys with prefix in database column family
Sourcepub async fn parse_udp(&self, buf: &[u8], src: Ipv4Addr) -> Option<Protocol>
pub async fn parse_udp(&self, buf: &[u8], src: Ipv4Addr) -> Option<Protocol>
Reads UDP datagram and silently does parsing, validation and reassembly If the protocol message is complete, returns Some(Protocol)
pub async fn handle( &self, message: Protocol, src: Ipv4Addr, ) -> Result<Vec<Instruction>, Error>
pub async fn execute(&self, instruction: Instruction) -> Result<(), Error>
Sourcepub async fn execute_inner(&self, instruction: Instruction) -> Result<(), Error>
pub async fn execute_inner(&self, instruction: Instruction) -> Result<(), Error>
Handle instruction processing following the Elixir reference implementation
Auto Trait Implementations§
impl !Freeze for Context
impl !RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl !UnwindSafe for Context
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.