Skip to content
This repository has been archived by the owner on Oct 14, 2022. It is now read-only.

Commit

Permalink
Add configurable caching
Browse files Browse the repository at this point in the history
  • Loading branch information
pfrazee committed Nov 14, 2017
1 parent 8adc8a8 commit b3448a8
Show file tree
Hide file tree
Showing 6 changed files with 906 additions and 685 deletions.
6 changes: 6 additions & 0 deletions config.defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ jobs:
userDiskUsage: 5m
deleteDeadArchives: 5m

# cache settings
cache:
metadataStorage: 65536
contentStorage: 65536
tree: 65536

# monitoring
pm2: true
alerts:
Expand Down
7 changes: 6 additions & 1 deletion lib/archiver.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,12 @@ module.exports = class Archiver extends EventEmitter {
// load archive (inner) main load logic
async _loadArchiveInner (archivePath, key) {
// create the archive instance
var archive = hyperdrive(archivePath, key, {sparse: false})
var archive = hyperdrive(archivePath, key, {
sparse: false,
metadataStorageCacheSize: this.config.cache.metadataStorage,
contentStorageCacheSize: this.config.cache.contentStorage,
treeCacheSize: this.config.cache.tree
})
archive.isSwarming = false
archive.replicationStreams = [] // list of all active replication streams
Object.defineProperty(archive, 'numPeers', {get: () => archive.metadata.peers.length + 1})
Expand Down
Loading

0 comments on commit b3448a8

Please sign in to comment.