Skip to main content

InventoryGateway

Trait InventoryGateway 

Source
pub trait InventoryGateway:
    Debug
    + Send
    + Sync {
    // Required methods
    fn list_runners<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        target: &'life1 ScaleTarget,
        cancel: &'life2 CancelToken,
    ) -> Pin<Box<dyn Future<Output = Result<RunnerInventory, InventoryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn remove_runner<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        target: &'life1 ScaleTarget,
        runner_id: u64,
        cancel: &'life2 CancelToken,
    ) -> Pin<Box<dyn Future<Output = Result<(), InventoryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn in_progress_activity<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        scope: &'life1 ActivityScope,
        cancel: &'life2 CancelToken,
    ) -> Pin<Box<dyn Future<Output = Result<ActivityCount, InventoryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn runner_downloads<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        target: &'life1 ScaleTarget,
        cancel: &'life2 CancelToken,
    ) -> Pin<Box<dyn Future<Output = Result<RunnerDownloads, InventoryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn headroom(&self) -> Option<RateLimitHeadroom>;
    fn now(&self) -> Timestamp;

    // Provided method
    fn snapshot<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        scope: &'life1 ActivityScope,
        cancel: &'life2 CancelToken,
    ) -> Pin<Box<dyn Future<Output = Result<InventorySnapshot, InventoryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
}
Expand description

Every read model the dashboard and the CLI display.

A trait rather than a concrete type, so that e1, f1, g2 and g3 can be tested against runner_manager_testkit::github::FakeGithub with no network and no wiremock in their dependency graphs. RestInventory is the one implementation that talks to GitHub.

Required Methods§

Source

fn list_runners<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, target: &'life1 ScaleTarget, cancel: &'life2 CancelToken, ) -> Pin<Box<dyn Future<Output = Result<RunnerInventory, InventoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Every runner GitHub reports for target, across every page.

§Errors

Every variant of InventoryError.

Source

fn remove_runner<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, target: &'life1 ScaleTarget, runner_id: u64, cancel: &'life2 CancelToken, ) -> Pin<Box<dyn Future<Output = Result<(), InventoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Delete one runner registration from target.

The agent owns the registrations it created, and this is how it gives them back. GitHub retires an ephemeral runner promptly once that runner completes a job. Every other ending is on its own schedule: a registration whose runner never got work, or whose process died still holding it, lingers in the target’s runner settings — one was observed listed for 33 hours after the attempt behind it had concluded. GitHub does clear such a registration eventually, so this is not the difference between forever and not; it is the difference between an operator seeing a runner row that matches reality and one that does not.

A 404 is success: the registration is gone, which is the postcondition asked for, and treating GitHub having already removed it as a failure would strand every attempt that concluded the ordinary way.

§Errors

Every variant of InventoryError.

Source

fn in_progress_activity<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, scope: &'life1 ActivityScope, cancel: &'life2 CancelToken, ) -> Pin<Box<dyn Future<Output = Result<ActivityCount, InventoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

In-progress workflow runs across scope.

§Errors

Every variant of InventoryError.

Source

fn runner_downloads<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, target: &'life1 ScaleTarget, cancel: &'life2 CancelToken, ) -> Pin<Box<dyn Future<Output = Result<RunnerDownloads, InventoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

The runner packages GitHub publishes for target.

§Errors

Every variant of InventoryError.

Source

fn headroom(&self) -> Option<RateLimitHeadroom>

What GitHub last said about the hourly quota, if anything.

Source

fn now(&self) -> Timestamp

The instant every snapshot is stamped with.

Provided Methods§

Source

fn snapshot<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, scope: &'life1 ActivityScope, cancel: &'life2 CancelToken, ) -> Pin<Box<dyn Future<Output = Result<InventorySnapshot, InventoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Both read models for one target, in one refresh.

A provided method rather than a required one: it is the composition every caller wants and it must not be possible for an implementation to compose the two counts differently from another.

§Errors

Every variant of InventoryError.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§