Struct taple_core::Taple

source ·
pub struct Taple<M: DatabaseManager<C>, C: DatabaseCollection> { /* private fields */ }
Expand description

Structure representing a node of a TAPLE network.

A node must be instantiated using the Taple::new method, which requires a set of configuration parameters in order to be properly initialized.

Implementations§

source§

impl<M: DatabaseManager<C> + 'static, C: DatabaseCollection + 'static> Taple<M, C>

source

pub fn peer_id(&self) -> Option<PeerId>

Returns the [PeerId] of the node is available. This ID is the identifier of the node at the network level. None can only be get if the node has not been started yet.

source

pub fn public_key(&self) -> Option<Vec<u8>>

Returns the public key (bytes format) of the node is available. None can only be get if the node has not been started yet.

source

pub fn controller_id(&self) -> Option<String>

Returns the controller ID of the node is available. This ID is the identifier of the node at the protocol level. None can only be get if the node has not been started yet.

source

pub fn get_api(&self) -> NodeAPI

This methods allows to get the API of the node. The API can be get as many time as desired. The API is the only method to interact with a node at the user level.

source

pub fn get_notification_handler(&self) -> NotificationHandler

This method allows to get an instance of NotificationHandler. This component is used by the node to report any important events that have occurred, for example the creation of new subjects. The component behaves similar to a channel receiver; users only have to call the NotificationHandler::receive method to start receiving notifications.

source

pub fn get_shutdown_manager(&self) -> TapleShutdownManager

This method allows to get the receiver of the shutdown channel used by the node. This can be used by the user/client to detect when the node has emmited the signal to .

source

pub fn new(settings: TapleSettings, database: M) -> Self

Main and unique method to create an instance of a TAPLE node.

source

pub async fn start(&mut self) -> Result<(), Error>

This method initializes a TAPLE node, generating each of its internal components and allowing subsequent interaction with the node. Each of the aforementioned components is executed in its own Tokyo task, allowing the method to return the control flow once its execution is finished.

Possible results

If the process is successful, the method will return Ok(()). An error will be returned only if it has not been possible to generate the necessary data for the initialization of the components, mainly due to problems in the initial configuration.

Panics

This method panics if it has not been possible to generate the network layer.

Trait Implementations§

source§

impl<M: Debug + DatabaseManager<C>, C: Debug + DatabaseCollection> Debug for Taple<M, C>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<M, C> !RefUnwindSafe for Taple<M, C>

§

impl<M, C> Send for Taple<M, C>

§

impl<M, C> Sync for Taple<M, C>

§

impl<M, C> Unpin for Taple<M, C>where C: Unpin, M: Unpin,

§

impl<M, C> !UnwindSafe for Taple<M, C>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

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

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

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
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more