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
prefixdefines 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.
- 参数:
workspace_dir (Path)
workspace_spec (WorkspaceSpec)
- 返回类型:
参见
workspace_upload_filesDiscover local files selected for upload.
workspace_delete_object_pathsDiscover remote objects selected for deletion.
WorkspaceSyncPlanReturn 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