pub struct ServerState {Show 17 fields
pub store: Store,
pub events: EventSink,
pub scan: Arc<dyn ScanTrigger>,
pub setup: SetupContext,
pub auth: AuthConfig,
pub auth_setup_agent: Option<Arc<dyn AuthSetupAgent>>,
pub auth_setup_jobs: Arc<AuthSetupJobStore>,
pub project_setup_agent: Option<Arc<dyn ProjectSetupAgent>>,
pub project_setup_jobs: Arc<ProjectSetupJobStore>,
pub seed_setup_agent: Option<Arc<dyn SeedSetupAgent>>,
pub remediation_agent: Option<Arc<dyn RemediationAgent>>,
pub remediation_jobs: Arc<RemediationJobStore>,
pub replay: Arc<EventReplay>,
pub state_repos_dir: Option<PathBuf>,
pub state_bundles_dir: Option<PathBuf>,
pub state_logs_dir: Option<PathBuf>,
pub webhook: Option<Arc<WebhookConfig>>,
}Expand description
Shared state injected into every Axum handler. Cloned per request;
the underlying Store and broadcast sender are already cheap to
clone because they wrap Arcs internally.
Fields§
§store: Store§events: EventSink§scan: Arc<dyn ScanTrigger>§setup: SetupContext§auth: AuthConfig§auth_setup_agent: Option<Arc<dyn AuthSetupAgent>>§auth_setup_jobs: Arc<AuthSetupJobStore>§project_setup_agent: Option<Arc<dyn ProjectSetupAgent>>§project_setup_jobs: Arc<ProjectSetupJobStore>§seed_setup_agent: Option<Arc<dyn SeedSetupAgent>>§remediation_agent: Option<Arc<dyn RemediationAgent>>§remediation_jobs: Arc<RemediationJobStore>§replay: Arc<EventReplay>Per-run event replay buffer. Populated by a tap task the daemon
runs alongside the broadcast channel and read by events_ws on
upgrade so newly-attached LiveScanView clients catch the
run’s lifecycle from the start.
state_repos_dir: Option<PathBuf>Path that holds per-repo workspace dirs (the moral equivalent of
<state>/repos). The repo-delete handler removes the per-repo
subdir under this path so a re-add starts from a clean slate.
None in tests that do not exercise workspace cleanup.
state_bundles_dir: Option<PathBuf>Per-finding repro bundle output directory (<state>/bundles).
The bundle handler writes one tarball per finding here and
stamps a repro_bundles row pointing at the resulting path.
None in tests that do not exercise bundle creation.
state_logs_dir: Option<PathBuf>Per-run live-stream event logs (<state>/logs/runs/*.events.jsonl).
The daemon’s event-log tap writes these; the API serves them as
authenticated post-run artifacts.
webhook: Option<Arc<WebhookConfig>>POST /webhook/git config. None disables the route (the
daemon hands a populated struct only when the operator has
configured triggers.webhook_secret_ref).
Implementations§
Source§impl ServerState
impl ServerState
pub fn new( store: Store, events: EventSink, scan: Arc<dyn ScanTrigger>, setup: SetupContext, auth: AuthConfig, ) -> Self
Sourcepub fn with_state_repos_dir(self, dir: PathBuf) -> Self
pub fn with_state_repos_dir(self, dir: PathBuf) -> Self
Attach the on-disk repo workspace root so the delete handler can
remove <state_repos_dir>/<name>/ when a repo is removed.
pub fn with_auth_setup_agent(self, agent: Arc<dyn AuthSetupAgent>) -> Self
pub fn with_project_setup_agent(self, agent: Arc<dyn ProjectSetupAgent>) -> Self
pub fn with_seed_setup_agent(self, agent: Arc<dyn SeedSetupAgent>) -> Self
pub fn with_remediation_agent(self, agent: Arc<dyn RemediationAgent>) -> Self
Sourcepub fn with_state_bundles_dir(self, dir: PathBuf) -> Self
pub fn with_state_bundles_dir(self, dir: PathBuf) -> Self
Attach the on-disk repro bundle output root so the bundle
handler can write <state_bundles_dir>/<finding-id>.tar.
Sourcepub fn with_state_logs_dir(self, dir: PathBuf) -> Self
pub fn with_state_logs_dir(self, dir: PathBuf) -> Self
Attach the logs root so the run event-log handler can serve
<state_logs_dir>/runs/<run>.events.jsonl.
Sourcepub fn with_webhook(self, cfg: WebhookConfig) -> Self
pub fn with_webhook(self, cfg: WebhookConfig) -> Self
Enable POST /webhook/git. The handler returns the standard
error envelope (HTTP 500) when this is not called.
Trait Implementations§
Source§impl Clone for ServerState
impl Clone for ServerState
Source§fn clone(&self) -> ServerState
fn clone(&self) -> ServerState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ServerState
impl !RefUnwindSafe for ServerState
impl Send for ServerState
impl Sync for ServerState
impl Unpin for ServerState
impl UnsafeUnpin for ServerState
impl !UnwindSafe for ServerState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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>
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>
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