HashDownloadPipeline
HashDownloadPipeline is an abstract extension of DownloadPipeline designed to handle downloads using hash-based storage adapters (HashStorageAdapter).
It orchestrates the process of scanning directories, computing deltas with DeltaService, downloading missing chunks, and reconstructing files.
This pipeline is commonly used when downloading from storage systems where chunks are identified by their hash.
Constructor
| Parameter | Type | Description |
|---|---|---|
storage | HashStorageAdapter | Hash based storage adapter that will be used (automatically created by client). |
delta | DeltaService | DeltaService used for generate rd-index, comparing rd-index, etc. |
reconstruction | ReconstructionService | ReconstructionService used for local file reconstruction. |
validation | ValidationService | ValidationService used for file validation after reconstruction. |
config | RacDeltaConfig | Base client configuration. |
Methods
| Method | Returns | Description |
|---|---|---|
execute(localDir, strategy, remoteIndex?, options?) | Promise<void> | Performs a full download process for a directory. |
downloadAllMissingChunks(plan, target, options?) | Promise<ChunkSource> | This method will download first all needed chunks, and save them temporary on disk or memory. |
Method details
execute(localDir, strategy, remoteIndex?, options?)
Performs a full download process for a directory.
Parameters
| Name | Type | Description |
|---|---|---|
localDir | string | Directory where the new update will be downloaded. |
strategy | UpdateStrategy | Strategy used for downloading and reconstruction. See UpdateStrategy |
remoteIndex | RDIndex | Optional remote rd-index. If none provided, will try to download from storage. |
options | DownloadOptions | Options for the download process. See DownloadOptions |
Returns
Promise<void>
downloadAllMissingChunks(plan, target, options?)
This method will download first all needed chunks for download, and save them temporary on disk or memory.
Will return ChunkSource, ChunkSources will be needed to reconstruct files, this method will ONLY return
memory or disk chunk sources for offline reconstruction, if you use a storage like S3, you can omit this
and use directly the StorageChunkSource with reconstruction.reconstructAll() if you prefer.
(Using StorageChunkSource will download chunks and reconstruct file at same time, concurrently)
Parameters
| Name | Type | Description |
|---|---|---|
plan | DeltaPlan | The DeltaPlan generated by delta.compare of the two rd-index.json for the download. |
target | 'memory' | 'disk' | Target of the resulting ChunkSource. |
options | DownloadOptions | Options for the download process. See DownloadOptions |
Returns
Promise<ChunkSource>