pub struct InMemoryCommandRegistry { /* private fields */ }Expand description
In-memory implementation for tests and local development.
Tracks command metadata in memory. Targets are registered explicitly via
register_target; resolution then follows exactly
the production rules documented on CommandRegistry::resolve_target.
Implementations§
Source§impl InMemoryCommandRegistry
impl InMemoryCommandRegistry
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new in-memory registry whose Worker targets use Pull delivery (the safe default: matches platforms without a push path).
Sourcepub fn with_worker_delivery_mode(
worker_delivery_mode: CommandDeliveryMode,
) -> Self
pub fn with_worker_delivery_mode( worker_delivery_mode: CommandDeliveryMode, ) -> Self
Create a new in-memory registry with the specified Worker delivery mode.
Container/Daemon targets are always Pull regardless of this setting.
Sourcepub async fn register_target(
&self,
resource_id: impl Into<String>,
resource_type: CommandTargetType,
) -> Result<()>
pub async fn register_target( &self, resource_id: impl Into<String>, resource_type: CommandTargetType, ) -> Result<()>
Register a command-capable target that commands can resolve to.
Mirrors production, where the target set comes from the deployment’s
stack (Stack::command_targets(): Worker/Container/Daemon resources
with commands_enabled). The id is validated through the same shared
guard as resolution, so a :-bearing id is rejected here at registration
rather than surfacing later as a key-grammar collision.
Sourcepub async fn list_command_ids(&self) -> Vec<String>
pub async fn list_command_ids(&self) -> Vec<String>
List all command IDs (useful for debugging/testing)
Trait Implementations§
Source§impl CommandRegistry for InMemoryCommandRegistry
impl CommandRegistry for InMemoryCommandRegistry
Source§fn resolve_target<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
deployment_id: &'life1 str,
requested: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<ResolvedCommandTarget>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn resolve_target<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
deployment_id: &'life1 str,
requested: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<ResolvedCommandTarget>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn create_command<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
deployment_id: &'life1 str,
command_name: &'life2 str,
target: &'life3 ResolvedCommandTarget,
initial_state: CommandState,
deadline: Option<DateTime<Utc>>,
request_size_bytes: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<CommandMetadata>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn create_command<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
deployment_id: &'life1 str,
command_name: &'life2 str,
target: &'life3 ResolvedCommandTarget,
initial_state: CommandState,
deadline: Option<DateTime<Utc>>,
request_size_bytes: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<CommandMetadata>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Source§fn get_command_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
command_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<CommandEnvelopeData>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_command_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
command_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<CommandEnvelopeData>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn get_command_status<'life0, 'life1, 'async_trait>(
&'life0 self,
command_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<CommandStatus>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_command_status<'life0, 'life1, 'async_trait>(
&'life0 self,
command_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<CommandStatus>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn update_command_state<'life0, 'life1, 'async_trait>(
&'life0 self,
command_id: &'life1 str,
state: CommandState,
dispatched_at: Option<DateTime<Utc>>,
completed_at: Option<DateTime<Utc>>,
response_size_bytes: Option<u64>,
error: Option<Value>,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_command_state<'life0, 'life1, 'async_trait>(
&'life0 self,
command_id: &'life1 str,
state: CommandState,
dispatched_at: Option<DateTime<Utc>>,
completed_at: Option<DateTime<Utc>>,
response_size_bytes: Option<u64>,
error: Option<Value>,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn complete_command<'life0, 'life1, 'async_trait>(
&'life0 self,
command_id: &'life1 str,
state: CommandState,
completed_at: DateTime<Utc>,
response_size_bytes: Option<u64>,
error: Option<Value>,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn complete_command<'life0, 'life1, 'async_trait>(
&'life0 self,
command_id: &'life1 str,
state: CommandState,
completed_at: DateTime<Utc>,
response_size_bytes: Option<u64>,
error: Option<Value>,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
state. Read moreSource§fn mark_dispatched_if_not_terminal<'life0, 'life1, 'async_trait>(
&'life0 self,
command_id: &'life1 str,
dispatched_at: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn mark_dispatched_if_not_terminal<'life0, 'life1, 'async_trait>(
&'life0 self,
command_id: &'life1 str,
dispatched_at: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn increment_attempt<'life0, 'life1, 'async_trait>(
&'life0 self,
command_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<u32>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn increment_attempt<'life0, 'life1, 'async_trait>(
&'life0 self,
command_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<u32>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn get_command_access_context<'life0, 'life1, 'async_trait>(
&'life0 self,
command_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<CommandAccessContext>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_command_access_context<'life0, 'life1, 'async_trait>(
&'life0 self,
command_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<CommandAccessContext>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Auto Trait Implementations§
impl !RefUnwindSafe for InMemoryCommandRegistry
impl !UnwindSafe for InMemoryCommandRegistry
impl Freeze for InMemoryCommandRegistry
impl Send for InMemoryCommandRegistry
impl Sync for InMemoryCommandRegistry
impl Unpin for InMemoryCommandRegistry
impl UnsafeUnpin for InMemoryCommandRegistry
Blanket Implementations§
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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