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
refactor: unify storage protocols into single FunctionStorage interface
Merged InitStorage and WorkerStateStorage protocols into a unified
FunctionStorage protocol with consistent naming:
- global_put/get/delete/exists for init data
- worker_put/collect for worker state
- queue_push/pop/clear for work queue
Merged InitStorageSqlite and WorkerStateStorageSqlite into single
FunctionStorageSqlite implementation.
Users now implement one class for custom storage backends.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
{"id":"vgi-python-e37","title":"move Invocation from function.py out to own file","description":"The Invocation clas is kind of seperate from functions, so it should be in its own file. Move it and all of its other associated classes like InvocationType to its own file","status":"closed","priority":2,"issue_type":"task","created_at":"2026-01-04T09:18:46.605941-05:00","created_by":"rusty","updated_at":"2026-01-04T09:24:37.922675-05:00","closed_at":"2026-01-04T09:24:37.922675-05:00","close_reason":"Closed"}
2
2
{"id":"vgi-python-odi","title":"Change max_processes from method to property in Function hierarchy","description":"Refactor max_processes from a method to a property across the Function class hierarchy (Function, ScalarFunction, TableFunctionGenerator, TableInOutFunction, etc.). This makes the API more consistent since max_processes is effectively a constant per function class and properties are more idiomatic for such values.","status":"closed","priority":2,"issue_type":"task","created_at":"2026-01-04T11:25:29.750648-05:00","created_by":"rusty","updated_at":"2026-01-04T11:50:57.566545-05:00","closed_at":"2026-01-04T11:50:57.566545-05:00","close_reason":"Closed"}
3
3
{"id":"vgi-python-p91","title":"Move exception classes from function.py to own file","description":"Move InitIdentifierError and SchemaValidationError from vgi/function.py to a new vgi/exceptions.py file. Update imports in function.py and any other files that reference these exceptions.","status":"closed","priority":2,"issue_type":"task","created_at":"2026-01-04T09:12:28.058227-05:00","created_by":"rusty","updated_at":"2026-01-04T09:17:52.477661-05:00","closed_at":"2026-01-04T09:17:52.477661-05:00","close_reason":"Closed"}
4
+
{"id":"vgi-python-zf7","title":"Unify storage protocols into single FunctionStorage interface","description":"## Problem\n\nCurrently there are two separate storage protocols (InitStorage and WorkerStateStorage) with inconsistent naming:\n- `create` vs `store` (different verbs for similar operations)\n- `collect_and_delete` is verbose and describes implementation\n\nUsers wanting a custom storage backend (Redis, DynamoDB, etc.) must implement two separate classes.\n\n## Solution\n\nUnify into a single `FunctionStorage` protocol with consistent naming using prefixes to group related methods:\n\n```python\nclass FunctionStorage(Protocol):\n \"\"\"Storage protocol for VGI distributed function execution.\n \n Three access patterns:\n - Global state: Init data shared across all workers (key-value with auto-generated keys)\n - Worker state: Partial results per worker (collected during finalization)\n - Work queue: Atomic work distribution across workers (FIFO queue)\n \"\"\"\n \n # Global state (init data)\n def global_put(self, value: bytes) -\u003e bytes: ... # Returns auto-generated key\n def global_get(self, key: bytes) -\u003e bytes: ...\n def global_delete(self, key: bytes) -\u003e None: ...\n def global_exists(self, key: bytes) -\u003e bool: ...\n \n # Worker state (partial results per worker)\n def worker_put(self, invocation_id: bytes, worker_id: int, state: bytes) -\u003e None: ...\n def worker_collect(self, invocation_id: bytes) -\u003e list[bytes]: ... # Atomic collect+delete\n \n # Work queue (distributed work items)\n def queue_push(self, invocation_id: bytes, items: list[bytes]) -\u003e int: ...\n def queue_pop(self, invocation_id: bytes) -\u003e bytes | None: ... # Atomic claim\n def queue_clear(self, invocation_id: bytes) -\u003e int: ...\n```\n\n## Design Rationale\n\n- **Prefixes** (`global_`, `worker_`, `queue_`): Clear grouping, good autocomplete\n- **Consistent verbs**: `put/get` for storage, `push/pop` for queue\n- **Minimal interface**: 9 methods total (down from 9, but now unified)\n- **Single class variable** in Function: `storage: ClassVar[FunctionStorage]`\n\n## Files to Change\n\n- `vgi/function_storage.py`: New protocol + merged FunctionStorageSqlite\n- `vgi/function.py`: Single `storage` class variable, update all method calls","status":"closed","priority":2,"issue_type":"task","created_at":"2026-01-04T12:34:25.966005-05:00","created_by":"rusty","updated_at":"2026-01-04T12:58:16.913278-05:00","closed_at":"2026-01-04T12:58:16.913278-05:00","close_reason":"Closed"}
0 commit comments