Routes file operations to different backends by path prefix.
Matches paths against route prefixes (longest first) and delegates to the corresponding backend. Unmatched paths use the default backend.
CompositeBackend(
self,
default: BackendProtocol | StateBackend,
routes: dict[str, BackendProtocol]
)| Name | Type | Description |
|---|---|---|
default* | BackendProtocol | StateBackend | Backend for paths that don't match any route. |
routes* | dict[str, BackendProtocol] | Map of path prefixes to backends. Prefixes must start with "/" and should end with "/" (e.g., "/memories/"). |
| Name | Type |
|---|---|
| default | BackendProtocol | StateBackend |
| routes | dict[str, BackendProtocol] |
List directory contents (non-recursive).
If path matches a route, lists only that backend. If path is "/", aggregates default backend plus virtual route directories. Otherwise lists default backend.
Async version of ls_info.
Read file content, routing to appropriate backend.
Async version of read.
Search files for literal text pattern.
Routes to backends based on path: specific route searches one backend, "/" or None searches all backends, otherwise searches default backend.
Async version of grep_raw.
See grep_raw() for detailed documentation on routing behavior and parameters.
Find files matching a glob pattern, routing by path prefix.
Async version of glob_info.
Create a new file, routing to appropriate backend.
Async version of write.
Edit a file, routing to appropriate backend.
Async version of edit.
Execute a shell command via the default backend.
Unlike file operations, execution is not path-routable ā it always delegates to the default backend.
Async version of execute.
See execute() for detailed documentation on parameters and behavior.
Upload multiple files, batching by backend for efficiency.
Groups files by their target backend, calls each backend's upload_files once with all files for that backend, then merges results in original order.
Async version of upload_files.
Download multiple files, batching by backend for efficiency.
Groups paths by their target backend, calls each backend's download_files once with all paths for that backend, then merges results in original order.
Async version of download_files.