Aliases let you work with multiple, independent stamp folders in a single R session. An alias is a selector for which folder configuration to use; it does not change any on-disk paths. All artifact paths remain the same regardless of alias; aliases select the folder configuration for the catalog and versions, not the session options.
Storage model (v0.0.9+): Artifacts are stored as
<root>/<path>/<filename>/<filename>
with version history in
<root>/<path>/<filename>/versions/. The
.stamp/ directory within each aliased root contains only
state (catalog, locks, temp files).
Key properties:
st_init()."default" exists and can be re-based
with st_switch().Initialize one or more stamp folders and give each an alias:
root_a <- tempfile("projA-")
root_b <- tempfile("projB-")
alias_a <- basename(root_a)
alias_b <- basename(root_b)
# Note: st_init() creates the folder if missing
st_init(root_a, alias = alias_a)
#> ✔ stamp initialized
#> alias: projA-b5646bad3c
#> root: /tmp/RtmpCXgvOI/projA-b5646bad3c
#> state: /tmp/RtmpCXgvOI/projA-b5646bad3c/.stamp
st_init(root_b, alias = alias_b)
#> ✔ stamp initialized
#> alias: projB-b566066d2ff
#> root: /tmp/RtmpCXgvOI/projB-b566066d2ff
#> state: /tmp/RtmpCXgvOI/projB-b566066d2ff/.stamp
# Inspect what was created
fs::dir_tree(fs::path(root_a, ".stamp"), recurse = TRUE, all = TRUE)
#> /tmp/RtmpCXgvOI/projA-b5646bad3c/.stamp
#> ├── logs
#> └── temp
fs::dir_tree(fs::path(root_b, ".stamp"), recurse = TRUE, all = TRUE)
#> /tmp/RtmpCXgvOI/projB-b566066d2ff/.stamp
#> ├── logs
#> └── tempYou can inspect registered aliases:
st_alias_list()
#> alias root
#> 1 stamp-request-b5632cd1dc8 /tmp/RtmpCXgvOI/stamp-request-b5632cd1dc8
#> 2 projB-b566066d2ff /tmp/RtmpCXgvOI/projB-b566066d2ff
#> 3 default /tmp/RtmpCXgvOI/stamp-hashing-b56711b2d8
#> 4 stamp-metadata-b565babe4d8 /tmp/RtmpCXgvOI/stamp-metadata-b565babe4d8
#> 5 projA-b5646bad3c /tmp/RtmpCXgvOI/projA-b5646bad3c
#> state_dir stamp_path
#> 1 .stamp /tmp/RtmpCXgvOI/stamp-request-b5632cd1dc8/.stamp
#> 2 .stamp /tmp/RtmpCXgvOI/projB-b566066d2ff/.stamp
#> 3 .stamp /tmp/RtmpCXgvOI/stamp-hashing-b56711b2d8/.stamp
#> 4 .stamp /tmp/RtmpCXgvOI/stamp-metadata-b565babe4d8/.stamp
#> 5 .stamp /tmp/RtmpCXgvOI/projA-b5646bad3c/.stamp
# Get alias details
st_alias_get(alias_a)
#> $root
#> /tmp/RtmpCXgvOI/projA-b5646bad3c
#>
#> $state_dir
#> [1] ".stamp"
#>
#> $stamp_path
#> /tmp/RtmpCXgvOI/projA-b5646bad3c/.stampUse the same artifact path patterns; pass alias to
select which catalog/versions apply:
pA <- fs::path(root_a, "data.qs")
pB <- fs::path(root_b, "data.qs")
# Save different data to A and B to ensure versions are created
st_save(data.frame(id = 1:2), pA, alias = alias_a)
#> ✔ Saved [qs2] → '/tmp/RtmpCXgvOI/projA-b5646bad3c/data.qs' @ version
#> ac1d3eb3d2156bbd
st_save(data.frame(id = 3:4), pB, alias = alias_b)
#> ✔ Saved [qs2] → '/tmp/RtmpCXgvOI/projB-b566066d2ff/data.qs' @ version
#> d6f6c2c39143727d
# Each alias has its own version history
st_versions(pA, alias = alias_a)
st_versions(pB, alias = alias_b)
# Loading respects the alias
objA <- st_load(pA, alias = alias_a)
#> Warning: No primary key recorded for '/tmp/RtmpCXgvOI/projA-b5646bad3c/data.qs'.
#> ℹ You can add one with `st_add_pk()`.
#> ✔ Loaded [qs2] ← '/tmp/RtmpCXgvOI/projA-b5646bad3c/data.qs'
objB <- st_load(pB, alias = alias_b)
#> Warning: No primary key recorded for '/tmp/RtmpCXgvOI/projB-b566066d2ff/data.qs'.
#> ℹ You can add one with `st_add_pk()`.
#> ✔ Loaded [qs2] ← '/tmp/RtmpCXgvOI/projB-b566066d2ff/data.qs'
list(A = objA, B = objB)
#> $A
#> id
#> 1 1
#> 2 2
#>
#> $B
#> id
#> 1 3
#> 2 4
# Inspect what was created within the stamp folders
# Note: Artifacts are stored as <root>/<path>/<filename>/<filename>
# with versions in <root>/<path>/<filename>/versions/
cat("\nStructure in root_a:\n")
#>
#> Structure in root_a:
fs::dir_tree(root_a, recurse = 2)
#> /tmp/RtmpCXgvOI/projA-b5646bad3c
#> └── data.qs
#> ├── data.qs
#> ├── data.qs.lock
#> ├── stmeta
#> │ └── data.qs.stmeta.json
#> └── versions
#> └── ac1d3eb3d2156bbd
cat("\nStructure in root_b:\n")
#>
#> Structure in root_b:
fs::dir_tree(root_b, recurse = 2)
#> /tmp/RtmpCXgvOI/projB-b566066d2ff
#> └── data.qs
#> ├── data.qs
#> ├── data.qs.lock
#> ├── stmeta
#> │ └── data.qs.stmeta.json
#> └── versions
#> └── d6f6c2c39143727dVersion resolution is non-interactive. NULL or
0 resolve to the latest version:
# Load latest (using default version = NULL for latest)
latestA <- st_load(pA, alias = alias_a)
#> Warning: No primary key recorded for '/tmp/RtmpCXgvOI/projA-b5646bad3c/data.qs'.
#> ℹ You can add one with `st_add_pk()`.
#> ✔ Loaded [qs2] ← '/tmp/RtmpCXgvOI/projA-b5646bad3c/data.qs'
latestB <- st_load(pB, alias = alias_b)
#> Warning: No primary key recorded for '/tmp/RtmpCXgvOI/projB-b566066d2ff/data.qs'.
#> ℹ You can add one with `st_add_pk()`.
#> ✔ Loaded [qs2] ← '/tmp/RtmpCXgvOI/projB-b566066d2ff/data.qs'
list(latestA = latestA, latestB = latestB)
#> $latestA
#> id
#> 1 1
#> 2 2
#>
#> $latestB
#> id
#> 1 3
#> 2 4The special alias "default" exists for backward
compatibility. You can re-base it to point at any initialized folder and
keep legacy state in sync:
st_init()._, -).A, B, or project
codes) and avoid reassigning them.st_switch() sparingly; explicit
alias = in calls is clearer in shared code.0 for latest.version = 0 or
NULL; loading without version loads the
current version by default.stamp maintains a catalog with an index for
lineage (parents_index) to make reverse lookups fast.
Aliases do not change filesystem layout; they only select which catalog
is used.st_opts(); aliases
select folders, not option sets..stamp/ - state only (catalog, locks, temp)<path>/<filename>/ - artifact directories
containing:
<filename> - the actual filestmeta/ - sidecar metadataversions/ - version history for that specific
artifact