Skip to contents

Summarizes item statuses and re-reads completed rows: a bounded sample of patches by default, or every completed row when full is TRUE.

Usage

zotVerify(config, preview, ledger, full = FALSE)

Arguments

config

A zotConfig() object.

preview

The executed zotPreview().

ledger

The zotExecute() ledger.

full

Re-read every completed row instead of sampling patches.

Value

A list: counts by status, sampleChecked, sampleConfirmed and unconfirmed (the ledger ids that did not confirm).

Details

By default at most ten completed patch rows are sampled and create and Trash rows are not included. With full = TRUE every completed row is re-read: a patch and a create compare the payload fields against the current record, and a Trash row confirms deleted. A created item is resolved through the key its ledger entry recorded. Rows whose current state does not confirm the plan are listed in unconfirmed; the result does not replace inspection of failed or missing ledger entries.

See also

Examples

Performer <- function(config, method, path, query, body, version) {
  list(
    status = 200L, headers = list(),
    body = list(version = 2L, data = list(title = "After"))
  )
}
Config <- structure(
  list(userID = "42", key = "example", apiBase = "https://example.invalid",
       performer = Performer),
  class = "zotConfig"
)
Plan <- data.table::data.table(
  action = "patch", library = "user", itemKey = "K1",
  payload = list(list(title = "After"))
)
Preview <- zotPreview(Plan, describe = "Synthetic verified patch")
Ledger <- structure(
  list(items = list(K1 = list(status = "done"))),
  class = "zotLedger"
)
zotVerify(Config, Preview, Ledger)
#> $counts
#> Statuses
#> done 
#>    1 
#> 
#> $sampleChecked
#> [1] 1
#> 
#> $sampleConfirmed
#> [1] 1
#> 
#> $unconfirmed
#> character(0)
#>