Files
PiCloud/crates/orchestrator-core/src/resolver.rs
MechaCat02 b8b544816d chore: initial scaffold — workspace, docs, blueprint
Sets up the PiCloud monorepo as a Cargo workspace organised around the
three-service architecture (manager / orchestrator / executor), each
backed by a *-core library crate so the same logic powers both the MVP
all-in-one `picloud` binary and the future split-process cluster mode.

  * crates/shared, executor-core, orchestrator-core, manager-core
    define the library surface and trait seams between the three
    services (`ExecutorClient`, `ScriptResolver`, `ScriptRepository`).
  * crates/picloud is the MVP entrypoint; serves /healthz on 8080
    (override via PICLOUD_BIND).
  * crates/picloud-{manager,orchestrator,executor} are skeleton
    binaries that keep the crate boundaries honest until cluster
    mode is built out in v1.3+.
  * docs/git-workflow.md defines the trunk-based workflow:
    short-lived branches, Conventional Commits, separate hotfix
    flow with mandatory reproduction tests.
  * CLAUDE.md captures the working rules for future Claude sessions.

Workspace passes `cargo fmt`, `cargo clippy -D warnings` (with
pedantic enabled), and `cargo test --workspace`. The all-in-one
binary responds on `/healthz` and `/`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 23:16:32 +02:00

18 lines
573 B
Rust

use async_trait::async_trait;
use picloud_shared::{Script, ScriptId};
/// How the orchestrator looks up a script before dispatching to the
/// executor. In MVP this is backed by a direct Postgres read inside the
/// manager-core repository, exposed through this trait so orchestrator-core
/// stays DB-agnostic.
#[async_trait]
pub trait ScriptResolver: Send + Sync {
async fn resolve(&self, id: ScriptId) -> Result<Option<Script>, ResolverError>;
}
#[derive(Debug, thiserror::Error)]
pub enum ResolverError {
#[error("backend error: {0}")]
Backend(String),
}