Struct UPC
pub struct UPC<E: Debug> { /* private fields */ }Expand description
Universal Procedure Call (UPC) is a modernized and generalized form of RPC.
It hosts regular RPCs in a more peer-to-peer manner (each node may have either/both “caller” and “callee” roles, instead distinct “server/clients”) and truly achieves what a “remote prodecure” should have been like: direct passing of (typed) local objects as the input/output of a call and eliminating the difference between an actual remote call and a local call. It also allows a multicast-style RPC (https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Networking/Actors/RPCs/) which is at the core of map-reduce/consensus/MPC implementations where the same request is sent to a selected group of different nodes and a threshold of the results are expected to calculate the final result.
In UPC, each callable site is called an endpoint whereas one endpoint has potentially
multiple callee/callers. The endpoint is identified by a customizable identifier I which
implements basic methods to convert from/to 32-byte arrays (a typical identifier can be a
256-bit hash or crypto address). One needs to (optionally) register a Caller/Callee
implementation which defines the computation triggered by a UPC call. For each endpoint, it can
define a set of methods for UPC. At any endpoint, each UPC call is uniquely identified by
method and id. The id is used to separate simultaneous calls and may be reused.
Additionally, each call requires a number that gets passed into Caller to capture the
common abstract concept that the caller implementation may have its internal state. With
Requester, one can initiate a UPC request.
Implementations§
§impl<E: Send + Debug + 'static> UPC<E>
impl<E: Send + Debug + 'static> UPC<E>
pub fn new(network: Hub, pool_size: usize) -> Self
pub async fn register_callee<C: Callee<Error = E> + 'static>( &self, lyquid: &LyquidID, callee: C, ) -> Result<(), Error<E>>
pub async fn register_caller<C: Caller<Error = E> + 'static>( &self, lyquid: &LyquidID, caller: C, ) -> Result<(), Error<E>>
pub fn deregister_caller(&self, id: &LyquidID)
pub fn deregister_callee(&self, id: &LyquidID)
pub async fn add_remote( &mut self, node: NodeID, address: Option<String>, ) -> Result<(), Error<E>>
pub async fn remove_remote(&mut self, remote: NodeID) -> Result<(), Error<E>>
pub async fn start(&self) -> Result<(), Error<E>>
pub fn requester(&self) -> Requester<E>
pub fn node_id(&self) -> &NodeID
Trait Implementations§
Auto Trait Implementations§
impl<E> !Freeze for UPC<E>
impl<E> !RefUnwindSafe for UPC<E>
impl<E> Send for UPC<E>
impl<E> Sync for UPC<E>
impl<E> Unpin for UPC<E>
impl<E> !UnwindSafe for UPC<E>
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<'de, F, T> Deserialize<'de, As<F>> for Twhere
F: BareFormula + ?Sized,
T: Deserialize<'de, F>,
impl<'de, F, T> Deserialize<'de, As<F>> for Twhere
F: BareFormula + ?Sized,
T: Deserialize<'de, F>,
§fn deserialize(deserializer: Deserializer<'de>) -> Result<T, DeserializeError>
fn deserialize(deserializer: Deserializer<'de>) -> Result<T, DeserializeError>
§fn deserialize_in_place(
&mut self,
deserializer: Deserializer<'de>,
) -> Result<(), DeserializeError>
fn deserialize_in_place( &mut self, deserializer: Deserializer<'de>, ) -> Result<(), DeserializeError>
self with data from the input. Read more§impl<'de, F, T> Deserialize<'de, Ref<F>> for T
impl<'de, F, T> Deserialize<'de, Ref<F>> for T
§fn deserialize(de: Deserializer<'de>) -> Result<T, DeserializeError>
fn deserialize(de: Deserializer<'de>) -> Result<T, DeserializeError>
§fn deserialize_in_place(
&mut self,
de: Deserializer<'de>,
) -> Result<(), DeserializeError>
fn deserialize_in_place( &mut self, de: Deserializer<'de>, ) -> Result<(), DeserializeError>
self with data from the input. Read more