Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
DragnetConfig.prototype.datasourceList = function (func)
{
mod_jsprim.forEachKey(this.dc_datasources, func);
};
function copy(source) {
mod_jsprim.forEachKey(source, function (key, value) {
options[key] = value;
});
}
IndexSink.prototype.doCreateTable = function (tablename, columns, callback)
{
var sql = '';
var collines;
sql = 'CREATE TABLE ' + tablename + '(\n';
collines = [];
mod_jsprim.forEachKey(columns, function (key, value) {
collines.push(' ' + key + ' ' + value);
});
sql += collines.join(',\n');
sql += '\n);';
this.is_log.debug({
'table': tablename,
'columns': Object.keys(columns)
}, 'create table');
this.is_db.exec(sql, callback);
};
DragnetConfig.prototype.datasourceListMetrics = function (dsname, func)
{
mod_assertplus.ok(this.dc_datasources.hasOwnProperty(dsname));
if (!this.dc_metrics.hasOwnProperty(dsname))
return;
mod_jsprim.forEachKey(this.dc_metrics[dsname], func);
};
var stream = this;
var level;
switch (chunk.level) {
case mod_bunyan.TRACE: level = 'TRACE'; break;
case mod_bunyan.DEBUG: level = 'DEBUG'; break;
case mod_bunyan.INFO: level = 'INFO'; break;
case mod_bunyan.WARN: level = 'WARN'; break;
case mod_bunyan.ERROR: level = 'ERROR'; break;
case mod_bunyan.FATAL: level = 'FATAL'; break;
default: level = '?????'; break;
}
this.push(sprintf('[%5s] %s: %s\n', level, component, message));
mod_jsprim.forEachKey(chunk, function (key, value) {
if (bunyanStdKeys.hasOwnProperty(key))
return;
stream.push(sprintf(' %10s: %j\n', key, value));
});
callback();
};
'm_breakdowns': metconfig.breakdowns.map(function (b) {
var rv = {};
mod_jsprim.forEachKey(b, function (k, v) {
rv['b_' + k] = v;
});
return (rv);
})
});
function zfsCreate(opts, callback) {
mod_assert.object(opts, 'opts');
mod_assert.object(opts.log, 'opts.log');
mod_assert.string(opts.dataset, 'opts.dataset');
mod_assert.optionalObject(opts.props, 'opts.props');
mod_assert.func(callback, 'callback');
var args = [ 'create' ];
if (opts.props) {
mod_jsprim.forEachKey(opts.props, function (prop, val) {
args.push('-o', prop + '=' + val);
});
}
args.push(opts.dataset);
opts.log.info('create ZFS dataset "%s"', opts.dataset);
zfsExecCommon(opts.log, args, function (err, info) {
if (err) {
callback(new VE(err, 'create dataset "%s"', opts.dataset));
return;
}
callback();
});
}
function createPredicate(pred, types)
{
krillPrimValidateSyntax(pred);
if (arguments.length >= 2 && types !== null) {
mod_jsprim.forEachKey(types, function (k, v) {
if (v !== 'string' && v !== 'number' && v !== 'boolean')
throw (new VError(
'field "%s": unknown type "%s"', k, v));
});
krillPrimValidateTypes(types, pred);
}
return (new Predicate(mod_jsprim.deepCopy(pred), types));
}