fractfs 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fractfs-0.1.0/.github/workflows/release.yml +62 -0
- fractfs-0.1.0/.gitignore +22 -0
- fractfs-0.1.0/LICENSE +201 -0
- fractfs-0.1.0/PKG-INFO +284 -0
- fractfs-0.1.0/README.md +253 -0
- fractfs-0.1.0/examples/.fractfs.toml +22 -0
- fractfs-0.1.0/examples/app.py +41 -0
- fractfs-0.1.0/pyproject.toml +47 -0
- fractfs-0.1.0/src/fractfs/__init__.py +172 -0
- fractfs-0.1.0/src/fractfs/backend.py +112 -0
- fractfs-0.1.0/src/fractfs/config.py +160 -0
- fractfs-0.1.0/src/fractfs/fsspec_backend.py +61 -0
- fractfs-0.1.0/src/fractfs/patterns.py +63 -0
- fractfs-0.1.0/src/fractfs/provisioner.py +217 -0
- fractfs-0.1.0/src/fractfs/resolver.py +54 -0
- fractfs-0.1.0/src/fractfs/sync.py +244 -0
- fractfs-0.1.0/tests/conftest.py +28 -0
- fractfs-0.1.0/tests/test_bundle.py +84 -0
- fractfs-0.1.0/tests/test_config.py +63 -0
- fractfs-0.1.0/tests/test_init.py +71 -0
- fractfs-0.1.0/tests/test_pinning.py +130 -0
- fractfs-0.1.0/tests/test_provisioner.py +89 -0
- fractfs-0.1.0/tests/test_resolver.py +44 -0
- fractfs-0.1.0/tests/test_sync.py +89 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
# Tag-triggered release: pushing a tag like v0.1.0 builds the package and
|
|
4
|
+
# publishes it to PyPI via Trusted Publishing (OIDC) — no stored token.
|
|
5
|
+
on:
|
|
6
|
+
push:
|
|
7
|
+
tags:
|
|
8
|
+
- "v*"
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
build:
|
|
15
|
+
name: Build distributions
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: "3.12"
|
|
23
|
+
|
|
24
|
+
- name: Install build tooling
|
|
25
|
+
run: python -m pip install --upgrade build twine
|
|
26
|
+
|
|
27
|
+
- name: Verify tag matches package version
|
|
28
|
+
run: |
|
|
29
|
+
TAG="${GITHUB_REF_NAME#v}"
|
|
30
|
+
PKG=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
|
|
31
|
+
echo "tag=$TAG package=$PKG"
|
|
32
|
+
if [ "$TAG" != "$PKG" ]; then
|
|
33
|
+
echo "::error::Tag $GITHUB_REF_NAME does not match pyproject version $PKG"
|
|
34
|
+
exit 1
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
- name: Build sdist and wheel
|
|
38
|
+
run: python -m build
|
|
39
|
+
|
|
40
|
+
- name: Check metadata
|
|
41
|
+
run: twine check dist/*
|
|
42
|
+
|
|
43
|
+
- uses: actions/upload-artifact@v4
|
|
44
|
+
with:
|
|
45
|
+
name: dist
|
|
46
|
+
path: dist/
|
|
47
|
+
|
|
48
|
+
publish:
|
|
49
|
+
name: Publish to PyPI
|
|
50
|
+
needs: build
|
|
51
|
+
runs-on: ubuntu-latest
|
|
52
|
+
environment: pypi
|
|
53
|
+
permissions:
|
|
54
|
+
id-token: write # required for Trusted Publishing (OIDC)
|
|
55
|
+
steps:
|
|
56
|
+
- uses: actions/download-artifact@v4
|
|
57
|
+
with:
|
|
58
|
+
name: dist
|
|
59
|
+
path: dist/
|
|
60
|
+
|
|
61
|
+
- name: Publish
|
|
62
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
fractfs-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Local-only assistant notes
|
|
2
|
+
CLAUDE.md
|
|
3
|
+
plans/
|
|
4
|
+
|
|
5
|
+
# Python
|
|
6
|
+
__pycache__/
|
|
7
|
+
*.py[cod]
|
|
8
|
+
*.egg-info/
|
|
9
|
+
.eggs/
|
|
10
|
+
build/
|
|
11
|
+
dist/
|
|
12
|
+
.pytest_cache/
|
|
13
|
+
.ruff_cache/
|
|
14
|
+
.mypy_cache/
|
|
15
|
+
.coverage
|
|
16
|
+
htmlcov/
|
|
17
|
+
.venv/
|
|
18
|
+
venv/
|
|
19
|
+
.env
|
|
20
|
+
|
|
21
|
+
# OS
|
|
22
|
+
.DS_Store
|
fractfs-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
fractfs-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: fractfs
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Drop-in tiered file storage for apps on ephemeral nodes: redirect big/durable files to Databricks Volumes or S3, checkpoint hot local state for restart safety.
|
|
5
|
+
Project-URL: Homepage, https://github.com/isaac-harvey/fractfs
|
|
6
|
+
Project-URL: Repository, https://github.com/isaac-harvey/fractfs
|
|
7
|
+
Project-URL: Issues, https://github.com/isaac-harvey/fractfs/issues
|
|
8
|
+
Author: Isaac Harvey
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: checkpoint,databricks,ephemeral,fsspec,tiered-storage,volumes
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Operating System :: POSIX
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
+
Classifier: Topic :: System :: Filesystems
|
|
18
|
+
Requires-Python: >=3.9
|
|
19
|
+
Requires-Dist: pathspec>=0.11
|
|
20
|
+
Requires-Dist: tomli>=2.0; python_version < '3.11'
|
|
21
|
+
Provides-Extra: dev
|
|
22
|
+
Requires-Dist: pytest-cov; extra == 'dev'
|
|
23
|
+
Requires-Dist: pytest>=7; extra == 'dev'
|
|
24
|
+
Requires-Dist: ruff; extra == 'dev'
|
|
25
|
+
Provides-Extra: hashing
|
|
26
|
+
Requires-Dist: xxhash>=3.0; extra == 'hashing'
|
|
27
|
+
Provides-Extra: s3
|
|
28
|
+
Requires-Dist: fsspec>=2023.1; extra == 's3'
|
|
29
|
+
Requires-Dist: s3fs>=2023.1; extra == 's3'
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
# fractfs
|
|
33
|
+
|
|
34
|
+
**Drop-in tiered file storage for apps on ephemeral nodes.**
|
|
35
|
+
|
|
36
|
+
`fractfs` lets an app with limited, ephemeral local disk transparently push large
|
|
37
|
+
files to durable remote storage (Databricks Volumes primarily; S3 / any `fsspec`
|
|
38
|
+
backend by extension) while keeping small hot state local, with periodic
|
|
39
|
+
checkpoint/restore so a node stop/start doesn't lose data.
|
|
40
|
+
|
|
41
|
+
The only change to your application is one line at startup:
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
import fractfs
|
|
45
|
+
fractfs.init()
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
plus a `.fractfs.toml` in the repo. No I/O interception, no monkeypatching — it
|
|
49
|
+
works at the filesystem layer via symlinks, so it's library-agnostic (duckdb,
|
|
50
|
+
polars, pyarrow, raw C all just work).
|
|
51
|
+
|
|
52
|
+
## Why
|
|
53
|
+
|
|
54
|
+
Apps moving from Posit Connect to Databricks Apps run on nodes with limited,
|
|
55
|
+
ephemeral local disk. Large files don't fit and shouldn't live on the node, and
|
|
56
|
+
anything written locally is lost when the node restarts. `fractfs` tags
|
|
57
|
+
directories and files into tiers and provisions the filesystem so the right data
|
|
58
|
+
lands in the right place — without intercepting I/O calls.
|
|
59
|
+
|
|
60
|
+
## Install
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pip install fractfs # core (Databricks Volumes mount / local backend)
|
|
64
|
+
pip install 'fractfs[s3]' # + S3 / fsspec backends
|
|
65
|
+
pip install 'fractfs[hashing]' # + xxhash content-based change detection
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Configuration
|
|
69
|
+
|
|
70
|
+
A single `.fractfs.toml` at the app root:
|
|
71
|
+
|
|
72
|
+
```toml
|
|
73
|
+
[dirs]
|
|
74
|
+
# Directories whose contents live on the Volume (durable remote store).
|
|
75
|
+
# Directory-granular. New files created here later also land remote by default.
|
|
76
|
+
paths = ["data/blobs", "exports", "cache/parquet"]
|
|
77
|
+
|
|
78
|
+
[ignore]
|
|
79
|
+
# gitignore-syntax. Matching files are NEVER synced/checkpointed.
|
|
80
|
+
patterns = ["*.tmp", "__pycache__/", ".DS_Store"]
|
|
81
|
+
|
|
82
|
+
[local]
|
|
83
|
+
# gitignore-syntax. Matching files are "hot": they live on LOCAL disk
|
|
84
|
+
# (fast, atomic rename) but ARE checkpointed for restore.
|
|
85
|
+
patterns = ["*.meta.json", "manifest.json", "index.sqlite"]
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Environment variables
|
|
89
|
+
|
|
90
|
+
| Var | Meaning | Example |
|
|
91
|
+
|---|---|---|
|
|
92
|
+
| `fractfs_BACKEND` | `volumes` \| `s3` \| `local` | `volumes` |
|
|
93
|
+
| `fractfs_VOLUME_ROOT` | Mount root (or fsspec URL) for the remote store | `/Volumes/cat/schema/vol` |
|
|
94
|
+
| `fractfs_SYNC_INTERVAL` | Checkpoint cadence (seconds) | `300` |
|
|
95
|
+
| `fractfs_SCRATCH` | Node-local scratch root for back-symlink targets | `/tmp/fractfs` |
|
|
96
|
+
| `fractfs_CHECKPOINT_SUBDIR` | Where checkpoints live under the Volume | `_checkpoint` |
|
|
97
|
+
| `fractfs_CONTENT_HASH` | Use content hashing for change detection | `true` |
|
|
98
|
+
| `fractfs_AUTO_IGNORE_BUNDLE` | Exclude the deploy bundle from the checkpoint | `true` |
|
|
99
|
+
| `fractfs_ROOT` | App root holding `.fractfs.toml` | `/app` |
|
|
100
|
+
|
|
101
|
+
Env vars override the TOML scalar fields. (Both `fractfs_` and `FRACTFS_`
|
|
102
|
+
prefixes are accepted.)
|
|
103
|
+
|
|
104
|
+
## The three tiers
|
|
105
|
+
|
|
106
|
+
| Tier | Source | Lands | Checkpointed? | Mechanism |
|
|
107
|
+
|---|---|---|---|---|
|
|
108
|
+
| `dirs` | `[dirs].paths` | **Volume** | No (already durable) | directory symlink → `VOL/<dir>` |
|
|
109
|
+
| `local` | `[local].patterns` | **Node** | **Yes** | pre-created back-symlink when inside a Volume dir |
|
|
110
|
+
| `ignore` | `[ignore].patterns` | **Node** | **No** | back-symlink (kept off Volume) + sync walker skips |
|
|
111
|
+
| *(default)* | everything else | **Node** | **Yes** | normal local disk, checkpointed |
|
|
112
|
+
|
|
113
|
+
### Precedence (the load-bearing rule)
|
|
114
|
+
|
|
115
|
+
When a path matches more than one tier, highest priority wins:
|
|
116
|
+
|
|
117
|
+
1. **`ignore`** — never synced, stays local.
|
|
118
|
+
2. **`local`** — stays local, synced.
|
|
119
|
+
3. **`dirs`** — Volume redirect (the default for everything else under the dir).
|
|
120
|
+
|
|
121
|
+
Patterns use gitignore syntax (via [`pathspec`](https://pypi.org/project/pathspec/))
|
|
122
|
+
matched against the full relative path: `manifest.json` matches at any depth;
|
|
123
|
+
`data/blobs/manifest.json` matches only there.
|
|
124
|
+
|
|
125
|
+
## The `local` tier — what it is and is not
|
|
126
|
+
|
|
127
|
+
`local` is for small files co-written with large blobs (a `manifest.json` next to
|
|
128
|
+
`x.parquet`) that must survive restart but shouldn't take the FUSE cost of going
|
|
129
|
+
direct-to-Volume. Local ext4 gives proper atomic `rename`; a Volume FUSE mount
|
|
130
|
+
has real per-op overhead and weak atomicity, so for small mutable metadata
|
|
131
|
+
local-tier is both faster and safer.
|
|
132
|
+
|
|
133
|
+
**The limit:** `local` does **not** give blob↔metadata transactional
|
|
134
|
+
consistency. On cold restart you restore a checkpoint up to
|
|
135
|
+
`fractfs_SYNC_INTERVAL` seconds stale, while the blob on the Volume is current.
|
|
136
|
+
Use `local` only for independent / rebuildable small state. If the small file is
|
|
137
|
+
a pointer into the blob that must be exactly consistent, either put it in a
|
|
138
|
+
`[dirs]` directory too (shared fate, accept the FUSE cost) or make it
|
|
139
|
+
reconstructable from the blob on startup.
|
|
140
|
+
|
|
141
|
+
### Keeping `local` files always-local (lock files, sqlite, manifests)
|
|
142
|
+
|
|
143
|
+
A `[dirs]` directory is a symlink to the Volume, so files created inside it
|
|
144
|
+
follow that link to the Volume *by default*. To keep a `local`/`ignore` file on
|
|
145
|
+
fast node-local disk instead, fractfs places a **back-symlink** on the Volume
|
|
146
|
+
that points at node-local scratch:
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
VOL/data/blobs/manifest.json -> $fractfs_SCRATCH/data/blobs/manifest.json
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
A symlink has to exist before the write to redirect it, so what fractfs can pin
|
|
153
|
+
depends on whether it can predict the path:
|
|
154
|
+
|
|
155
|
+
- **Exact filenames** (`manifest.json`, `index.sqlite`, or anchored
|
|
156
|
+
`data/blobs/manifest.json`) are pinned with a back-symlink **pre-created at
|
|
157
|
+
`init()`**, possibly dangling — so the file is local from its **very first
|
|
158
|
+
write**, no restart needed.
|
|
159
|
+
- **Directory patterns** (a pattern ending in `/`, e.g. `.locks/`) pin a whole
|
|
160
|
+
subtree. *Any* filename created inside it lands local — this is the escape
|
|
161
|
+
hatch for lock files and other state with unpredictable names. Point the app at
|
|
162
|
+
a pinned subdirectory:
|
|
163
|
+
|
|
164
|
+
```toml
|
|
165
|
+
[ignore]
|
|
166
|
+
patterns = [".locks/"] # data/blobs/.locks/<anything> stays node-local
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
- **Globs** (`*.lock`, `*.tmp`) **cannot** be pre-pinned — fractfs can't know the
|
|
170
|
+
filename until the app creates it, and intercepting the write would mean
|
|
171
|
+
monkeypatching I/O (explicitly rejected). A `*.lock` created *directly* inside a
|
|
172
|
+
`[dirs]` dir therefore lands on the Volume. `init()` emits a warning (also in
|
|
173
|
+
`status()["warnings"]`) when a `[local]` glob could be affected.
|
|
174
|
+
|
|
175
|
+
**The boundary, stated plainly:** anything that spawns sidecar files with names
|
|
176
|
+
you don't control *next to* the data — a SQLite db emitting `-wal`/`-shm`, a
|
|
177
|
+
library dropping `<name>.lock` beside the file it locks — should **not** live
|
|
178
|
+
loose inside a `[dirs]` directory. Put that state in the default local tree (not
|
|
179
|
+
under any `[dirs]` path) where it's plain local disk + checkpointed with all
|
|
180
|
+
sidecars co-located, or confine it to a pinned `foo/` subdirectory.
|
|
181
|
+
|
|
182
|
+
## Public API
|
|
183
|
+
|
|
184
|
+
```python
|
|
185
|
+
import fractfs
|
|
186
|
+
|
|
187
|
+
fractfs.init() # load config, provision symlinks, restore checkpoint, start sync
|
|
188
|
+
# ... app runs unchanged ...
|
|
189
|
+
fractfs.sync_now() # force a checkpoint (e.g. before graceful shutdown)
|
|
190
|
+
fractfs.status() # tier of each tracked path, last sync time, etc.
|
|
191
|
+
fractfs.shutdown() # stop the sync daemon (runs a final checkpoint)
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
`init()` blocks on restore before returning, so the app never reads cold state.
|
|
195
|
+
The provisioner refuses to replace a non-empty real local directory with a
|
|
196
|
+
symlink unless you pass `fractfs.init(force=True)` (which migrates its contents
|
|
197
|
+
to the Volume first).
|
|
198
|
+
|
|
199
|
+
## The deploy bundle is auto-ignored
|
|
200
|
+
|
|
201
|
+
The platform re-supplies your deployed app bundle (code, assets, `.fractfs.toml`)
|
|
202
|
+
from the image on every cold start, so checkpointing it would copy your whole app
|
|
203
|
+
to durable storage every interval for nothing. fractfs detects the bundle and
|
|
204
|
+
excludes it automatically.
|
|
205
|
+
|
|
206
|
+
**How:** at each `init()` (after provisioning, before restore) fractfs takes the
|
|
207
|
+
set of files already present in the local tree and subtracts anything it already
|
|
208
|
+
knows is runtime state (everything in the checkpoint manifest). On a cold
|
|
209
|
+
ephemeral node the remainder is exactly the freshly-deployed bundle; on a warm /
|
|
210
|
+
persistent disk the subtraction keeps real runtime files *out* of the bundle so
|
|
211
|
+
they keep being checkpointed. It's recomputed every start, so it tracks redeploys
|
|
212
|
+
that add or remove files with no config changes. `status()` reports
|
|
213
|
+
`bundle_file_count`.
|
|
214
|
+
|
|
215
|
+
**Turn it off** with `fractfs_AUTO_IGNORE_BUNDLE=false` (or `auto_ignore_bundle =
|
|
216
|
+
false` in the TOML) if you want every local file checkpointed regardless.
|
|
217
|
+
|
|
218
|
+
**Caveat (persistent disks only):** a runtime file created but never checkpointed
|
|
219
|
+
before a restart that *survives* on a persistent local disk could be
|
|
220
|
+
misclassified as bundle and then skipped. This can't happen on an ephemeral disk
|
|
221
|
+
(uncheckpointed files are already gone), and a persistent local disk usually
|
|
222
|
+
doesn't need the checkpoint anyway — but disable the feature if you rely on one.
|
|
223
|
+
|
|
224
|
+
## Deploying on fast ephemeral disk (NVMe instance store)
|
|
225
|
+
|
|
226
|
+
When a node has local NVMe, the cleanest layout is to put the **entire working
|
|
227
|
+
directory on NVMe** — fastest possible disk for all hot state — and let fractfs
|
|
228
|
+
divert big files to durable storage and checkpoint the rest. NVMe being wiped on
|
|
229
|
+
stop/replace is exactly what the checkpoint covers.
|
|
230
|
+
|
|
231
|
+
No new fractfs concept is needed: NVMe simply *becomes* the local disk. (NVMe is
|
|
232
|
+
never a durable *target* — you never checkpoint *to* it; it's a fast, ephemeral
|
|
233
|
+
*source* that gets checkpointed, the same role as the default local tree.)
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
# 1. NVMe instance store mounted at /mnt/nvme (instance/launch config).
|
|
237
|
+
# 2. Run the app from there so the bundle and all writes live on NVMe.
|
|
238
|
+
export fractfs_ROOT=/mnt/nvme/app
|
|
239
|
+
export fractfs_SCRATCH=/mnt/nvme/app/.fractfs-scratch # back-symlink targets on NVMe too
|
|
240
|
+
# 3. Durable store for big files + checkpoints (NOT on NVMe):
|
|
241
|
+
export fractfs_BACKEND=s3
|
|
242
|
+
export fractfs_VOLUME_ROOT=s3://my-bucket/my-app
|
|
243
|
+
export fractfs_SYNC_INTERVAL=300
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
```toml
|
|
247
|
+
# /mnt/nvme/app/.fractfs.toml
|
|
248
|
+
[dirs]
|
|
249
|
+
paths = ["data/blobs", "exports"] # big files -> S3, direct
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
Then:
|
|
253
|
+
|
|
254
|
+
- **Big files** (`[dirs]`) go straight to S3 — never on NVMe, never checkpointed.
|
|
255
|
+
- **Runtime state** (default tier) lives on fast NVMe and is checkpointed to S3.
|
|
256
|
+
- **The bundle** is auto-ignored (re-supplied by the image each start).
|
|
257
|
+
- **On cold start**, the platform re-extracts the bundle onto NVMe and fractfs
|
|
258
|
+
restores runtime state from the S3 checkpoint before your app reads anything.
|
|
259
|
+
|
|
260
|
+
Two notes:
|
|
261
|
+
|
|
262
|
+
- **Reads of the bundle stay local on NVMe; you don't need EBS for it.** Keep EBS
|
|
263
|
+
only if you genuinely want the bundle to *persist* (e.g. slow re-deploys) — and
|
|
264
|
+
if so, an OverlayFS mount (EBS lower, NVMe upper) gives "reads fall through to
|
|
265
|
+
EBS, all writes land on NVMe" transparently. That's an infra-level mount set up
|
|
266
|
+
before the app starts; fractfs composes on top of it unchanged.
|
|
267
|
+
- **Splitting hot dirs across two local disks** (some on NVMe, some on EBS, at the
|
|
268
|
+
same time) is the one case that would need a future "fast-local redirect target"
|
|
269
|
+
tier. The single-disk layout above needs none of it.
|
|
270
|
+
|
|
271
|
+
## Sharp edges
|
|
272
|
+
|
|
273
|
+
- **Multi-replica.** Back-symlink targets are node-local; the link itself lives on
|
|
274
|
+
the Volume and is visible to other replicas. Fine for single-replica apps —
|
|
275
|
+
document/guard before running multiple replicas against the same Volume.
|
|
276
|
+
- **FUSE atomicity.** Checkpoint writes use temp-file-then-`rename`. If your mount
|
|
277
|
+
doesn't honour atomic rename, the backend falls back to a plain copy.
|
|
278
|
+
- **Change detection.** Default is size+mtime (cheap, can miss same-size edits).
|
|
279
|
+
Set `fractfs_CONTENT_HASH=true` (and install `fractfs[hashing]`) for content
|
|
280
|
+
hashing on correctness-sensitive trees.
|
|
281
|
+
|
|
282
|
+
## License
|
|
283
|
+
|
|
284
|
+
See [LICENSE](LICENSE).
|