Struct ckb_sync::SyncShared
source · [−]pub struct SyncShared { /* private fields */ }Expand description
Sync state shared between sync and relayer protocol
Implementations
sourceimpl SyncShared
impl SyncShared
sourcepub fn new(
shared: Shared,
sync_config: SyncConfig,
tx_relay_receiver: Receiver<TxVerificationResult>
) -> SyncShared
pub fn new(
shared: Shared,
sync_config: SyncConfig,
tx_relay_receiver: Receiver<TxVerificationResult>
) -> SyncShared
only use on test
sourcepub fn with_tmpdir<P>(
shared: Shared,
sync_config: SyncConfig,
tmpdir: Option<P>,
tx_relay_receiver: Receiver<TxVerificationResult>
) -> SyncShared where
P: AsRef<Path>,
pub fn with_tmpdir<P>(
shared: Shared,
sync_config: SyncConfig,
tmpdir: Option<P>,
tx_relay_receiver: Receiver<TxVerificationResult>
) -> SyncShared where
P: AsRef<Path>,
Generate a global sync state through configuration
Shared chain db/config
sourcepub fn active_chain(&self) -> ActiveChain
pub fn active_chain(&self) -> ActiveChain
Get snapshot with current chain
sourcepub fn insert_new_block(
&self,
chain: &ChainController,
block: Arc<BlockView>
) -> Result<bool, CKBError>
pub fn insert_new_block(
&self,
chain: &ChainController,
block: Arc<BlockView>
) -> Result<bool, CKBError>
Insert new block to chain store
sourcepub fn try_search_orphan_pool(&self, chain: &ChainController)
pub fn try_search_orphan_pool(&self, chain: &ChainController)
Try to find blocks from the orphan block pool that may no longer be orphan
sourcepub fn insert_valid_header(&self, peer: PeerIndex, header: &HeaderView)
pub fn insert_valid_header(&self, peer: PeerIndex, header: &HeaderView)
Sync a new valid header, try insert to sync state
sourcepub fn get_header_view(
&self,
hash: &Byte32,
store_first_opt: Option<bool>
) -> Option<HeaderView>
pub fn get_header_view(
&self,
hash: &Byte32,
store_first_opt: Option<bool>
) -> Option<HeaderView>
Get header view with hash
sourcepub fn is_stored(&self, hash: &Byte32) -> bool
pub fn is_stored(&self, hash: &Byte32) -> bool
Check whether block has been inserted to chain store
sourcepub fn get_epoch_ext(&self, hash: &Byte32) -> Option<EpochExt>
pub fn get_epoch_ext(&self, hash: &Byte32) -> Option<EpochExt>
Get epoch ext by block hash
Trait Implementations
sourceimpl Clone for SyncShared
impl Clone for SyncShared
sourcefn clone(&self) -> SyncShared
fn clone(&self) -> SyncShared
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl HeaderProvider for SyncShared
impl HeaderProvider for SyncShared
sourcefn get_header(&self, hash: &Byte32) -> Option<HeaderView>
fn get_header(&self, hash: &Byte32) -> Option<HeaderView>
TODO(doc): @quake
sourcefn timestamp_and_parent(&self, block_hash: &Byte32) -> (u64, u64, Byte32)
fn timestamp_and_parent(&self, block_hash: &Byte32) -> (u64, u64, Byte32)
Return timestamp and block_number of the corresponding block_hash, and hash of parent block
sourcefn block_median_time(
&self,
block_hash: &Byte32,
median_block_count: usize
) -> u64
fn block_median_time(
&self,
block_hash: &Byte32,
median_block_count: usize
) -> u64
Return past block median time, including the timestamp of the given one
Auto Trait Implementations
impl !RefUnwindSafe for SyncShared
impl Send for SyncShared
impl Sync for SyncShared
impl Unpin for SyncShared
impl !UnwindSafe for SyncShared
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more