pub struct NodeAPI { /* private fields */ }
Expand description
Object that allows interaction with a TAPLE node.
It has methods to perform all available read and write operations, as well as an additional action to stop a running node. he interaction is performed thanks to the implementation of a trait known as ApiModuleInterface. Consequently, it is necessary to import the trait in order to properly use the object.
Trait Implementations
sourceimpl ApiModuleInterface for NodeAPI
impl ApiModuleInterface for NodeAPI
Feature that allows implementing the API Rest of an Taple node.
sourcefn create_request<'life0, 'async_trait>(
&'life0 self,
request_type: CreateRequest
) -> Pin<Box<dyn Future<Output = Result<RequestData, ApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn create_request<'life0, 'async_trait>(
&'life0 self,
request_type: CreateRequest
) -> Pin<Box<dyn Future<Output = Result<RequestData, ApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Allows to generate a voting request in the system.
This request will be sent to the node that will be in charge of handling
the votes of the rest of the nodes belonging to the same governance. Read more
sourcefn external_request<'life0, 'async_trait>(
&'life0 self,
event_request: ExternalEventRequest
) -> Pin<Box<dyn Future<Output = Result<RequestData, ApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn external_request<'life0, 'async_trait>(
&'life0 self,
event_request: ExternalEventRequest
) -> Pin<Box<dyn Future<Output = Result<RequestData, ApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Allows to make a request to the node from an external Invoker
sourcefn get_pending_requests<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Vec<EventRequest>, ApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn get_pending_requests<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Vec<EventRequest>, ApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
It allows to obtain all the voting requests pending to be resolved in the node.
These requests are received from other nodes in the network when they try to update
a governance subject. It is necessary to vote their agreement or disagreement with
the proposed changes in order for the events to be implemented. Read more
sourcefn get_single_request<'async_trait>(
self,
id: String
) -> Pin<Box<dyn Future<Output = Result<EventRequest, ApiError>> + Send + 'async_trait>>where
Self: 'async_trait,
fn get_single_request<'async_trait>(
self,
id: String
) -> Pin<Box<dyn Future<Output = Result<EventRequest, ApiError>> + Send + 'async_trait>>where
Self: 'async_trait,
It allows to obtain a single voting request pending to be resolved in the node.
This request is received from other nodes in the network when they try to update
a governance subject. It is necessary to vote its agreement or disagreement with
the proposed changes in order for the events to be implemented. Read more
sourcefn create_event<'life0, 'async_trait>(
&'life0 self,
subject_id: String,
payload: RequestPayload
) -> Pin<Box<dyn Future<Output = Result<RequestData, ApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn create_event<'life0, 'async_trait>(
&'life0 self,
subject_id: String,
payload: RequestPayload
) -> Pin<Box<dyn Future<Output = Result<RequestData, ApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Allows adding a new event to the chain of a subject previously existing
in the node. The event identifier and its payload are required.
This method returns the enumerated [CreateRequestResponse], being the identifier
of a request when the event intends to update a governance, in which case
it will be communicated to the rest of the nodes aware of the governance with
the intention that they vote the change contained in the request. In case the event
is from a conventional subject, the system returns the created event. Read more
sourcefn simulate_event<'life0, 'async_trait>(
&'life0 self,
subject_id: String,
payload: RequestPayload
) -> Pin<Box<dyn Future<Output = Result<SubjectData, ApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn simulate_event<'life0, 'async_trait>(
&'life0 self,
subject_id: String,
payload: RequestPayload
) -> Pin<Box<dyn Future<Output = Result<SubjectData, ApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
It allows to simulate the creation of an event, obtaining the state that would
result from the subject in case the event is actually created. Read more
sourcefn get_all_subjects<'life0, 'async_trait>(
&'life0 self,
namespace: String,
from: Option<usize>,
quantity: Option<usize>
) -> Pin<Box<dyn Future<Output = Result<Vec<SubjectData>, ApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn get_all_subjects<'life0, 'async_trait>(
&'life0 self,
namespace: String,
from: Option<usize>,
quantity: Option<usize>
) -> Pin<Box<dyn Future<Output = Result<Vec<SubjectData>, ApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Allows to get all subjects that are known to the current node, regardless of their governance.
Paging can be performed using the optional arguments
from
and quantity
.
Regarding the first one, note that it admits negative values, in which case the paging is
performed in the opposite direction starting from the end of the collection. Note that this method
also returns the subjects that model governance. Read moresourcefn get_all_governances<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Vec<SubjectData>, ApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn get_all_governances<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Vec<SubjectData>, ApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
It allows to obtain all the subjects that model existing governance in the node. Read more
sourcefn get_event_of_subject<'life0, 'async_trait>(
&'life0 self,
subject_id: String,
from: Option<i64>,
quantity: Option<i64>
) -> Pin<Box<dyn Future<Output = Result<Vec<Event>, ApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn get_event_of_subject<'life0, 'async_trait>(
&'life0 self,
subject_id: String,
from: Option<i64>,
quantity: Option<i64>
) -> Pin<Box<dyn Future<Output = Result<Vec<Event>, ApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Allows to obtain events from a specific subject previously existing in the node.
Paging can be performed by means of the optional arguments
from
and quantity
.
Regarding the former, it should be noted that negative values are allowed, in which case
the paging is performed in the opposite direction starting from the end of the string. Read moresourcefn create_subject<'life0, 'async_trait>(
&'life0 self,
governance_id: String,
schema_id: String,
namespace: String,
payload: RequestPayload
) -> Pin<Box<dyn Future<Output = Result<RequestData, ApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn create_subject<'life0, 'async_trait>(
&'life0 self,
governance_id: String,
schema_id: String,
namespace: String,
payload: RequestPayload
) -> Pin<Box<dyn Future<Output = Result<RequestData, ApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Allows to create a new subject in the node, being its owner the node in question. Read more
sourcefn get_subject<'life0, 'async_trait>(
&'life0 self,
subject_id: String
) -> Pin<Box<dyn Future<Output = Result<SubjectData, ApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn get_subject<'life0, 'async_trait>(
&'life0 self,
subject_id: String
) -> Pin<Box<dyn Future<Output = Result<SubjectData, ApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Allows to obtain a specified subject by specifying its identifier. Read more
sourcefn create_governance<'life0, 'async_trait>(
&'life0 self,
payload: RequestPayload
) -> Pin<Box<dyn Future<Output = Result<RequestData, ApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn create_governance<'life0, 'async_trait>(
&'life0 self,
payload: RequestPayload
) -> Pin<Box<dyn Future<Output = Result<RequestData, ApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Method for creating governance in the system. Read more
sourcefn get_signatures<'life0, 'async_trait>(
&'life0 self,
subject_id: String,
sn: u64,
from: Option<usize>,
quantity: Option<usize>
) -> Pin<Box<dyn Future<Output = Result<Vec<Signature>, ApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn get_signatures<'life0, 'async_trait>(
&'life0 self,
subject_id: String,
sn: u64,
from: Option<usize>,
quantity: Option<usize>
) -> Pin<Box<dyn Future<Output = Result<Vec<Signature>, ApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Method to obtain the validation signatures of an event from a specified subject.
Paging can be performed using the optional arguments
from
and quantity
.
Regarding the first one, it is worth mentioning that it admits negative values, in which case
the pagination is performed in the opposite direction starting from the end of the collection. Read moresourcefn approval_request<'life0, 'async_trait>(
&'life0 self,
request_id: String,
acceptance: Acceptance
) -> Pin<Box<dyn Future<Output = Result<(), ApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn approval_request<'life0, 'async_trait>(
&'life0 self,
request_id: String,
acceptance: Acceptance
) -> Pin<Box<dyn Future<Output = Result<(), ApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Allows to vote on a voting request that previously exists in the system.
This vote will be sent to the corresponding node in charge of its collection. Read more
sourcefn shutdown<'async_trait>(
self
) -> Pin<Box<dyn Future<Output = Result<(), ApiError>> + Send + 'async_trait>>where
Self: 'async_trait,
fn shutdown<'async_trait>(
self
) -> Pin<Box<dyn Future<Output = Result<(), ApiError>> + Send + 'async_trait>>where
Self: 'async_trait,
Stops the node, consuming the instance on the fly. This implies that any previously created API
or [NotificationHandler] instances will no longer be functional. Read more
Auto Trait Implementations
impl !RefUnwindSafe for NodeAPI
impl Send for NodeAPI
impl Sync for NodeAPI
impl Unpin for NodeAPI
impl !UnwindSafe for NodeAPI
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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