P2mHandler

Struct P2mHandler 

Source
pub struct P2mHandler<P2mApi> { /* private fields */ }
Expand description

gRPC server router that handles incoming requests and routes them to appropriate services.

Trace2eRouter implements the gRPC server-side logic by accepting incoming requests and routing them to the appropriate process-to-middleware (P2M) or machine-to-machine (M2M) service handlers.

§Type Parameters

  • P2mApi - Service handling process-to-middleware requests
  • M2mApi - Service handling machine-to-machine requests

§Request Routing

The router translates incoming Protocol Buffer requests to internal API types, calls the appropriate service, and converts responses back to Protocol Buffer format for transmission.

Implementations§

Source§

impl<P2mApi> P2mHandler<P2mApi>

Source

pub fn new(p2m: P2mApi) -> Self

Creates a new router with the specified service handlers.

§Arguments
  • p2m - Service for handling process-to-middleware requests

Trait Implementations§

Source§

impl<P2mApi> P2m for P2mHandler<P2mApi>
where P2mApi: Service<P2mRequest, Response = P2mResponse, Error = TraceabilityError> + Clone + Sync + Send + 'static, P2mApi::Future: Send,

Implementation of the trace2e gRPC service protocol.

This implementation provides the server-side handlers for all gRPC endpoints defined in the trace2e protocol. It handles both P2M (process-to-middleware) and M2M (machine-to-machine) operations by delegating to the appropriate internal service handlers.

Source§

fn p2m_local_enroll<'life0, 'async_trait>( &'life0 self, request: Request<LocalCt>, ) -> Pin<Box<dyn Future<Output = Result<Response<Ack>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handles local process enrollment requests.

Registers a local file descriptor with the middleware for tracking. This is called when a process opens a local file or resource.

Source§

fn p2m_remote_enroll<'life0, 'async_trait>( &'life0 self, request: Request<RemoteCt>, ) -> Pin<Box<dyn Future<Output = Result<Response<Ack>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handles remote process enrollment requests.

Registers a network connection (socket) with the middleware for tracking. This is called when a process establishes a network connection.

Source§

fn p2m_io_request<'life0, 'async_trait>( &'life0 self, request: Request<IoInfo>, ) -> Pin<Box<dyn Future<Output = Result<Response<Grant>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handles I/O authorization requests from processes.

Evaluates whether a process is authorized to perform an I/O operation on a specific file descriptor. Returns a grant ID if authorized.

Source§

fn p2m_io_report<'life0, 'async_trait>( &'life0 self, request: Request<IoResult>, ) -> Pin<Box<dyn Future<Output = Result<Response<Ack>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handles I/O operation completion reports from processes.

Records the completion and result of an I/O operation that was previously authorized. This completes the audit trail for the operation.

Auto Trait Implementations§

§

impl<P2mApi> Freeze for P2mHandler<P2mApi>
where P2mApi: Freeze,

§

impl<P2mApi> RefUnwindSafe for P2mHandler<P2mApi>
where P2mApi: RefUnwindSafe,

§

impl<P2mApi> Send for P2mHandler<P2mApi>
where P2mApi: Send,

§

impl<P2mApi> Sync for P2mHandler<P2mApi>
where P2mApi: Sync,

§

impl<P2mApi> Unpin for P2mHandler<P2mApi>
where P2mApi: Unpin,

§

impl<P2mApi> UnwindSafe for P2mHandler<P2mApi>
where P2mApi: UnwindSafe,

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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
§

impl<T> IntoRequest<T> for T

§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<L> LayerExt<L> for L

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in [Layered].
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.
§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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