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:
- 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>