Skip to main content

ActionChannel

Struct ActionChannel 

Source
pub struct ActionChannel<G, F, R> {
    pub goals: Mutex<VecDeque<(ActionGoalId, G)>>,
    pub acks: Mutex<HashMap<u64, GoalAck>>,
    pub feedbacks: Mutex<HashMap<u64, VecDeque<ActionFeedback<F>>>>,
    pub results: Mutex<HashMap<u64, ActionResult<R>>>,
    pub cancels: Mutex<VecDeque<ActionGoalId>>,
    pub statuses: Mutex<HashMap<u64, GoalStatus>>,
    pub heartbeats: Mutex<HashMap<u64, Timestamp>>,
    pub feedback_timestamps: Mutex<HashMap<u64, Timestamp>>,
    pub result_timestamps: Mutex<HashMap<u64, Timestamp>>,
}
Expand description

In-memory channel shared between a client and a server (same-process semantics).

Analogous to middleware_core::ServiceChannel: both sides hold an Arc to the same instance; individual queues are protected by Mutex.

Fields§

§goals: Mutex<VecDeque<(ActionGoalId, G)>>

Client → Server: pending goal queue.

§acks: Mutex<HashMap<u64, GoalAck>>

Server → Client: per-goal acknowledgement.

§feedbacks: Mutex<HashMap<u64, VecDeque<ActionFeedback<F>>>>

Server → Client: feedback queues keyed by goal id.

§results: Mutex<HashMap<u64, ActionResult<R>>>

Server → Client: per-goal final result.

§cancels: Mutex<VecDeque<ActionGoalId>>

Client → Server: cancel request queue.

§statuses: Mutex<HashMap<u64, GoalStatus>>

Current status per goal; readable by both client and server.

§heartbeats: Mutex<HashMap<u64, Timestamp>>

Last heartbeat timestamp per active goal.

§feedback_timestamps: Mutex<HashMap<u64, Timestamp>>

Last feedback timestamp per goal.

§result_timestamps: Mutex<HashMap<u64, Timestamp>>

Last terminal result timestamp per goal.

Implementations§

Source§

impl<G, F, R> ActionChannel<G, F, R>

Source

pub fn new() -> Arc<Self>

Auto Trait Implementations§

§

impl<G, F, R> !Freeze for ActionChannel<G, F, R>

§

impl<G, F, R> RefUnwindSafe for ActionChannel<G, F, R>

§

impl<G, F, R> Send for ActionChannel<G, F, R>
where G: Send, R: Send, F: Send,

§

impl<G, F, R> Sync for ActionChannel<G, F, R>
where G: Send, R: Send, F: Send,

§

impl<G, F, R> Unpin for ActionChannel<G, F, R>
where G: Unpin, R: Unpin, F: Unpin,

§

impl<G, F, R> UnsafeUnpin for ActionChannel<G, F, R>

§

impl<G, F, R> UnwindSafe for ActionChannel<G, F, R>

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.

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, 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.