|
| 1 | +# Architecture |
| 2 | + |
| 3 | +`opendalfs` connects two existing abstractions. OpenDAL supplies storage |
| 4 | +services and operations. fsspec supplies the filesystem interface used by |
| 5 | +Python data libraries. |
| 6 | + |
| 7 | +## The request path |
| 8 | + |
| 9 | +When pandas opens an `opendal+s3` URL, the request passes through these layers: |
| 10 | + |
| 11 | +```text |
| 12 | +pandas |
| 13 | + -> fsspec URL resolution |
| 14 | + -> opendalfs filesystem method |
| 15 | + -> OpenDAL Python operator |
| 16 | + -> storage service |
| 17 | +``` |
| 18 | + |
| 19 | +The reverse path returns bytes, metadata, directory entries, or a file-like |
| 20 | +object in the shape expected by fsspec. |
| 21 | + |
| 22 | +## One filesystem, one service configuration |
| 23 | + |
| 24 | +An {class}`opendalfs.OpendalFileSystem` owns one OpenDAL operator. The operator |
| 25 | +is configured for one service and one root. Create another filesystem for a |
| 26 | +second bucket, container, or root. |
| 27 | + |
| 28 | +```python |
| 29 | +from opendalfs import OpendalFileSystem |
| 30 | + |
| 31 | +incoming = OpendalFileSystem("s3", bucket="incoming", region="us-east-1") |
| 32 | +archive = OpendalFileSystem("s3", bucket="archive", region="us-east-1") |
| 33 | +``` |
| 34 | + |
| 35 | +fsspec may cache instances created with identical arguments. This is useful for |
| 36 | +connection reuse, but it does not merge different service configurations. |
| 37 | + |
| 38 | +## What the adapter owns |
| 39 | + |
| 40 | +`opendalfs` is responsible for: |
| 41 | + |
| 42 | +- fsspec method shapes and metadata dictionaries |
| 43 | +- sync wrappers around async storage operations |
| 44 | +- buffered file behavior |
| 45 | +- URL protocol registration |
| 46 | +- translating URL authorities and paths into operator-relative paths |
| 47 | +- adapter settings such as retries and concurrent writes |
| 48 | + |
| 49 | +OpenDAL remains responsible for service clients, credentials, backend-specific |
| 50 | +configuration, and the native capability of each service. |
| 51 | + |
| 52 | +## Why integrations work |
| 53 | + |
| 54 | +Most integrations do not know about OpenDAL. They call fsspec with a URL, |
| 55 | +filesystem, mapping, or file-like object. Compatibility depends on how closely |
| 56 | +the adapter follows those fsspec contracts. The repository therefore tests |
| 57 | +real downstream entry points in addition to its own filesystem methods. |
0 commit comments