Struct bee_tangle::ms_tangle::MsTangle[][src]

pub struct MsTangle<B> { /* fields omitted */ }

A Tangle wrapper designed to encapsulate milestone state.

Implementations

impl<B: StorageBackend> MsTangle<B>[src]

pub fn new(config: TangleConfig, storage: ResourceHandle<B>) -> Self[src]

Create a new MsTangle instance with the given configuration and storage handle.

pub async fn shutdown(self)[src]

Shut down the tangle, terminating any and all worker tasks.

pub fn config(&self) -> &TangleConfig[src]

Get the configuration of this tangle.

pub async fn insert(
    &self,
    message: Message,
    hash: MessageId,
    metadata: MessageMetadata
) -> Option<MessageRef>
[src]

Insert a message into the tangle.

pub async fn add_milestone(&self, idx: MilestoneIndex, milestone: Milestone)[src]

Add a milestone to the tangle.

pub async fn remove_milestone(&self, index: MilestoneIndex)[src]

Remove a milestone from the tangle.

pub async fn get_milestone(&self, index: MilestoneIndex) -> Option<Milestone>[src]

Get the milestone from the tangle that corresponds to the given milestone index.

pub async fn get_milestone_message(
    &self,
    index: MilestoneIndex
) -> Option<MessageRef>
[src]

Get the message associated with the given milestone index from the tangle.

pub async fn get_milestone_message_id(
    &self,
    index: MilestoneIndex
) -> Option<MessageId>
[src]

Get the message ID associated with the given milestone index from the tangle.

pub async fn contains_milestone(&self, idx: MilestoneIndex) -> bool[src]

Return whether the tangle contains the given milestone index.

pub fn get_latest_milestone_index(&self) -> MilestoneIndex[src]

Get the index of the latest milestone.

pub fn update_latest_milestone_index(&self, new_index: MilestoneIndex)[src]

Update the index of the lastest milestone.

pub fn get_solid_milestone_index(&self) -> MilestoneIndex[src]

Get the latest solid milestone index.

pub fn update_solid_milestone_index(&self, new_index: MilestoneIndex)[src]

Update the latest solid milestone index.

pub fn get_confirmed_milestone_index(&self) -> MilestoneIndex[src]

Get the latest confirmed milestone index.

pub fn update_confirmed_milestone_index(&self, new_index: MilestoneIndex)[src]

Update the latest confirmed milestone index.

pub fn get_snapshot_index(&self) -> MilestoneIndex[src]

Get the snapshot index.

pub fn update_snapshot_index(&self, new_index: MilestoneIndex)[src]

Update the snapshot index.

pub fn get_pruning_index(&self) -> MilestoneIndex[src]

Get the pruning index.

pub fn update_pruning_index(&self, new_index: MilestoneIndex)[src]

Update the pruning index.

pub fn get_entry_point_index(&self) -> MilestoneIndex[src]

Get the entry point index.

pub fn update_entry_point_index(&self, new_index: MilestoneIndex)[src]

Update the entry point index.

pub fn is_synced(&self) -> bool[src]

Return whether the tangle is within the default sync threshold.

pub fn get_sync_threshold(&self) -> u32[src]

Get the number of milestones until the tangle is synced.

pub fn is_synced_threshold(&self, threshold: u32) -> bool[src]

Return whether the tangle is within the given sync threshold.

pub fn is_confirmed(&self) -> bool[src]

Return whether the tangle is fully confirmed.

pub fn is_confirmed_threshold(&self, threshold: u32) -> bool[src]

Return whether the tangle is within the given confirmation threshold.

pub async fn get_solid_entry_point_index(
    &self,
    sep: &SolidEntryPoint
) -> Option<MilestoneIndex>
[src]

Get the milestone index associated with the given solid entry point.

pub async fn add_solid_entry_point(
    &self,
    sep: SolidEntryPoint,
    index: MilestoneIndex
)
[src]

Add the given solid entry point to the given milestone index.

pub async fn remove_solid_entry_point(&self, sep: &SolidEntryPoint)[src]

Removes the given solid entry point from the set of solid entry points.

pub async fn clear_solid_entry_points(&self)[src]

Clear all solid entry points.

pub async fn is_solid_entry_point(&self, id: &MessageId) -> bool[src]

Returns whether the message associated with given solid entry point is a solid entry point.

pub async fn is_solid_message(&self, id: &MessageId) -> bool[src]

Returns whether the message associated with the given message ID is solid.

pub async fn omrsi(&self, id: &MessageId) -> Option<IndexId>[src]

Get the oldest milestone root snapshot index.

pub async fn ymrsi(&self, id: &MessageId) -> Option<IndexId>[src]

Get the youngest milestone root snapshot index.

pub async fn insert_tip(&self, message_id: MessageId, parents: Vec<MessageId>)[src]

Insert the given message ID and parents as a tip.

pub async fn update_tip_scores(&self)[src]

Update tip scores.

pub async fn get_messages_to_approve(&self) -> Option<Vec<MessageId>>[src]

Return messages that require approving.

pub async fn reduce_tips(&self)[src]

Reduce tips.

pub async fn non_lazy_tips_num(&self) -> usize[src]

Return the number of non-lazy tips.

Methods from Deref<Target = Tangle<MessageMetadata, StorageHooks<B>>>

pub fn resize(&self, len: usize)[src]

Change the maximum number of entries to store in the cache.

pub fn hooks(&self) -> &H[src]

Return a reference to the storage hooks used by this tangle.

pub async fn insert(
    &self,
    message_id: MessageId,
    message: Message,
    metadata: T
) -> Option<MessageRef>
[src]

Inserts a message, and returns a thread-safe reference to it in case it didn’t already exist.

pub async fn get_with<R>(
    &self,
    message_id: &MessageId,
    f: impl FnOnce(&mut Vertex<T>) -> Option<R>
) -> Option<R>
[src]

Get the data of a vertex associated with the given message_id.

pub async fn get(&self, message_id: &MessageId) -> Option<MessageRef>[src]

Get the data of a vertex associated with the given message_id.

pub async fn contains(&self, message_id: &MessageId) -> bool[src]

Returns whether the message is stored in the Tangle.

pub async fn get_metadata(&self, message_id: &MessageId) -> Option<T>[src]

Get the metadata of a vertex associated with the given message_id.

pub async fn get_metadata_maybe(&self, message_id: &MessageId) -> Option<T>[src]

Get the metadata of a vertex associated with the given message_id, if it’s in the cache.

pub async fn get_vertex(
    &self,
    message_id: &MessageId
) -> Option<impl Deref<Target = Vertex<T>> + '_>
[src]

Get the metadata of a vertex associated with the given message_id.

pub async fn set_metadata(&self, message_id: &MessageId, metadata: T)[src]

Updates the metadata of a particular vertex.

pub async fn update_metadata<R, Update>(
    &self,
    message_id: &MessageId,
    update: Update
) -> Option<R> where
    Update: FnOnce(&mut T) -> R, 
[src]

Updates the metadata of a vertex.

pub async fn len(&self) -> usize[src]

Returns the number of messages in the Tangle.

pub async fn is_empty(&self) -> bool[src]

Checks if the tangle is empty.

pub async fn get_children(
    &self,
    message_id: &MessageId
) -> Option<Vec<MessageId>>
[src]

Returns the children of a vertex, if we know about them.

pub async fn num_children(&self, message_id: &MessageId) -> usize[src]

Returns the number of children of a vertex.

Trait Implementations

impl<B> Deref for MsTangle<B>[src]

type Target = Tangle<MessageMetadata, StorageHooks<B>>

The resulting type after dereferencing.

Auto Trait Implementations

impl<B> !RefUnwindSafe for MsTangle<B>

impl<B> Send for MsTangle<B> where
    B: Send + Sync

impl<B> Sync for MsTangle<B> where
    B: Send + Sync

impl<B> Unpin for MsTangle<B>

impl<B> UnwindSafe for MsTangle<B> where
    B: RefUnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

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]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,