MCPcopy Create free account
hub / github.com/AI45Lab/Code / from_s3_backend

Method from_s3_backend

core/src/workspace/s3.rs:1180–1196  ·  view source on GitHub ↗

Build a workspace from a pre-constructed [`S3WorkspaceBackend`]. Useful when the caller has injected a custom AWS client (e.g. a mocked HTTP layer, alternative credential provider, or a wrapper that adds metrics / tracing). The backend is wired both as the `WorkspaceFileSystem` and the optional `WorkspaceFileSystemExt`, so tools that perform read-modify-write cycles (`edit`, `patch`) get compare

(backend: Arc<S3WorkspaceBackend>)

Source from the content-addressed store, hash-verified

1178 /// by `max_objects_scanned` / `max_grep_bytes_per_object`; otherwise
1179 /// capability gating keeps them hidden from the model.
1180 pub fn from_s3_backend(backend: Arc<S3WorkspaceBackend>) -> Arc<Self> {
1181 let workspace_ref = super::WorkspaceRef::new(
1182 format!("s3://{}/{}", backend.bucket(), backend.prefix()),
1183 format!("s3://{}/{}", backend.bucket(), backend.prefix()),
1184 );
1185 let search_capable = backend.search_enabled();
1186 let fs: Arc<dyn WorkspaceFileSystem> = backend.clone();
1187 let fs_ext: Arc<dyn WorkspaceFileSystemExt> = backend.clone();
1188 let mut builder = Self::builder(workspace_ref, fs)
1189 .file_system_ext(fs_ext)
1190 .operation_timeout(Duration::from_secs(60));
1191 if search_capable {
1192 let search: Arc<dyn WorkspaceSearch> = backend;
1193 builder = builder.search(search);
1194 }
1195 builder.build()
1196 }
1197}
1198
1199#[cfg(test)]

Callers

nothing calls this directly

Calls 6

search_enabledMethod · 0.80
operation_timeoutMethod · 0.80
file_system_extMethod · 0.80
cloneMethod · 0.45
searchMethod · 0.45
buildMethod · 0.45

Tested by

no test coverage detected