This repository was archived by the owner on Feb 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: preload content #1464
Merged
Merged
feat: preload content #1464
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
dca3749
feat: preload content
alanshaw f5b5854
test: add preload tests for ipfs.files.add and make fixes
alanshaw 332ef98
refactor: only create new CID if not already stringy
alanshaw e6d22d1
chore: appease the linters
alanshaw 2f958b9
chore: more linter changes
alanshaw 557c8da
refactor: switch to /api/v0/refs
alanshaw 1cdd724
fix: many fixes
alanshaw f62bae1
fix: remove .only
alanshaw ac9d246
fix: fallback in order
alanshaw 89502aa
fix: start/stop fix and add preload request time logging
alanshaw 7c73142
fix: bootstrap default list in tests
alanshaw 3aa2a1d
fix: more fix bootstrap tests
alanshaw ecf1cc3
fix: more config fix
alanshaw 977a074
feat: preload mfs root preiodically and preload dag.put
alanshaw ef4616a
fix: do not monitor if stopped while starting
alanshaw 9a4b5e0
feat: async mfs-preload start and stop
alanshaw eb7e01f
feat: preload object.* API
alanshaw fa1c9f3
feat: preload block.put
alanshaw 787d1dd
chore: remove .only
alanshaw d49f17e
test: add dag.put preload test
alanshaw 9df1012
fix: ensure MFS is continually preloaded
alanshaw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,4 +26,4 @@ exports.dht = require('./dht') | |
exports.dns = require('./dns') | ||
exports.key = require('./key') | ||
exports.stats = require('./stats') | ||
exports.mfs = require('ipfs-mfs/core') | ||
exports.mfs = require('./mfs') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
'use strict' | ||
|
||
const promisify = require('promisify-es6') | ||
const mfs = require('ipfs-mfs/core') | ||
|
||
module.exports = self => { | ||
const mfsSelf = Object.assign({}, self) | ||
|
||
// A patched dag API to ensure preload doesn't happen for MFS operations | ||
mfsSelf.dag = Object.assign({}, self.dag, { | ||
put: promisify((node, opts, cb) => { | ||
if (typeof opts === 'function') { | ||
cb = opts | ||
opts = {} | ||
} | ||
|
||
opts = Object.assign({}, opts, { preload: false }) | ||
|
||
return self.dag.put(node, opts, cb) | ||
}) | ||
}) | ||
|
||
return mfs(mfsSelf, mfsSelf._options) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,10 @@ const schema = Joi.object().keys({ | |
Joi.string() | ||
).allow(null), | ||
repoOwner: Joi.boolean().default(true), | ||
preload: Joi.object().keys({ | ||
enabled: Joi.boolean().default(true), | ||
addresses: Joi.array().items(Joi.multiaddr().options({ convert: false })) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we require at least one entry here? |
||
}).allow(null), | ||
init: Joi.alternatives().try( | ||
Joi.boolean(), | ||
Joi.object().keys({ bits: Joi.number().integer() }) | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We will later need to over all the config values to the Config object like we did for js-libp2p.