pub struct Vertex<I: PeerId, J: Justification> {
inner: InnerVertex<J>,
know_most: LruCache<I, ()>,
}
Expand description
The complete vertex, including metadata about peers that know most about the data it refers to.
Fields§
§inner: InnerVertex<J>
§know_most: LruCache<I, ()>
Implementations§
source§impl<I: PeerId, J: Justification> Vertex<I, J>
impl<I: PeerId, J: Justification> Vertex<I, J>
sourcepub fn importable(&self) -> bool
pub fn importable(&self) -> bool
Whether we want the referenced block in our database.
sourcepub fn requestable(&self) -> bool
pub fn requestable(&self) -> bool
Whether the referenced block should be requested. This ignores blocks requested due to justifications, as these will be requested separately.
sourcepub fn justified_block(&self) -> bool
pub fn justified_block(&self) -> bool
Whether the vertex represents imported justified block.
sourcepub fn ready(self) -> Result<J, Self>
pub fn ready(self) -> Result<J, Self>
Deconstructs the vertex into a justification if it is ready to be imported, i.e. the related block has already been imported, otherwise returns it.
sourcepub fn know_most(&self) -> HashSet<I>
pub fn know_most(&self) -> HashSet<I>
The list of peers which know most about the data this vertex refers to.
sourcepub fn set_explicitly_required(&mut self) -> bool
pub fn set_explicitly_required(&mut self) -> bool
Set the vertex to be explicitly required, returns whether anything changed, i.e. the vertex was not explicitly required or imported before.
sourcepub fn set_required(&mut self) -> bool
pub fn set_required(&mut self) -> bool
Set the vertex to be required, returns whether anything changed, i.e. the vertex was not required or imported before.
sourcepub fn add_block_holder(&mut self, holder: Option<I>)
pub fn add_block_holder(&mut self, holder: Option<I>)
Adds a peer that knows most about the block this vertex refers to. Does nothing if we already have a justification.
sourcepub fn insert_header(&mut self, parent: BlockId, holder: Option<I>) -> bool
pub fn insert_header(&mut self, parent: BlockId, holder: Option<I>) -> bool
Adds the information the header provides to the vertex. Returns whether this is a new header.
sourcepub fn insert_body(&mut self, parent: BlockId) -> bool
pub fn insert_body(&mut self, parent: BlockId) -> bool
Adds the information the header provides to the vertex and marks it as imported. Returns whether it was not imported before.
sourcepub fn insert_justification(
&mut self,
parent: BlockId,
justification: J,
holder: Option<I>
)
pub fn insert_justification( &mut self, parent: BlockId, justification: J, holder: Option<I> )
Adds a justification to the vertex.
Trait Implementations§
Auto Trait Implementations§
impl<I, J> RefUnwindSafe for Vertex<I, J>where
I: RefUnwindSafe,
J: RefUnwindSafe,
impl<I, J> Send for Vertex<I, J>where
I: Send,
impl<I, J> Sync for Vertex<I, J>where
I: Sync,
impl<I, J> Unpin for Vertex<I, J>where
J: Unpin,
impl<I, J> UnwindSafe for Vertex<I, J>where
I: RefUnwindSafe,
J: UnwindSafe,
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
§fn checked_from<T>(t: T) -> Option<Self>where
Self: TryFrom<T>,
fn checked_from<T>(t: T) -> Option<Self>where
Self: TryFrom<T>,
§fn checked_into<T>(self) -> Option<T>where
Self: TryInto<T>,
fn checked_into<T>(self) -> Option<T>where
Self: TryInto<T>,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> IsType<T> for T
impl<T> IsType<T> for T
§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
T
. Read more§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from
.§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T
.