Skip to main content

CommandServer

Struct CommandServer 

Source
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

Source

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

Source

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

Source

pub async fn create_command( &self, request: CreateCommandRequest, ) -> Result<CreateCommandResponse>

Create a new command.

Flow:

  1. Validate request
  2. Registry creates command metadata (source of truth)
  3. KV stores params blob
  4. KV creates pending index (for Pull) or dispatch (for Push)
Source

pub async fn upload_complete( &self, command_id: &str, upload_request: UploadCompleteRequest, ) -> Result<UploadCompleteResponse>

Mark upload as complete and dispatch command.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub async fn release_lease_by_id(&self, lease_id: &str) -> Result<()>

Release a lease by lease_id only (for the API).

Source

pub async fn store_params( &self, command_id: &str, params: &BodySpec, ) -> Result<()>

Source

pub async fn get_params(&self, command_id: &str) -> Result<Option<BodySpec>>

Source

pub async fn store_response( &self, command_id: &str, response: &CommandResponse, ) -> Result<()>

Source

pub async fn get_response( &self, command_id: &str, ) -> Result<Option<CommandResponse>>

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

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.

Source§

impl<T> IntoEither for T

Source§

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

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

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

Source§

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

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,