Installation is easy with homebrew. I use mariadb which is a fork of mysql but either should work.
brew install mariadb
| var interval = 500 | |
| var maxLag = 70 | |
| var lag = 0 | |
| var decay = 3 | |
| var mark = [] | |
| var timer = null | |
| function tooslow() { | |
| return (lag > maxLag) && | |
| Math.random() < ((lag - maxLag) / maxLag) |
| /* This Source Code Form is subject to the terms of the Mozilla Public | |
| * License, v. 2.0. If a copy of the MPL was not distributed with this | |
| * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | |
| var test = require('tap').test | |
| var log = { trace: function() {} } | |
| var timestamp = Date.now() | |
| // increment timestamp by 500ms each time now is called | |
| function now() { return (timestamp += 500) } |
| var cluster = require('cluster') | |
| var Client = require('../../client') | |
| var origin = process.env.PICL_ORIGIN || 'http://127.0.0.1:9000' | |
| var password = 'foobar' | |
| var threads = 50 | |
| if (cluster.isMaster) { |
| /*/ | |
| # Notes | |
| All endpoints that use HAWK require tokens and the token must be read from the | |
| db to validate the request. Ideally all data required for an endpoint to do it's | |
| job can be read in the same db call. | |
| Different db implementations will have different data layouts. For example, SQL | |
| may use a join to get the keys for a keyFetchToken, while Cassandra will store |
| /* This Source Code Form is subject to the terms of the Mozilla Public | |
| * License, v. 2.0. If a copy of the MPL was not distributed with this | |
| * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | |
| var Domain = require('domain') | |
| var inherits = require('util').inherits | |
| var Logger = require('bunyan') | |
| function Overdrive(options) { | |
| Logger.call(this, options) |
| var smtp = require('simplesmtp') | |
| var net = require('net') | |
| var server = net.createServer( | |
| function (c) { | |
| console.log('connected') | |
| c.write('220 127.0.0.1\r\n') | |
| c.on('data', | |
| function (data) { | |
| console.log(data.toString()) |
| // To start a promise chain from a sync function wrap it with P(). | |
| // This is short-hand for creating a deferred and immediately resolving it. | |
| function getFiles(pth) { | |
| return P(shell.find(pth)) | |
| } | |
| // It's ok to put sync function in a promise chain | |
| function filterFolders(data) { | |
| return data.filter( | |
| function (file) { |
| var crypto = require('crypto') | |
| var salt = crypto.randomBytes(32).toString('hex') | |
| var wrapKb = crypto.randomBytes(32).toString('hex') | |
| var Client = require('../client') | |
| var c = new Client('http://localhost:9000') | |
| var email = 'me@example.com' | |
| var password = 'foobar' |