Save and pin a version
Save a checked snapshot
Continue with orders and next_delivery from the previous chapters. RDS gives you local versioned releases without a database engine.
folder <- tempfile("dataraft-rds-")
saved <- dr_publish(orders, data = next_delivery,
to = dataraft.adapters::dr_target_rds(folder))
reference <- saved$outputs$version
Read the exact version
restored <- dataraft.core::dr_read_source(
dataraft.adapters::dr_source_rds(folder, version = reference)
)
stopifnot(sum(restored$amount) == 150)
Keep the version reference with your reporting inputs. Reading “latest” later is a different reproducibility choice from reading the saved version.
Choose storage deliberately
RDS retains existing versions, coordinates cooperating local writers and renames a completed staging directory into place. It is not a distributed lock service or a transaction across multiple tables. Network filesystems need suitable directory and rename semantics.
For a shared lake, explore dataraft.lake. DuckDB and DuckLake have different operational requirements. The generic execution path materializes output for checking, so plan for memory proportional to that output.
# Only remove the temporary tutorial output when you are finished.
unlink(folder, recursive = TRUE)