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), unfinished (plan ids without a done entry), and complete (all plan rows done and none of the checked rows unconfirmed). Completeness does not turn a sample into a full read-back.

Details

By default at most ten completed patch rows are sampled and create, attach 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, an attach row compares the MD5, filename, content type and parent of the attachment, 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 ledger entries. Missing plan rows are counted as "pending". Schema and legacy identity checks are the same as zotExecute().

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(schema = 2L, digest = Preview$digest,
       items = list(`user:K1` = list(status = "done"))),
  class = "zotLedger"
)
zotVerify(Config, Preview, Ledger)
#> $counts
#> Statuses
#> done 
#>    1 
#> 
#> $sampleChecked
#> [1] 1
#> 
#> $sampleConfirmed
#> [1] 1
#> 
#> $unconfirmed
#> character(0)
#> 
#> $unfinished
#> character(0)
#> 
#> $complete
#> [1] TRUE
#>