Documentation
¶
Overview ¶
Package snapshot restores a workspace's mount contents on the agent side from a container snapshot, pulling the volumes blob directly from the registry (see pkg/snapshot) rather than via a new RPC.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RestoreVolumes ¶
func RestoreVolumes( ctx context.Context, snapshotRef string, mounts []*config.Mount, reset bool, ) error
RestoreVolumes pulls the volumes blob referenced by the snapshot at snapshotRef and extracts it into the single mount's target.
The combined volumes archive is built by tunnelserver.appendDirToTar with every entry prefixed by the CREATE-time mount's target path (leading "/" trimmed, recorded as manifest.Annotations[AnnotationMountPrefix]). Strip depth is derived from that recorded prefix, not from the restore-side mount target's own path: the two are not guaranteed to have the same number of path segments (different provider defaults, different workspace-folder conventions), and deriving it from the wrong side would strip the wrong number of components and corrupt extracted paths.
Only a single mount is supported today: the combined tar has no way here to disambiguate which entries belong to which mount when there is more than one, so restoring mounts[0] alone would silently drop the rest. Multi-mount restore is tracked as follow-up work; snapshot create already rejects multi-mount workspaces up front so this case should not arise from a snapshot this codebase created.
extract.Extract only ever writes/overwrites entries present in the tar; it never deletes anything already at the target that the tar doesn't mention. So when reset is true, the target's existing contents are removed first, giving --reset its expected meaning: the workspace ends up in exactly the snapshot's state, not the snapshot's state merged with whatever was there.
Types ¶
This section is empty.