pub struct ForgeService { /* private fields */ }Expand description
The forge service. One instance is built at server startup and shared
(Arc) across requests. All durable state lives under plugin_dir.
Implementations§
Source§impl ForgeService
impl ForgeService
Sourcepub fn new(
cfg: ForgeConfig,
plugin_dir: impl Into<PathBuf>,
) -> Result<Self, ForgeError>
pub fn new( cfg: ForgeConfig, plugin_dir: impl Into<PathBuf>, ) -> Result<Self, ForgeError>
Build a forge rooted at plugin_dir. Creates the on-disk layout
(repos/, issues/, pulls/, hosted/, marks/) if absent.
The git CGI service is rooted at plugin_dir/repos.
Sourcepub fn with_loopback(self, lb: Arc<dyn LoopbackFetch>) -> Self
pub fn with_loopback(self, lb: Arc<dyn LoopbackFetch>) -> Self
Inject the loopback fetcher (the server’s reqwest client) used to verify and re-fetch pod-hosted bodies.
Sourcepub fn with_spine(self, spine: Arc<dyn SpineStore>) -> Self
pub fn with_spine(self, spine: Arc<dyn SpineStore>) -> Self
Override the spine store (tests inject an in-memory store).
Sourcepub fn token_key(&self) -> &[u8; 32]
pub fn token_key(&self) -> &[u8; 32]
The forge instance HMAC key (for token minting/verification).
Sourcepub fn resolve_agent(&self, req: &ForgeRequest) -> ForgeAgent
pub fn resolve_agent(&self, req: &ForgeRequest) -> ForgeAgent
Resolve the caller identity from req’s Authorization header
(forge token or NIP-98). The server may instead pass a
ForgeAgent::Pod directly to Self::handle when it has a pod
session; this helper is for the token/NIP-98 schemes.
Sourcepub fn plugin_dir(&self) -> &Path
pub fn plugin_dir(&self) -> &Path
The plugin data directory.
Sourcepub async fn handle(
&self,
req: ForgeRequest,
agent: ForgeAgent,
) -> Result<ForgeResponse, ForgeError>
pub async fn handle( &self, req: ForgeRequest, agent: ForgeAgent, ) -> Result<ForgeResponse, ForgeError>
Single entry point. The embedding server maps its native request
to a ForgeRequest, WAC-gates the scope, and calls this.
Trait Implementations§
Source§impl Clone for ForgeService
impl Clone for ForgeService
Source§fn clone(&self) -> ForgeService
fn clone(&self) -> ForgeService
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more