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>)
| 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)] |
nothing calls this directly
no test coverage detected