You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function_storage: shard_key routing for CF DO + tx_cached_value fixture
Threads a shard_key through every FunctionStorage method so the CF DO
backend can route storage ops to a stable Durable Object instance per
attach (or per authenticated user, or anonymous fallback). BoundStorage
and TransactionBoundStorage derive the key from request.attach_id /
auth.principal via _derive_shard_key and pass it to every backend call.
- function_storage.py: add _derive_shard_key (attach_id → "att-<hex>",
authenticated principal → "prn-<sha256>", anonymous → "loc-anon");
shard_key=str kwarg on every Protocol method; BoundStorage and
TransactionBoundStorage accept request= / attach_id= / auth= and
thread shard_key through. SQLite backend ignores shard_key (no
sharding).
- function_storage_cf_do.py / function_storage_azure_sql.py: shard_key
threaded through every method (CF DO uses it as the DO routing key;
Azure ignores it).
- protocol.py, scalar_function.py, table_function.py,
table_in_out_function.py: pass request= / auth= to BoundStorage and
TransactionBoundStorage at every construction site.
- tests/test_function_storage*.py: cover the new kwarg and the derive
precedence.
- vgi/_test_fixtures/table/transaction_storage.py: new tx_cached_value
fixture exercising bind→init→process opaque-data round-trip via
BindResponse.opaque_data + transaction_storage caching. on_init
declares max_workers=1 because the function emits exactly one row
with no work-queue coordination.
- vgi/_test_fixtures/table/__init__.py + worker.py: register the new
fixture.
- profiling_example.py: minor adjustment.
- worker.py: minor adjustment to init dispatch.
- docs/shared-storage.md: point at the relocated CF DO repo.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments