Class: DataPackageRecovery

DataPackageRecovery()

new DataPackageRecovery()

Repair a metadata document that resolves to no resource map after an upload commits the metadata but stops before writing its resource map. Exact replay is attempted first; server reconstruction is available only through explicit opt-in when recovery storage yields no local record: R1 (replay): resend the exact resource map bytes the interrupted upload had prepared, from a durable local recovery record. Includes any newly added files; device local. R2 (reconstruct): rebuild the resource map from server state by walking the metadata's `obsoletes` chain to the previous resource map. Device independent; may miss brand new files a lost record would have captured. Both preserve the resource map version chain by obsoleting the prior map, and are self healing: the DataONE server rejects a second object that would obsolete an already obsoleted map, so a map that actually committed is detected rather than duplicated. TODO: we should combine the EML local drafts feature with this class so that we can also recover from unsaved EML drafts.
Since:
  • 2.39.0
Source:

Methods

recover(metadataPid, optionsopt) → {Promise.<object>}

Attempt to recover an orphaned metadata document.
Parameters:
Name Type Attributes Description
metadataPid string Orphaned metadata PID (its latest version)
options object <optional>
Recovery options
Properties
Name Type Attributes Description
allowReconstruct boolean <optional>
Reconstruct from the prior server ResourceMap only when local storage yields no record after its read retry. Defaults to false
signal AbortSignal <optional>
Abort signal
maxConcurrent number <optional>
Maximum concurrent server reads
Source:
Returns:
Result: `{ recovered, resourceMapPid, strategy }` or `{ recovered: false, reason }`
Type
Promise.<object>

DataPackageRecovery(options)

new DataPackageRecovery(options)

Create a package recovery coordinator.
Parameters:
Name Type Description
options object Recovery configuration and injected collaborators
Properties
Name Type Attributes Description
resolveServiceUrl string Resolve service base URL passed to ResourceMap parsing
objectServiceUrl string <optional>
Object service base URL passed to ResourceMap parsing for configured endpoint identity checks
objectService ObjectService Object write service
sysMetaService SysMetaService System metadata service
versionTracker VersionTracker <optional>
Version tracker used to map prior members to their latest versions
resolver ResourceMapResolver <optional>
Resolver for the prior resource map and for caching a recovered mapping
recoveryStore UploadRecoveryStore <optional>
Durable record store
Source:
Throws:
When required recovery configuration is missing
Type
Error

Methods

recover(metadataPid, optionsopt) → {Promise.<object>}

Attempt to recover an orphaned metadata document.
Parameters:
Name Type Attributes Description
metadataPid string Orphaned metadata PID (its latest version)
options object <optional>
Recovery options
Properties
Name Type Attributes Description
allowReconstruct boolean <optional>
Reconstruct from the prior server ResourceMap only when local storage yields no record after its read retry. Defaults to false
signal AbortSignal <optional>
Abort signal
maxConcurrent number <optional>
Maximum concurrent server reads
Source:
Returns:
Result: `{ recovered, resourceMapPid, strategy }` or `{ recovered: false, reason }`
Type
Promise.<object>