pub trait CommandRegistry: Send + Sync {
// Required methods
fn create_command<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
deployment_id: &'life1 str,
command_name: &'life2 str,
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;
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_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 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<()>> + 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;
}Expand description
Abstraction for command metadata storage and lifecycle tracking.
The CommandRegistry is the source of truth for all command metadata. Implementations store command state, timestamps, and result information.
Required Methods§
Sourcefn create_command<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
deployment_id: &'life1 str,
command_name: &'life2 str,
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,
fn create_command<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
deployment_id: &'life1 str,
command_name: &'life2 str,
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,
Create a new command and return metadata for routing.
The registry generates the command_id, determines the deployment_model, and stores all metadata (state, timestamps, etc.).
Sourcefn 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,
Get metadata needed to build an envelope during lease acquisition.
Returns None if command doesn’t exist.
Sourcefn 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,
Get full command status for status endpoint.
Returns None if command doesn’t exist.
Sourcefn 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<()>> + 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<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Update command state during lifecycle (dispatched, completed, failed).
Sourcefn 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,
Increment attempt count (on lease release/expiry).
Returns the new attempt number.