Skip to contents

Uses metadata-only API requests to identify years containing changed, added, or removed deliveries. Once one changed delivery is found, remaining deliveries in that year are skipped because the complete annual XML cache must be replaced. Cruise-series, gear, taxa, and coded-field reference tables are refreshed on every run. If the database schema is incompatible with this package version, a complete sibling database is built with compileDatabase and safely swapped into place.

Usage

updateDatabase(
  years = NULL,
  dbPath = .existingDbPath(dbName),
  dbIndexFile = file.path(dbPath, "dbIndex.rda"),
  dbName = NULL,
  verbose = FALSE,
  metadata_workers = 8L
)

Arguments

years

Optional integer vector limiting metadata checks and incremental replacements. A schema compatibility rebuild always includes all years.

dbPath

Character string specifying the folder that holds the duckdb file. Defaults to the folder of the database that findDatabase() locates, so a database in a legacy location (directly in the home directory) is updated in place. If no database is found, defaultDbPath() is used and the database is compiled there.

dbIndexFile

Character string specifying the file path where the index of the database should be saved. Must include .rda at the end. Defaults to dbIndex.rda inside dbPath. The index is used by BioticExplorer.

dbName

Character string or NULL. If NULL uses the default name ("bioticexplorer").

verbose

Logical; emit one metadata-check message per delivery. The default uses a progress bar in interactive sessions and bounded milestone messages in non-interactive logs.

metadata_workers

Positive integer controlling the maximum number of concurrent delivery-discovery and metadata requests. Database writes remain serial and transactional. Use 1 to disable parallel API checks.

Value

Invisibly returns a list describing the update mode and changed years.