Node

Struct Node 

Source
pub struct Node<SE, PA>(/* private fields */)
where
    PA: PolicyAgent;
Expand description

A participant in the Ankurah network, and primary place where queries are initiated

Implementations§

Source§

impl<SE, PA> Node<SE, PA>
where SE: StorageEngine + Send + Sync + 'static, PA: PolicyAgent + Send + Sync + 'static,

Source

pub fn new(engine: Arc<SE>, policy_agent: PA) -> Self

Source

pub fn new_durable(engine: Arc<SE>, policy_agent: PA) -> Self

Source

pub fn weak(&self) -> WeakNode<SE, PA>

Source

pub fn register_peer(&self, presence: Presence, sender: Box<dyn PeerSender>)

Source

pub fn deregister_peer(&self, node_id: EntityId)

Source

pub async fn request<'a, C>( &self, node_id: EntityId, cdata: &C, request_body: NodeRequestBody, ) -> Result<NodeResponseBody, RequestError>
where C: Iterable<PA::ContextData>,

Source

pub fn send_update(&self, node_id: EntityId, notification: NodeUpdateBody)

Source

pub async fn handle_message(&self, message: NodeMessage) -> Result<()>

Source

pub async fn commit_remote_transaction( &self, cdata: &PA::ContextData, id: TransactionId, events: Vec<Attested<Event>>, ) -> Result<(), MutationError>

Does all the things necessary to commit a remote transaction

Source

pub fn next_entity_id(&self) -> EntityId

Source

pub fn context(&self, data: PA::ContextData) -> Result<Context, Error>

Source

pub async fn context_async(&self, data: PA::ContextData) -> Context

Source

pub fn get_durable_peer_random(&self) -> Option<EntityId>

Get a random durable peer node ID

Source

pub fn get_durable_peers(&self) -> Vec<EntityId>

Get all durable peer node IDs

Source§

impl<SE, PA> Node<SE, PA>
where SE: StorageEngine + Send + Sync + 'static, PA: PolicyAgent + Send + Sync + 'static,

Source

pub async fn fetch_entities_from_local( &self, collection_id: &CollectionId, selection: &Selection, ) -> Result<Vec<Entity>, RetrievalError>

Trait Implementations§

Source§

impl<SE, PA> Clone for Node<SE, PA>
where PA: PolicyAgent,

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<SE, PA> Deref for Node<SE, PA>
where PA: PolicyAgent,

Source§

type Target = Arc<NodeInner<SE, PA>>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<SE, PA> Display for Node<SE, PA>
where PA: PolicyAgent,

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<SE: StorageEngine + Send + Sync + 'static, PA: PolicyAgent + Send + Sync + 'static> NodeComms for Node<SE, PA>

Source§

fn id(&self) -> EntityId

Source§

fn durable(&self) -> bool

Source§

fn system_root(&self) -> Option<Attested<EntityState>>

Source§

fn register_peer(&self, presence: Presence, sender: Box<dyn PeerSender>)

Source§

fn deregister_peer(&self, node_id: EntityId)

Source§

fn handle_message<'life0, 'async_trait>( &'life0 self, message: NodeMessage, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn cloned(&self) -> Box<dyn NodeComms>

Source§

impl<SE, PA> TNodeErased for Node<SE, PA>
where SE: StorageEngine + Send + Sync + 'static, PA: PolicyAgent + Send + Sync + 'static,

Source§

fn unsubscribe_remote_predicate(&self, query_id: QueryId)

Source§

fn update_remote_query( &self, query_id: QueryId, selection: Selection, version: u32, ) -> Result<(), Error>

Source§

fn fetch_entities_from_local<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, collection_id: &'life1 CollectionId, selection: &'life2 Selection, ) -> Pin<Box<dyn Future<Output = Result<Vec<Entity>, RetrievalError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn reactor(&self) -> &Reactor<Entity>

Source§

fn has_subscription_relay(&self) -> bool

Auto Trait Implementations§

§

impl<SE, PA> Freeze for Node<SE, PA>

§

impl<SE, PA> !RefUnwindSafe for Node<SE, PA>

§

impl<SE, PA> Send for Node<SE, PA>
where SE: Sync + Send,

§

impl<SE, PA> Sync for Node<SE, PA>
where SE: Sync + Send,

§

impl<SE, PA> Unpin for Node<SE, PA>

§

impl<SE, PA> !UnwindSafe for Node<SE, PA>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Iterable<T> for T

Source§

type Iter<'a> = Once<&'a T> where T: 'a

Source§

fn iterable(&self) -> <T as Iterable<T>>::Iter<'_>

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.
Source§

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

Source§

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