Struct bee_tangle::Tangle [−][src]
pub struct Tangle<T, H = NullHooks<T>> where
T: Clone, { /* fields omitted */ }A foundational, thread-safe graph datastructure to represent the IOTA Tangle.
Implementations
impl<T, H: Hooks<T>> Tangle<T, H> where
T: Clone, [src]
impl<T, H: Hooks<T>> Tangle<T, H> where
T: Clone, [src]pub fn new(hooks: H) -> Self[src]
Creates a new Tangle.
pub fn with_capacity(self, cap: usize) -> Self[src]
Create a new tangle with the given capacity.
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]
&self,
message_id: MessageId,
message: Message,
metadata: T
) -> Option<MessageRef>
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]
&self,
message_id: &MessageId,
f: impl FnOnce(&mut Vertex<T>) -> Option<R>
) -> Option<R>
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]
&self,
message_id: &MessageId
) -> Option<impl Deref<Target = Vertex<T>> + '_>
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]
&self,
message_id: &MessageId,
update: Update
) -> Option<R> where
Update: FnOnce(&mut T) -> R,
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]
&self,
message_id: &MessageId
) -> Option<Vec<MessageId>>
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
Auto Trait Implementations
impl<T, H = NullHooks<T>> !RefUnwindSafe for Tangle<T, H>
impl<T, H = NullHooks<T>> !RefUnwindSafe for Tangle<T, H>impl<T, H> UnwindSafe for Tangle<T, H> where
H: UnwindSafe,
T: UnwindSafe,
impl<T, H> UnwindSafe for Tangle<T, H> where
H: UnwindSafe,
T: UnwindSafe,