Write a plan, preview or approval as a batch file
zotWriteBatch.RdPersists a guarded-flow object as JSON so that planning, approval and
execution can happen in separate processes. The file carries a kind
("zotPlan", "zotPreview" or "zotApproval") and the fields of the
corresponding object; a preview stores its rows together with its digest.
Arguments
- x
A plan (a data.table with
action,library,itemKeyandpayload), azotPreview()or azotApprove()record.- path
Destination file.
Details
The file is written to a temporary sibling and renamed into place, so a
reader never observes a partially written batch file. An existing file at
path is replaced. Ledgers are written by zotExecute(), not here.
Examples
Plan <- data.table::data.table(
action = "patch", library = "user", itemKey = "ABCD1234",
payload = list(list(title = "A reviewed title"))
)
Path <- tempfile(fileext = ".json")
zotWriteBatch(Plan, Path)
zotReadBatch(Path)
#> action library itemKey payload
#> <char> <char> <char> <list>
#> 1: patch user ABCD1234 <list[1]>
unlink(Path)