worker: unify workdir attachments

This commit is contained in:
2026-08-05 05:30:58 +09:00
parent ba009c0a20
commit fb115fbb7e
6 changed files with 1439 additions and 58 deletions
+21 -1
View File
@@ -16,7 +16,7 @@ use std::{
time::Duration,
};
use workdir::{
Workdir, WorkdirError,
Workdir, WorkdirError, WorkdirSessionHandle,
http::{OpenWorkdirSessionRequest, RemoteWorkdirSession, WorkdirHttpAuthorization},
};
use worker_runtime::RuntimeWorkspaceScope;
@@ -1177,6 +1177,26 @@ impl RuntimeRegistry {
Ok(runtime.working_directory(working_directory_id))
}
pub async fn open_workdir_session(
&self,
runtime_id: &str,
working_directory_id: &str,
owner_worker_id: &str,
) -> Result<WorkdirSessionHandle, RuntimeRegistryError> {
validate_backend_identifier("runtime_id", runtime_id)?;
validate_backend_identifier("working_directory_id", working_directory_id)?;
validate_backend_identifier("owner_worker_id", owner_worker_id)?;
let runtime = self.runtime(runtime_id)?;
runtime
.open_workdir_session(working_directory_id, Some(owner_worker_id))
.await
.map_err(|error| RuntimeRegistryError::RuntimeOperationFailed {
runtime_id: runtime_id.to_string(),
code: "workdir_session_open_failed".to_string(),
message: error.to_string(),
})
}
pub fn cleanup_working_directory(
&self,
runtime_id: &str,