feat: add workflow snapshot codec registry and strict sanitization
This commit is contained in:
@@ -6,16 +6,17 @@ from app_runtime.workflow.persistence.workflow_repository import WorkflowReposit
|
||||
|
||||
|
||||
class WorkflowPersistence:
|
||||
def __init__(self, workflow_repository, checkpoint_repository) -> None:
|
||||
def __init__(self, workflow_repository, checkpoint_repository, *, snapshot_sanitizer=None) -> None:
|
||||
self._workflow_repository = workflow_repository
|
||||
self._checkpoint_repository = checkpoint_repository
|
||||
self._snapshot_sanitizer = WorkflowSnapshotSanitizer()
|
||||
self._snapshot_sanitizer = snapshot_sanitizer or WorkflowSnapshotSanitizer()
|
||||
|
||||
@classmethod
|
||||
def create_default(cls, connection_factory=None) -> "WorkflowPersistence":
|
||||
def create_default(cls, connection_factory=None, *, snapshot_sanitizer=None) -> "WorkflowPersistence":
|
||||
return cls(
|
||||
workflow_repository=WorkflowRepository(connection_factory),
|
||||
checkpoint_repository=CheckpointRepository(connection_factory),
|
||||
snapshot_sanitizer=snapshot_sanitizer,
|
||||
)
|
||||
|
||||
def start_run(self, workflow_name: str, start_at: str, snapshot: dict[str, object]) -> int:
|
||||
|
||||
Reference in New Issue
Block a user