pub struct CacheAgent { /* private fields */ }Expand description
Shared state for an agent hosted by the process that owns a build session.
Transport listeners deliberately live in the embedder so the session lifecycle owns them. This type only contains ecosystem-independent CAS and protocol logic.
Implementations§
Source§impl CacheAgent
impl CacheAgent
Sourcepub fn new(cache_dir: impl Into<PathBuf>, version: impl Into<Arc<str>>) -> Self
pub fn new(cache_dir: impl Into<PathBuf>, version: impl Into<Arc<str>>) -> Self
Create an agent backed by the cache rooted at cache_dir.
Sourcepub fn new_remote(
cache_dir: impl Into<PathBuf>,
version: impl Into<Arc<str>>,
remote: AgentRemoteCache,
) -> Self
pub fn new_remote( cache_dir: impl Into<PathBuf>, version: impl Into<Arc<str>>, remote: AgentRemoteCache, ) -> Self
Create an agent with local-first access to a remote action cache.
Sourcepub fn new_remote_with_download_limit(
cache_dir: impl Into<PathBuf>,
version: impl Into<Arc<str>>,
remote: AgentRemoteCache,
max_remote_download_bytes: u64,
) -> Self
pub fn new_remote_with_download_limit( cache_dir: impl Into<PathBuf>, version: impl Into<Arc<str>>, remote: AgentRemoteCache, max_remote_download_bytes: u64, ) -> Self
Create a remote agent with a cumulative download budget for the session.
Sourcepub async fn begin_task(&self, task: &str) -> Result<String>
pub async fn begin_task(&self, task: &str) -> Result<String>
Load the last committed action manifest for a task into this session.
Sourcepub async fn prefetch_task(&self, task: &str) -> Result<String>
pub async fn prefetch_task(&self, task: &str) -> Result<String>
Load a task and finish its prefetch, surfacing remote lookup failures.
Sourcepub async fn cancel_prefetches(&self)
pub async fn cancel_prefetches(&self)
Cancel speculative downloads before the owning session exits.
Sourcepub async fn commit_task(&self, run: &str) -> Result<()>
pub async fn commit_task(&self, run: &str) -> Result<()>
Atomically publish the completed actions collected by a task run.
Sourcepub fn stats(&self) -> AgentStats
pub fn stats(&self) -> AgentStats
Return a snapshot of this session’s cache activity.
Sourcepub async fn handle_requests(
&self,
requests: impl IntoIterator<Item = AgentRequest>,
) -> Vec<AgentResponse>
pub async fn handle_requests( &self, requests: impl IntoIterator<Item = AgentRequest>, ) -> Vec<AgentResponse>
Handle requests without a transport connection.
Persistent wrappers use this entry point when Cargo invokes mbx outside
an orchestrated session. It intentionally has the same response
semantics as Self::handle_connection, while leaving framing and the
version handshake to callers that actually cross a process boundary.
Sourcepub async fn handle_connection<S>(&self, stream: S) -> Result<()>
pub async fn handle_connection<S>(&self, stream: S) -> Result<()>
Serve newline-delimited protocol requests on an authenticated session stream.
Trait Implementations§
Source§impl Clone for CacheAgent
impl Clone for CacheAgent
Source§fn clone(&self) -> CacheAgent
fn clone(&self) -> CacheAgent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more