Struct vapcore_light::client::Client [−][src]
Light client implementation.
Implementations
impl<T: ChainDataFetcher> Client<T>
[src]
pub fn new(
config: Config,
db: Arc<dyn KeyValueDB>,
chain_col: u32,
spec: &Spec,
fetcher: T,
io_channel: IoChannel<ClientIoMessage<()>>,
cache: Arc<Mutex<Cache>>
) -> Result<Self, Error>
[src]
config: Config,
db: Arc<dyn KeyValueDB>,
chain_col: u32,
spec: &Spec,
fetcher: T,
io_channel: IoChannel<ClientIoMessage<()>>,
cache: Arc<Mutex<Cache>>
) -> Result<Self, Error>
Create a new Client
.
pub fn read_hardcoded_sync(&self) -> Result<Option<SpecHardcodedSync>, Error>
[src]
Generates the specifications for hardcoded sync. This is typically only called manually from time to time by a Tetsy developer in order to update the chain specifications.
Returns None
if we are at the genesis block.
pub fn add_listener(&self, listener: Weak<dyn LightChainNotify>)
[src]
Adds a new LightChainNotify
listener.
pub fn import_header(&self, header: Header) -> VapcoreResult<H256>
[src]
Import a header to the queue for additional verification.
pub fn status(&self, hash: &H256) -> BlockStatus
[src]
Inquire about the status of a given header.
pub fn chain_info(&self) -> BlockChainInfo
[src]
Get the chain info.
pub fn queue_info(&self) -> BlockQueueInfo
[src]
Get the header queue info.
pub fn block_hash(&self, id: BlockId) -> Option<H256>
[src]
Attempt to get a block hash by block id.
pub fn block_header(&self, id: BlockId) -> Option<Header>
[src]
Get a block header by Id.
pub fn best_block_header(&self) -> Header
[src]
Get the best block header.
pub fn score(&self, id: BlockId) -> Option<U256>
[src]
Get a block’s chain score.
pub fn ancestry_iter(&self, start: BlockId) -> AncestryIter<'_>
[src]
Get an iterator over a block and its ancestry.
pub fn signing_chain_id(&self) -> Option<u64>
[src]
Get the signing chain id.
pub fn flush_queue(&self)
[src]
Flush the header queue.
pub fn cht_root(&self, i: usize) -> Option<H256>
[src]
Get the i
th CHT root.
pub fn import_verified(&self)
[src]
Import a set of pre-verified headers from the queue.
pub fn report(&self) -> ClientReport
[src]
Get a report about blocks imported.
pub fn chain_mem_used(&self) -> usize
[src]
Get blockchain mem usage in bytes.
pub fn set_exit_handler<F>(&self, f: F) where
F: Fn(String) + 'static + Send,
[src]
F: Fn(String) + 'static + Send,
Set a closure to call when the client wants to be restarted.
The parameter passed to the callback is the name of the new chain spec to use after the restart.
pub fn engine(&self) -> &Arc<dyn Engine>
[src]
Get a handle to the verification engine.
pub fn latest_env_info(&self) -> EnvInfo
[src]
Get the latest environment info.
pub fn env_info(&self, id: BlockId) -> Option<EnvInfo>
[src]
Get environment info for a given block.
Trait Implementations
impl<T: ChainDataFetcher> ChainInfo for Client<T>
[src]
fn chain_info(&self) -> BlockChainInfo
[src]
impl<T: ChainDataFetcher> EngineClient for Client<T>
[src]
fn update_sealing(&self, _force: ForceUpdateSealing)
[src]
fn submit_seal(&self, _block_hash: H256, _seal: Vec<Vec<u8>>)
[src]
fn broadcast_consensus_message(&self, _message: Vec<u8>)
[src]
fn epoch_transition_for(&self, parent_hash: H256) -> Option<EpochTransition>
[src]
fn as_full_client(&self) -> Option<&dyn BlockChainClient>
[src]
fn block_number(&self, id: BlockId) -> Option<BlockNumber>
[src]
fn block_header(&self, id: BlockId) -> Option<Header>
[src]
impl<T: ChainDataFetcher> LightChainClient for Client<T>
[src]
fn add_listener(&self, listener: Weak<dyn LightChainNotify>)
[src]
fn chain_info(&self) -> BlockChainInfo
[src]
fn queue_info(&self) -> BlockQueueInfo
[src]
fn queue_header(&self, header: Header) -> VapcoreResult<H256>
[src]
fn block_hash(&self, id: BlockId) -> Option<H256>
[src]
fn block_header(&self, id: BlockId) -> Option<Header>
[src]
fn best_block_header(&self) -> Header
[src]
fn score(&self, id: BlockId) -> Option<U256>
[src]
fn ancestry_iter<'a>(
&'a self,
start: BlockId
) -> Box<dyn Iterator<Item = Header> + 'a>
[src]
&'a self,
start: BlockId
) -> Box<dyn Iterator<Item = Header> + 'a>
fn signing_chain_id(&self) -> Option<u64>
[src]
fn env_info(&self, id: BlockId) -> Option<EnvInfo>
[src]
fn engine(&self) -> &Arc<dyn Engine>
[src]
fn set_spec_name(&self, new_spec_name: String) -> Result<(), ()>
[src]
fn is_known(&self, hash: &H256) -> bool
[src]
fn clear_queue(&self)
[src]
fn flush_queue(&self)
[src]
fn cht_root(&self, i: usize) -> Option<H256>
[src]
fn report(&self) -> ClientReport
[src]
impl<T> Tick for Client<T>
[src]
Auto Trait Implementations
impl<T> !RefUnwindSafe for Client<T>
impl<T> Send for Client<T> where
T: Send,
T: Send,
impl<T> Sync for Client<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Client<T> where
T: Unpin,
T: Unpin,
impl<T> !UnwindSafe for Client<T>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> AsLightClient for T where
T: LightChainClient,
[src]
T: LightChainClient,
type Client = T
The kind of light client this can be treated as.
pub fn as_light_client(&Self) -> &T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Erased for T
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,