检查点系统¶
BaseCheckpointSaver¶
zerograph.checkpoint.base.BaseCheckpointSaver ¶
Bases: ABC
Abstract base class for checkpoint savers.
get_tuple
abstractmethod
¶
get_tuple(config: dict) -> CheckpointTuple | None
Get a checkpoint tuple by config.
put
abstractmethod
¶
put(
config: dict,
checkpoint: Checkpoint,
metadata: CheckpointMetadata,
) -> dict
Store a checkpoint. Returns updated config.
put_writes
abstractmethod
¶
put_writes(
config: dict, writes: list[PendingWrite], task_id: str
) -> None
Store pending writes for a task.
list
abstractmethod
¶
list(
config: dict,
*,
limit: int = 10,
before: dict | None = None
) -> list[CheckpointTuple]
List checkpoints.
Checkpoint 类型¶
zerograph.checkpoint.base.Checkpoint ¶
Bases: TypedDict
zerograph.checkpoint.base.CheckpointMetadata ¶
Bases: TypedDict
zerograph.checkpoint.base.CheckpointTuple ¶
Bases: NamedTuple
InMemorySaver¶
zerograph.checkpoint.memory.InMemorySaver ¶
Bases: BaseCheckpointSaver
In-memory checkpoint storage.
list ¶
list(
config: dict,
*,
limit: int = 10,
before: dict | None = None
) -> list[CheckpointTuple]
SqliteSaver¶
zerograph.checkpoint.sqlite.SqliteSaver ¶
Bases: BaseCheckpointSaver
SQLite-backed checkpoint storage with WAL mode and thread-safe connections.
list ¶
list(
config: dict,
*,
limit: int = 10,
before: dict | None = None
) -> list[CheckpointTuple]
AsyncSqliteSaver¶
zerograph.checkpoint.sqlite.AsyncSqliteSaver ¶
Bases: SqliteSaver
Async wrapper around SqliteSaver using asyncio.to_thread.
All methods have async variants (aget_tuple, aput, etc.) that
delegate to the synchronous SqliteSaver methods via
asyncio.to_thread. The synchronous methods are also still available.
For :memory: databases, all async operations are routed through a
single-threaded executor so they share the same in-memory database.
alist
async
¶
alist(
config: dict,
*,
limit: int = 10,
before: dict | None = None
) -> list[CheckpointTuple]