Skip to main content

Processor

Struct Processor 

Source
pub struct Processor {
    pub swarm: Arc<Swarm>,
    /* private fields */
}
Expand description

Processor for rings-node rpc server.

Cloning shares the same node handle; publishes from any clone are serialized against each other.

Fields§

§swarm: Arc<Swarm>

a swarm instance

Implementations§

Source§

impl Processor

Source

pub fn did(&self) -> Did

Get current did

Source

pub async fn publish_online_node_descriptor( &self, ) -> Result<OnlineNodeDescriptor>

Publish this node’s signed online descriptor to the online-node registry.

Source

pub async fn lookup_online_nodes( &self, include_expired: bool, ) -> Result<Vec<OnlineNodeDescriptor>>

List signed online-node descriptors from the registry.

Source

pub async fn lookup_onion_exits( &self, service: &str, include_expired: bool, ) -> Result<Vec<OnionExitDescriptor>>

List signed onion-exit descriptors from the application-layer exit registry.

Source

pub async fn build_onion_route( &self, service: String, hop_count: usize, allow_short_paths: bool, ) -> Result<OnionRoute>

Build an onion route from live presence descriptors and live exit descriptors.

Source

pub async fn build_onion_proxy_route( &self, proxy: OnionProxyConfig, target: OnionProxyTarget, ) -> Result<OnionProxyRoute>

Build an onion proxy route for a client target through a target-agnostic proxy config.

Source

pub async fn listen(&self)

Run stabilization and node registration tasks until this future is dropped or aborted.

This is a long-running task; do not await completion as a readiness signal.

Source

pub async fn listen_with(&self, stop: StopToken)

Run stabilization and node registration tasks until stop asks them to exit.

The shutdown is cooperative: it waits for the current stabilization or registration operation to finish before returning. This avoids dropping browser IndexedDB request futures while their JavaScript callbacks are still pending.

Source

pub async fn flush_measurements(&self) -> Result<()>

Flush all applied measurement updates with the graceful-shutdown deadline.

Source

pub async fn connect_with_did(&self, did: Did) -> Result<()>

Connect peer with web3 did. There are 3 peers: PeerA, PeerB, PeerC.

  1. PeerA has a connection with PeerB.
  2. PeerC has a connection with PeerB.
  3. PeerC can connect PeerA with PeerA’s web3 address.

This operation is idempotent: if topology convergence already produced the direct connection, the requested connection is satisfied.

Source

pub async fn disconnect(&self, did: Did) -> Result<()>

Disconnect a peer with web3 did.

Source

pub async fn send_message(&self, destination: Did, msg: &[u8]) -> Result<Uuid>

Send custom message to a did.

Source

pub async fn send_direct_message( &self, destination: Did, msg: &[u8], ) -> Result<Uuid>

Send a custom message to an already connected peer without Chord routing.

Protocols with their own authenticated hop selection, such as onion circuits, use this to keep the core transport from replacing their selected next hop.

Source

pub async fn send_e2e_handshake(&self, destination: Did) -> Result<Uuid>

Send an E2E handshake request to a DID.

The negotiated key is the peer’s account/identity secp256k1 key, not the ephemeral session key.

Source

pub async fn send_e2e_message( &self, destination: Did, recipient_public_key: PublicKey<33>, msg: &[u8], ) -> Result<Uuid>

Send an ElGamal-encrypted E2E message to a DID with a verified recipient key.

Returns the stream id shared by all emitted E2E stream frames.

Source

pub async fn send_e2e_message_with_frame_len( &self, destination: Did, recipient_public_key: PublicKey<33>, msg: &[u8], max_plaintext_frame_len: usize, ) -> Result<Uuid>

Send an ElGamal-encrypted E2E stream with an explicit plaintext frame size.

Returns the stream id shared by all emitted E2E stream frames.

Source

pub fn verify_e2e_handshake_request( &self, requester: Did, request: &E2eHandshakeRequest, ) -> Result<PublicKey<33>>

Verify an E2E handshake request and return the requester’s identity public key.

Source

pub fn verify_e2e_handshake_response( &self, responder: Did, response: &E2eHandshakeResponse, ) -> Result<PublicKey<33>>

Verify an E2E handshake response and return the responder’s identity public key.

Source

pub fn e2e_stream_decryptor( &self, expected_sender: Did, stream_id: E2eStreamId, recipient_identity_key: SecretKey, ) -> Result<E2eStreamDecryptor>

Create an E2E stream decryptor with this node’s identity/signing secret key.

The ciphertext is encrypted to the DID/account key negotiated by the handshake. A session private key cannot decrypt it unless the session key is also the account key, so callers must supply the local identity key explicitly.

Source

pub fn decrypt_e2e_stream_frame( &self, decryptor: &mut E2eStreamDecryptor, frame: &E2eStreamFrame, ) -> Result<Vec<u8>>

Decrypt one E2E stream frame with an already-created stream decryptor.

Source

pub async fn send_envelope( &self, destination: Did, envelope: &Envelope, ) -> Result<Uuid>

Send a namespaced Envelope to a did over the P2P transport (the wire codec of the extension layer). send_envelope : (Did, Envelope) → IO TxId.

Source

pub async fn send_direct_envelope( &self, destination: Did, envelope: &Envelope, ) -> Result<Uuid>

Send a namespaced envelope directly to an already connected peer.

This bypasses Chord routing while retaining the normal custom-message envelope codec.

Source

pub async fn storage_check_cache(&self, entry_key: Did) -> Option<Entry>

check local cache of dht

Source

pub async fn storage_fetch(&self, entry_key: Did) -> Result<()>

Fetch an entry from DHT storage

Source

pub async fn storage_store(&self, entry: Entry) -> Result<()>

Store an entry on DHT storage

Source

pub async fn storage_append_data( &self, topic: &str, data: Encoded, ) -> Result<()>

Append data to an entry on DHT storage

Source

pub async fn storage_touch_data(&self, topic: &str, data: Encoded) -> Result<()>

Touch data in an entry on DHT storage, moving existing equal payloads to the end.

Source

pub async fn storage_tombstone_data( &self, topic: &str, data: Encoded, ) -> Result<()>

Tombstone observed data in an entry on DHT storage.

Source

pub async fn storage_compact_data( &self, topic: &str, removals: Vec<Encoded>, ) -> Result<()>

Compact observed data in an entry on DHT storage.

Source

pub async fn peer_measurement(&self, did: Did) -> Option<PeerMeasurement>

Return local measurement counters for a peer, if observed.

Source

pub async fn peer_measurements(&self) -> Vec<PeerMeasurement>

Return every retained local peer measurement.

Source

pub async fn peer_measurements_page( &self, after: Option<Did>, limit: NonZeroUsize, ) -> PeerMeasurementPage

Return one bounded page of retained local peer measurements.

Source

pub async fn register_service(&self, name: &str) -> Result<()>

register service

Source

pub async fn get_node_info(&self) -> Result<NodeInfoResponse>

get node info

Trait Implementations§

Source§

impl Clone for Processor

Source§

fn clone(&self) -> Processor

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl HandleRpc<AcceptAnswerRequest, AcceptAnswerResponse> for Processor

Source§

fn handle_rpc<'life0, 'async_trait>( &'life0 self, req: AcceptAnswerRequest, ) -> Pin<Box<dyn Future<Output = Result<AcceptAnswerResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handle rpc request and return response.
Source§

impl HandleRpc<AnswerOfferRequest, AnswerOfferResponse> for Processor

Source§

fn handle_rpc<'life0, 'async_trait>( &'life0 self, req: AnswerOfferRequest, ) -> Pin<Box<dyn Future<Output = Result<AnswerOfferResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handle rpc request and return response.
Source§

impl HandleRpc<BuildOnionRouteRequest, BuildOnionRouteResponse> for Processor

Source§

fn handle_rpc<'life0, 'async_trait>( &'life0 self, req: BuildOnionRouteRequest, ) -> Pin<Box<dyn Future<Output = Result<BuildOnionRouteResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handle rpc request and return response.
Source§

impl HandleRpc<ConnectPeerViaHttpRequest, ConnectPeerViaHttpResponse> for Processor

Source§

fn handle_rpc<'life0, 'async_trait>( &'life0 self, req: ConnectPeerViaHttpRequest, ) -> Pin<Box<dyn Future<Output = Result<ConnectPeerViaHttpResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handle rpc request and return response.
Source§

impl HandleRpc<ConnectWithDidRequest, ConnectWithDidResponse> for Processor

Source§

fn handle_rpc<'life0, 'async_trait>( &'life0 self, req: ConnectWithDidRequest, ) -> Pin<Box<dyn Future<Output = Result<ConnectWithDidResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handle rpc request and return response.
Source§

impl HandleRpc<ConnectWithSeedRequest, ConnectWithSeedResponse> for Processor

Source§

fn handle_rpc<'life0, 'async_trait>( &'life0 self, req: ConnectWithSeedRequest, ) -> Pin<Box<dyn Future<Output = Result<ConnectWithSeedResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handle rpc request and return response.
Source§

impl HandleRpc<CreateOfferRequest, CreateOfferResponse> for Processor

Source§

fn handle_rpc<'life0, 'async_trait>( &'life0 self, req: CreateOfferRequest, ) -> Pin<Box<dyn Future<Output = Result<CreateOfferResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handle rpc request and return response.
Source§

impl HandleRpc<DisconnectRequest, DisconnectResponse> for Processor

Source§

fn handle_rpc<'life0, 'async_trait>( &'life0 self, req: DisconnectRequest, ) -> Pin<Box<dyn Future<Output = Result<DisconnectResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handle rpc request and return response.
Source§

impl HandleRpc<FetchTopicMessagesRequest, FetchTopicMessagesResponse> for Processor

Source§

fn handle_rpc<'life0, 'async_trait>( &'life0 self, req: FetchTopicMessagesRequest, ) -> Pin<Box<dyn Future<Output = Result<FetchTopicMessagesResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handle rpc request and return response.
Source§

impl HandleRpc<ListPeerMeasurementsRequest, ListPeerMeasurementsResponse> for Processor

Source§

fn handle_rpc<'life0, 'async_trait>( &'life0 self, req: ListPeerMeasurementsRequest, ) -> Pin<Box<dyn Future<Output = Result<ListPeerMeasurementsResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handle rpc request and return response.
Source§

impl HandleRpc<ListPeersRequest, ListPeersResponse> for Processor

Source§

fn handle_rpc<'life0, 'async_trait>( &'life0 self, _req: ListPeersRequest, ) -> Pin<Box<dyn Future<Output = Result<ListPeersResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handle rpc request and return response.
Source§

impl HandleRpc<LookupOnionExitsRequest, LookupOnionExitsResponse> for Processor

Source§

fn handle_rpc<'life0, 'async_trait>( &'life0 self, req: LookupOnionExitsRequest, ) -> Pin<Box<dyn Future<Output = Result<LookupOnionExitsResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handle rpc request and return response.
Source§

impl HandleRpc<LookupOnlineNodesRequest, LookupOnlineNodesResponse> for Processor

Source§

fn handle_rpc<'life0, 'async_trait>( &'life0 self, req: LookupOnlineNodesRequest, ) -> Pin<Box<dyn Future<Output = Result<LookupOnlineNodesResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handle rpc request and return response.
Source§

impl HandleRpc<LookupServiceRequest, LookupServiceResponse> for Processor

Source§

fn handle_rpc<'life0, 'async_trait>( &'life0 self, req: LookupServiceRequest, ) -> Pin<Box<dyn Future<Output = Result<LookupServiceResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handle rpc request and return response.
Source§

impl HandleRpc<NodeDidRequest, NodeDidResponse> for Processor

Source§

fn handle_rpc<'life0, 'async_trait>( &'life0 self, _req: NodeDidRequest, ) -> Pin<Box<dyn Future<Output = Result<NodeDidResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handle rpc request and return response.
Source§

impl HandleRpc<NodeInfoRequest, NodeInfoResponse> for Processor

Source§

fn handle_rpc<'life0, 'async_trait>( &'life0 self, _req: NodeInfoRequest, ) -> Pin<Box<dyn Future<Output = Result<NodeInfoResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handle rpc request and return response.
Source§

impl HandleRpc<PeerMeasurementRequest, PeerMeasurementResponse> for Processor

Source§

fn handle_rpc<'life0, 'async_trait>( &'life0 self, req: PeerMeasurementRequest, ) -> Pin<Box<dyn Future<Output = Result<PeerMeasurementResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handle rpc request and return response.
Source§

impl HandleRpc<PublishMessageToTopicRequest, PublishMessageToTopicResponse> for Processor

Source§

fn handle_rpc<'life0, 'async_trait>( &'life0 self, req: PublishMessageToTopicRequest, ) -> Pin<Box<dyn Future<Output = Result<PublishMessageToTopicResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handle rpc request and return response.
Source§

impl HandleRpc<RegisterServiceRequest, RegisterServiceResponse> for Processor

Source§

fn handle_rpc<'life0, 'async_trait>( &'life0 self, req: RegisterServiceRequest, ) -> Pin<Box<dyn Future<Output = Result<RegisterServiceResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handle rpc request and return response.
Source§

impl HandleRpc<SendBackendMessageRequest, SendBackendMessageResponse> for Processor

Source§

fn handle_rpc<'life0, 'async_trait>( &'life0 self, req: SendBackendMessageRequest, ) -> Pin<Box<dyn Future<Output = Result<SendBackendMessageResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handle rpc request and return response.
Source§

impl HandleRpc<SendE2eHandshakeRequest, SendE2eHandshakeResponse> for Processor

Source§

fn handle_rpc<'life0, 'async_trait>( &'life0 self, req: SendE2eHandshakeRequest, ) -> Pin<Box<dyn Future<Output = Result<SendE2eHandshakeResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handle rpc request and return response.
Source§

impl HandleRpc<SendE2eMessageRequest, SendE2eMessageResponse> for Processor

Source§

fn handle_rpc<'life0, 'async_trait>( &'life0 self, req: SendE2eMessageRequest, ) -> Pin<Box<dyn Future<Output = Result<SendE2eMessageResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handle rpc request and return response.

Auto Trait Implementations§

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> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

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> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
Source§

impl<T> MaybeSend for T
where T: Send + Sync,

Source§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

Source§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
Source§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The metadata type for pointers and references to this type.
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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