-
Notifications
You must be signed in to change notification settings - Fork 4
feat: allow overriding of internal functions #48
Conversation
The interesting bits of this module are the various ways of building DAGs for files and folders (flat, sharded, etc). Sometimes we want to utilise bits of this logic to build DAGs without having to reimplement big chunks of this module. This PR allows the user to pass in functions to replace key parts of this import pipeline. Enables: * ipfs-inactive/js-ipfs-mfs#73 * #46
@mikeal I think this should allow you to accomplish #45 and #46 - see the tests here largely 'inspired' by the tests added to those PRs. It does it in a way that lets me do ipfs-inactive/js-ipfs-mfs#73 using the same mechanism. |
I pulled down the branch and wrote what I need against it and can say for certain that it works and does what I need. +1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM
@@ -145,8 +146,28 @@ The input's file paths and directory structure will be preserved in the [`dag-pb | |||
- `blockWriteConcurrency` (positive integer, defaults to 10) How many blocks to hash and write to the block store concurrently. For small numbers of large files this should be high (e.g. 50). | |||
- `fileImportConcurrency` (number, defaults to 50) How many files to import concurrently. For large numbers of small files this should be high (e.g. 50). | |||
|
|||
## Overriding internals | |||
|
|||
Several aspects of the importer are overridable by specifying functions as part of the options object with these keys: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be useful to know the role of each of these in addition to their signature and return type. It’s great that they can be overridden but I don’t see why/how a user can use it without knowing what part these functions play in the import process.
Released as |
The interesting bits of this module are the various ways of building DAGs for files and folders (flat, sharded, etc).
Sometimes we want to utilise bits of this logic to build DAGs without having to reimplement big chunks of this module.
This PR allows the user to pass in functions to replace key parts of this import pipeline.
Enables: