pub struct AppState {
pub store: Arc<SessionStore>,
pub executor: Arc<CommandExecutor>,
pub audit: Arc<AuditSink>,
pub fs: Option<Arc<FsRoot>>,
pub uploads: Arc<UploadStore>,
}Expand description
Shared application state.
Fields§
§store: Arc<SessionStore>§executor: Arc<CommandExecutor>§audit: Arc<AuditSink>Where execution events are recorded; disabled unless configured.
fs: Option<Arc<FsRoot>>The directory the filesystem API may touch.
None means the API is off. Since 0.12.0 the shipped binary no longer
defaults to this: it always installs FsRoot::machine_wide() unless
--fs-root narrows it, on the reasoning that a token holding fs.*
already needs exec to matter, and exec can already reach anything
this process can (src/main.rs). None now only occurs when a
library consumer builds an AppState directly instead of going
through the binary’s startup path.
uploads: Arc<UploadStore>In-flight uploads. Always present; useless until fs is set.
Implementations§
Source§impl AppState
impl AppState
pub fn new() -> Self
Sourcepub fn with_audit(self, sink: Arc<AuditSink>) -> Self
pub fn with_audit(self, sink: Arc<AuditSink>) -> Self
Record execution events to sink.
Sourcepub fn with_kill_orphans(self, kill: bool) -> Self
pub fn with_kill_orphans(self, kill: bool) -> Self
Kill whatever a command leaves running when the command ends.
Rebuilds the executor, so call it before handing the state out. Off
unless asked for — see CommandExecutor::kill_orphans.
Sourcepub fn with_fs_root(self, root: FsRoot) -> Self
pub fn with_fs_root(self, root: FsRoot) -> Self
Enable the filesystem API, confined to root.
Sourcepub fn with_chunk_size(self, chunk_size: usize) -> Self
pub fn with_chunk_size(self, chunk_size: usize) -> Self
Advertise a different chunk size to upload clients.