loom-gateway · state
Source declarations, signatures and documentation for state.
Source: sigil/weave/tools/loom-gateway/src/state.rs. SHA-256: 8835ec0131181bf53d1ce4c5f8e430fab86ea074d74b84762eb62c1d29c5dcf9.
This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.
state::AppState
State shared across handlers. Cheap to clone — just an mpsc Sender plus metadata.
#[derive(Clone)]
pub struct AppState {
/// Channel into the worker that owns the WeaveNode.
pub tx: mpsc::Sender<WorkerRequest>,
/// The `.loom/` workdir root the gateway was launched from.
pub workdir: PathBuf,
/// Default branch surfaced when a request omits the ref.
pub default_branch: String
}Source line: 16.
state::AppState::new
Construct a new AppState.
pub fn new(
tx: mpsc::Sender<WorkerRequest>,
workdir: PathBuf,
default_branch: String,
gateway_token: &str,
) -> Self;Source line: 28.
state::AppState::authorizes
Constant-time verification of the local bearer capability.
pub fn authorizes(&self, token: &str) -> bool;Source line: 43.
state::AppState::ask
Helper: send a request and await the reply, mapping channel
failures to ApiError::Internal.
pub async fn ask<T>(
&self,
build: impl FnOnce(oneshot::Sender<Result<T, ApiError>>) -> WorkerRequest,
) -> Result<T, ApiError>;Source line: 56.