The Symlink Tool comes with four
symlink types: best, latest, keep
and remove. You can add your own, for example
stalled for runs waiting on an input. A type you add is
recorded in the root folder itself, so every user of that root sees
it.
| Built-in type | is_singleton |
Symlink name in the root |
|---|---|---|
best |
TRUE |
best |
latest |
TRUE |
latest |
keep |
FALSE |
keep_<version_name> |
remove |
FALSE |
remove_<version_name> |
Build a tool on your root as usual, then add the type with one call:
slt <- SLT$new(root_list = list("model_root" = model_root))
slt$update_symlink_registry(
symlink_type = "stalled"
, is_singleton = FALSE
, operation = "add"
)
names(slt$get_symlink_registry())
#> [1] "best" "keep" "latest" "remove" "stalled"That is the only step. The type is recorded in the root, so it can be used by any later R session and any other user of the root.
| Argument | What to pass |
|---|---|
symlink_type |
The name of your type, in lowercase. It cannot be a built-in name. |
is_singleton |
TRUE or FALSE. See the next table. |
operation |
"add" for a type the root does not have yet.
"update" and "drop" are covered under Editing
the registry. |
Without a tool, update_symlink_disk_registry() does the
same for any root folder. It takes the same arguments, plus
root and verbose.
is_singletonis_singleton is the one decision a symlink type needs:
can one version hold the mark, or many?
is_singleton |
Symlink name in the root | Versions that can hold it | Built-in examples |
|---|---|---|---|
TRUE |
<type> |
one per root; marking another version moves it | best, latest |
FALSE |
<type>_<version_name> |
as many as you mark | keep, remove |
Once a type is added, its name is reserved in that way: a version
folder cannot be called stalled_anything.
Mark with it like any built-in type.
slt$make_new_version_folder("2025_01_01.01")
#> [1] "2025_01_01.01"
slt$make_new_version_folder("2025_01_01.02")
#> [1] "2025_01_01.02"
slt$mark("stalled", "2025_01_01.01", user_entry = list(comment = "waiting on inputs"))
slt$mark("stalled", "2025_01_01.02", user_entry = list(comment = "waiting on inputs"))
slt$roundup("stalled", return_as = "version_name")
#> [1] "2025_01_01.01" "2025_01_01.02"print_tree(model_root, level = 1)
#> |-- 2025_01_01.01
#> |-- 2025_01_01.02
#> |-- log_symlinks_central.csv
#> |-- report_key_versions.csv
#> |-- stalled_2025_01_01.01 -> /tmp/Rtmp3Nhm3U/slt_types_demo/model_root/2025_01_01.01
#> `-- stalled_2025_01_01.02 -> /tmp/Rtmp3Nhm3U/slt_types_demo/model_root/2025_01_01.02slt does not keep its own list of symlink types. At each
call it reads the registry file in its root, so a type a teammate adds
to the root is there at your next call.
The calls fall into two groups:
slt <- SLT$new(root_list = list("model_root" = model_root))
read-only calls write calls
--------------- -----------
SLT$new() slt$mark()
slt$roundup() slt$unmark()
slt$get_symlink_registry() slt$delete_version_folders()
any call above
|
v
slt reads model_root/.symlink_registry.csv
(no file yet: nothing to read, built-in types only)
|
v
slt's symlink types =
built-in types + user-defined types in the file (do not hand-edit)
|
v
which kind of call? --- read-only -------> the call runs.
| Nothing is written to model_root.
| A missing registry file is NOT created.
| - only built-in symlinks can be found when missing
| i.e. 'best', 'latest', 'keep', 'remove'
write
|
v
does model_root have no
a registry file? ------------------------> slt writes one, with the built-in
| types, then the call runs.
yes
|
v
the call runs
Building a tool and slt$roundup() never write to the
root, not even to create a missing registry file, so both work on a root
you can only read.
SUNSET NOTICE:
Most tools have one root. Support for several roots using one tool will likely be sunset in a future version, so prefer one tool per root for new work. Until then, a tool with several roots runs every safety check described here.
A tool built on several roots runs the same flow, with two checks
added. They are marked [+].
any call above
|
v
slt reads .symlink_registry.csv
in every root
(a root with no file yet: nothing to read)
|
v
[+] do two roots give one symlink yes
type a different is_singleton? ------> STOP, nothing changed.
| The error lists each root's
no is_singleton and the call to run.
|
v
slt's symlink types =
built-in types + user-defined types in any root's file (do not hand-edit)
|
v
which kind of call? --- read-only -------> the call runs.
| Nothing is written to any root.
| A missing registry file is NOT created.
| - only built-in symlinks can be found when
| every root's file is missing,
| i.e. 'best', 'latest', 'keep', 'remove'
write
|
v
does every root have no
a registry file? ------------------------> slt writes one in each root that
| lacks it, with the built-in types.
yes
|
v
[+] does every root's file no
list every type? --------------------> slt copies each missing row from
| a root that has it.
yes
|
v
the call runs
The first added check is the one that can stop you. The roots of one
tool must agree on each type’s is_singleton. If they do
not, the tool stops and prints the call that fixes it:
other_root <- file.path(demo_base, "other_root")
dir.create(other_root)
update_symlink_disk_registry(
root = other_root
, symlink_type = "stalled"
, is_singleton = TRUE
, operation = "add"
, verbose = FALSE
)
SLT$new(root_list = list("model_root" = model_root, "other_root" = other_root))
#> SUNSET NOTICE: several roots on one SLT will likely be sunset. Prefer one SLT per root.
#> Error in `read_disk_registries()`:
#> ! Root folders disagree on is_singleton for a symlink (shortcut) type:
#> stalled: is_singleton = TRUE in /tmp/Rtmp3Nhm3U/slt_types_demo/other_root
#> stalled: is_singleton = FALSE in /tmp/Rtmp3Nhm3U/slt_types_demo/model_root
#> Pick the roots to change and run, for each:
#> update_symlink_disk_registry(<root>, "<type>", is_singleton = <TRUE or FALSE>, operation = "update")
#> Nothing has been changed.
#> See vignette("user_defined_symlink_types", package = "vmTools") or ?update_symlink_disk_registryA root that simply lacks a type is not a disagreement. That is the second added check: the root gets the type from its sibling roots the next time the tool marks, unmarks or deletes.
This section is for changing a type later, or for reading an error.
slt$update_symlink_registry() edits every root of a tool;
update_symlink_disk_registry() edits the roots you name.
Both follow the same rules.
Each root carries one small file, .symlink_registry.csv,
with one row per symlink type. The built-in types are listed first. The
tool writes this file; it is not meant to be edited by hand, and a
hand-edited file is refused when it is read.
read.csv(file.path(model_root, ".symlink_registry.csv"))
#> symlink_type is_singleton is_builtin timestamp user vmtools_version
#> 1 best TRUE TRUE 2026_11_17_223514 USER 2.1.0
#> 2 keep FALSE TRUE 2026_11_17_223514 USER 2.1.0
#> 3 latest TRUE TRUE 2026_11_17_223514 USER 2.1.0
#> 4 remove FALSE TRUE 2026_11_17_223514 USER 2.1.0
#> 5 stalled FALSE FALSE 2026_11_17_223514 USER 2.1.0The tool only manages symlinks whose type is in this file. A symlink
of any other type is left alone, and slt$make_reports()
lists it in report_DISCREPANCIES.csv as “non-tool symlinks
in root folder”. Add the type with
slt$update_symlink_registry() to bring such symlinks back
into the tool’s understanding.
is_singleton, or drop a typeThe same function does both, with a different
operation:
# a type on file, with a different is_singleton
slt$update_symlink_registry(
"stalled"
, is_singleton = TRUE
, operation = "update"
)
# remove a type from the file
slt$update_symlink_registry(
"stalled"
, operation = "drop"
)What happens depends on the operation argument and on
the symlink type’s row in the root’s file:
absent: the file has no row for the symlink typematches: a row exists and its is_singleton
equals the argumentdiffers: a row exists and its is_singleton
is the other value| operation | state | action | note |
|---|---|---|---|
| add | absent | write | add done |
| add | matches | skip | already on file with this is_singleton; nothing changed |
| add | differs | stop | already on file with a different is_singleton; use operation = ‘update’ |
| update | absent | stop | not on file; use operation = ‘add’ |
| update | matches | skip | already on file with this is_singleton; nothing changed |
| update | differs | write | update done |
| drop | absent | skip | not on file; nothing to drop |
| drop | matches | write | drop done |
| drop | differs | write | drop done |
write changes the file, skip leaves it, and
stop refuses the whole call before any root’s file is
written.
An update or a drop is refused while
symlinks of that type exist. After the change they would belong to no
symlink type the tool knows.
slt$update_symlink_registry(symlink_type, is_singleton, operation)
|
v
in model_root/.symlink_registry.csv, the symlink type's row is
absent, matches is_singleton, or differs
|
v
is the operation refused?
add where the row differs yes
update where the row is absent ------> STOP, nothing written.
| The error names the root and
no the operation to use.
|
v
update or drop: do links of the yes
symlink type exist? ---------------------> STOP, nothing written.
| The error prints the unmark()
no calls to run first.
|
v
slt writes model_root/.symlink_registry.csv
(a file already as asked is left alone)
With several roots, every root is checked before any file is written. One refusal stops the whole call.
The two stalled symlinks made above block a change, and
the error tells you which unmark() calls to run before
repeating it:
slt$update_symlink_registry(
"stalled"
, is_singleton = TRUE
, operation = "update"
)
#> Error in `update_symlink_disk_registry()`:
#> ! Cannot update symlink (shortcut) type 'stalled': 2 live and 0 dangling link(s) of this type exist in 1 root(s).
#> Unmark them first (slt = a tool on these roots), then repeat this call. Nothing has been changed.
#>
#> for (v in slt$roundup("stalled", return_as = "version_name")) slt$unmark(v, user_entry = list(comment = "stalled: is_singleton changed"))
#> # repeat this call, then re-mark:
#> slt$mark("stalled", "<the one version to mark>", user_entry = list(comment = "stalled: is_singleton changed"))
#>
#> See vignette("user_defined_symlink_types", package = "vmTools") or ?update_symlink_disk_registry| The message says | What it means | What to do |
|---|---|---|
already on file with this is_singleton; nothing changed |
The root already has what you asked for. | Nothing. |
already on file with a different is_singleton; use operation = 'update' |
You used "add" for a type the root has, with a
different is_singleton. |
Repeat the call with operation = "update". |
not on file; use operation = 'add' |
You used "update" for a type the root does not
have. |
Repeat the call with operation = "add". |
live and ... dangling link(s) of this type exist |
Symlinks of the type are in the way. | Run the unmark() lines printed in the error, then
repeat the call. |
Root folders disagree on is_singleton for a symlink (shortcut) type |
Two roots record the same type differently. | Run the printed update_symlink_disk_registry() call on
the root you want to change. |
Built-in symlink (shortcut) types are fixed by the package |
You passed best, latest, keep
or remove. |
Choose another name. |
symlink_type must be lowercase |
The name has a capital letter. Windows and macOS compare names ignoring case. | Use the lowercase spelling the message suggests. |
See also ?update_symlink_disk_registry.