pub struct CommandServer { /* private fields */ }Expand description
Core ARC server implementation.
Uses CommandRegistry as source of truth for metadata. Uses KV for operational data (params, responses, indices, leases).
Implementations§
Source§impl CommandServer
impl CommandServer
Sourcepub fn new(
kv: Arc<dyn Kv>,
storage: Arc<dyn Storage>,
command_dispatcher: Arc<dyn CommandDispatcher>,
command_registry: Arc<dyn CommandRegistry>,
base_url: String,
) -> Self
pub fn new( kv: Arc<dyn Kv>, storage: Arc<dyn Storage>, command_dispatcher: Arc<dyn CommandDispatcher>, command_registry: Arc<dyn CommandRegistry>, base_url: String, ) -> Self
Create a new ARC server instance
Sourcepub fn with_inline_limit(
kv: Arc<dyn Kv>,
storage: Arc<dyn Storage>,
command_dispatcher: Arc<dyn CommandDispatcher>,
command_registry: Arc<dyn CommandRegistry>,
base_url: String,
inline_max_bytes: usize,
) -> Self
pub fn with_inline_limit( kv: Arc<dyn Kv>, storage: Arc<dyn Storage>, command_dispatcher: Arc<dyn CommandDispatcher>, command_registry: Arc<dyn CommandRegistry>, base_url: String, inline_max_bytes: usize, ) -> Self
Create a new ARC server with custom inline size limit
Sourcepub async fn create_command(
&self,
request: CreateCommandRequest,
) -> Result<CreateCommandResponse>
pub async fn create_command( &self, request: CreateCommandRequest, ) -> Result<CreateCommandResponse>
Create a new command.
Flow:
- Validate request
- Registry creates command metadata (source of truth)
- KV stores params blob
- KV creates pending index (for Pull) or dispatch (for Push)
Sourcepub async fn upload_complete(
&self,
command_id: &str,
upload_request: UploadCompleteRequest,
) -> Result<UploadCompleteResponse>
pub async fn upload_complete( &self, command_id: &str, upload_request: UploadCompleteRequest, ) -> Result<UploadCompleteResponse>
Mark upload as complete and dispatch command.
Sourcepub async fn get_command_status(
&self,
command_id: &str,
) -> Result<CommandStatusResponse>
pub async fn get_command_status( &self, command_id: &str, ) -> Result<CommandStatusResponse>
Get command status.
Queries registry for metadata (source of truth), KV for response blob.
Sourcepub async fn submit_command_response(
&self,
command_id: &str,
response: CommandResponse,
) -> Result<()>
pub async fn submit_command_response( &self, command_id: &str, response: CommandResponse, ) -> Result<()>
Submit response from deployment.
Stores response blob in KV, updates state in registry.
Sourcepub async fn acquire_lease(
&self,
deployment_id: &str,
lease_request: &LeaseRequest,
) -> Result<LeaseResponse>
pub async fn acquire_lease( &self, deployment_id: &str, lease_request: &LeaseRequest, ) -> Result<LeaseResponse>
Acquire leases for polling deployments.
Scans KV pending index, queries registry for metadata, creates leases in KV.
Sourcepub async fn release_lease(
&self,
command_id: &str,
lease_id: &str,
) -> Result<()>
pub async fn release_lease( &self, command_id: &str, lease_id: &str, ) -> Result<()>
Release a lease manually.
Increments attempt count in registry, returns command to Pending state.
Sourcepub async fn release_lease_by_id(&self, lease_id: &str) -> Result<()>
pub async fn release_lease_by_id(&self, lease_id: &str) -> Result<()>
Release a lease by lease_id only (for the API).
pub async fn store_params( &self, command_id: &str, params: &BodySpec, ) -> Result<()>
pub async fn get_params(&self, command_id: &str) -> Result<Option<BodySpec>>
pub async fn store_response( &self, command_id: &str, response: &CommandResponse, ) -> Result<()>
pub async fn get_response( &self, command_id: &str, ) -> Result<Option<CommandResponse>>
Auto Trait Implementations§
impl Freeze for CommandServer
impl !RefUnwindSafe for CommandServer
impl Send for CommandServer
impl Sync for CommandServer
impl Unpin for CommandServer
impl UnsafeUnpin for CommandServer
impl !UnwindSafe for CommandServer
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
Mutably borrows from an owned value. Read more
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>
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 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>
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 moreCreates a shared type from an unshared type.