MountainVinegRPCService

Struct MountainVinegRPCService 

Source
pub struct MountainVinegRPCService {
    ApplicationHandle: AppHandle,
    RunTime: Arc<ApplicationRunTime>,
    ActiveOperations: Arc<RwLock<HashMap<u64, CancellationToken>>>,
}
Expand description

The concrete implementation of the MountainService gRPC service.

This service handles all incoming RPC calls from the Cocoon sidecar, validating requests, dispatching to appropriate handlers, and returning responses in the expected gRPC format.

Fields§

§ApplicationHandle: AppHandle

Tauri application handle for VS Code integration

§RunTime: Arc<ApplicationRunTime>

Application runtime containing core dependencies

§ActiveOperations: Arc<RwLock<HashMap<u64, CancellationToken>>>

Registry of active operations with their cancellation tokens Maps request ID to cancellation token for operation cancellation

Implementations§

Source§

impl MountainVinegRPCService

Source

pub fn Create( ApplicationHandle: AppHandle, RunTime: Arc<ApplicationRunTime>, ) -> Self

Creates a new instance of the Mountain gRPC service.

§Parameters
  • ApplicationHandle: Tauri app handle for framework integration
  • RunTime: Application runtime with core dependencies
§Returns

New MountainVinegRPCService instance

Source

pub async fn RegisterOperation(&self, request_id: u64) -> CancellationToken

Registers an operation for potential cancellation

§Parameters
  • request_id: The request identifier for the operation
§Returns

A cancellation token that can be used to cancel the operation

Source

pub async fn UnregisterOperation(&self, request_id: u64)

Unregisters an operation after completion

§Parameters
  • request_id: The request identifier to unregister
Source

fn ValidateRequest(&self, request: &GenericRequest) -> Result<(), Status>

Validates a generic request before processing.

§Parameters
  • request: The request to validate
§Returns
  • Ok(()): Request is valid
  • Err(Status): Validation failed with appropriate gRPC status
Source

fn CreateErrorResponse( RequestIdentifier: u64, code: i32, message: String, data: Option<Vec<u8>>, ) -> GenericResponse

Creates a JSON-RPC compliant error response.

§Parameters
  • RequestIdentifier: The request ID to echo back
  • code: JSON-RPC error code
  • message: Error message
  • data: Optional error data (serialized)
§Returns

GenericResponse with error populated

Source

fn CreateSuccessResponse( RequestIdentifier: u64, result: &Value, ) -> GenericResponse

Creates a successful JSON-RPC response.

§Parameters
  • RequestIdentifier: The request ID to echo back
  • result: Result value to serialize
§Returns

GenericResponse with result populated, or error if serialization fails

Trait Implementations§

Source§

impl MountainService for MountainVinegRPCService

Source§

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

Handles generic request-response RPCs from Cocoon.

This is the main entry point for Cocoon to request operations from Mountain. It validates the request, deserializes parameters, dispatches to the Track module, and returns the result or error in JSON-RPC format.

§Parameters
  • request: GenericRequest containing method name and serialized parameters
§Returns
  • Ok(Response<GenericResponse>): Response with result or error
  • Err(Status): gRPC status error (only for critical failures)
Source§

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

Handles generic fire-and-forget notifications from Cocoon.

Notifications do not expect a response beyond acknowledgment. They are used for status updates, events, and other asynchronous notifications.

§Parameters
  • request: GenericNotification with method name and parameters
§Returns
  • Ok(Response<Empty>): Notification was received and logged
  • Err(Status): Critical error during processing
§TODO

Future implementation should route notifications to dedicated handlers:

let Parameter: Value = serde_json::from_slice(&notification.parameter)?;
NotificationHandler::Handle(MethodName, Parameter).await?;
Source§

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

Handles a request from Cocoon to cancel a long-running operation.

This method is called when Cocoon wants to cancel an operation that was previously initiated via process_cocoon_request.

§Parameters
  • request: CancelOperationRequest with the request ID to cancel
§Returns
  • Ok(Response<Empty>): Cancellation was initiated
  • Err(Status): Critical error during cancellation

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

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

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.

§

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
§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: 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
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: 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, 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<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

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

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