Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
feat: allow controlling preload from cli and http api (#2384)
Browse files Browse the repository at this point in the history
  • Loading branch information
achingbrain authored and Alan Shaw committed Aug 23, 2019
1 parent beb2bd2 commit 5878a0a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/cli/commands/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ module.exports = {
type: 'boolean',
default: true,
describe: 'Pin this object when adding'
},
preload: {
type: 'boolean',
default: true,
describe: 'Preload this object when adding'
}
},

Expand All @@ -166,7 +171,8 @@ module.exports = {
hashAlg: argv.hash,
wrapWithDirectory: argv.wrapWithDirectory,
pin: argv.pin,
chunker: argv.chunker
chunker: argv.chunker,
preload: argv.preload
}

if (options.enableShardingExperiment && argv.isDaemonOn()) {
Expand Down
6 changes: 4 additions & 2 deletions src/http/api/resources/files-regular.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ exports.add = {
pin: Joi.boolean().default(true),
'wrap-with-directory': Joi.boolean(),
chunker: Joi.string(),
trickle: Joi.boolean()
trickle: Joi.boolean(),
preload: Joi.boolean().default(true)
})
// TODO: Necessary until validate "recursive", "stream-channels" etc.
.options({ allowUnknown: true })
Expand Down Expand Up @@ -220,7 +221,8 @@ exports.add = {
wrapWithDirectory: request.query['wrap-with-directory'],
pin: request.query.pin,
chunker: request.query.chunker,
strategy: request.query.trickle ? 'trickle' : 'balanced'
strategy: request.query.trickle ? 'trickle' : 'balanced',
preload: request.query.preload
}

const aborter = abortable()
Expand Down

0 comments on commit 5878a0a

Please sign in to comment.