perago.build_workspace_sync_plan#

perago.build_workspace_sync_plan(workspace_dir, workspace_spec, existing_object_paths)[源代码]#

Build a complete sync plan for a workspace prefix.

This is the high-level planning helper used by LakeFS staging code. It combines the local upload records with remote stale-object deletes for the same prefix.

Parameters:
workspace_dirpathlib.Path

Attempt-local workspace root after the task body has finished.

workspace_specWorkspaceSpec

Workspace declaration whose prefix defines the LakeFS projection to synchronize.

existing_object_pathslist of str

Object paths currently present on the staging branch before uploading the new local workspace contents.

Returns:
WorkspaceSyncPlan

Upload and delete operations needed to make the staging branch prefix match the local attempt workspace.

Raises:
TaskInputError

If the local workspace contains a symbolic link.

TaskDefinitionError

If a local or remote path is not a valid workspace-relative path.

参数:
返回类型:

WorkspaceSyncPlan

参见

workspace_upload_files

Discover local files selected for upload.

workspace_delete_object_paths

Discover remote objects selected for deletion.

WorkspaceSyncPlan

Return type containing both operation lists.

Notes

This helper treats the local workspace as the desired state for the whole prefix. Remote objects under the prefix that are not present locally are scheduled for deletion.

Examples

>>> plan = build_workspace_sync_plan(
...     workspace_dir,
...     WorkspaceSpec(prefix="/audio/render"),
...     ["audio/render/old.tmp"],
... )
>>> plan.changed_object_count
1