replace pinned.js with low-profile streaming implementation
This commit is contained in:
parent
609eddc9e1
commit
3dc789cbca
|
@ -9,7 +9,6 @@ const Nacl = require("tweetnacl/nacl-fast");
|
||||||
const Util = require("../common-util");
|
const Util = require("../common-util");
|
||||||
const nThen = require("nthen");
|
const nThen = require("nthen");
|
||||||
const Saferphore = require("saferphore");
|
const Saferphore = require("saferphore");
|
||||||
const Pinned = require('../../scripts/pinned');
|
|
||||||
|
|
||||||
//const escapeKeyCharacters = Util.escapeKeyCharacters;
|
//const escapeKeyCharacters = Util.escapeKeyCharacters;
|
||||||
const unescapeKeyCharacters = Util.unescapeKeyCharacters;
|
const unescapeKeyCharacters = Util.unescapeKeyCharacters;
|
||||||
|
@ -432,7 +431,7 @@ Pinning.getDeletedPads = function (Env, channels, cb) {
|
||||||
|
|
||||||
// inform that the
|
// inform that the
|
||||||
Pinning.loadChannelPins = function (Env) {
|
Pinning.loadChannelPins = function (Env) {
|
||||||
Pinned.load(function (err, data) {
|
Pins.list(function (err, data) {
|
||||||
if (err) {
|
if (err) {
|
||||||
Env.Log.error("LOAD_CHANNEL_PINS", err);
|
Env.Log.error("LOAD_CHANNEL_PINS", err);
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
/* jshint esversion: 6, node: true */
|
/* jshint esversion: 6, node: true */
|
||||||
const Fs = require('fs');
|
const Fs = require('fs');
|
||||||
const nThen = require('nthen');
|
const nThen = require('nthen');
|
||||||
const Pinned = require('./pinned');
|
|
||||||
const Nacl = require('tweetnacl/nacl-fast');
|
const Nacl = require('tweetnacl/nacl-fast');
|
||||||
const Path = require('path');
|
const Path = require('path');
|
||||||
const Pins = require('../lib/pins');
|
const Pins = require('../lib/pins');
|
||||||
|
@ -41,7 +40,7 @@ nThen((waitFor) => {
|
||||||
pinned = Pins.calculateFromLog(content.toString('utf8'), f);
|
pinned = Pins.calculateFromLog(content.toString('utf8'), f);
|
||||||
}));
|
}));
|
||||||
}).nThen((waitFor) => {
|
}).nThen((waitFor) => {
|
||||||
Pinned.load(waitFor((err, d) => {
|
Pins.list(waitFor((err, d) => {
|
||||||
data = Object.keys(d);
|
data = Object.keys(d);
|
||||||
}), {
|
}), {
|
||||||
exclude: [edPublic + '.ndjson']
|
exclude: [edPublic + '.ndjson']
|
||||||
|
|
|
@ -2,7 +2,7 @@ var nThen = require("nthen");
|
||||||
|
|
||||||
var Store = require("../storage/file");
|
var Store = require("../storage/file");
|
||||||
var BlobStore = require("../storage/blob");
|
var BlobStore = require("../storage/blob");
|
||||||
var Pinned = require("./pinned");
|
var Pins = require("../lib/pins");
|
||||||
var config = require("../lib/load-config");
|
var config = require("../lib/load-config");
|
||||||
|
|
||||||
// the administrator should have set an 'inactiveTime' in their config
|
// the administrator should have set an 'inactiveTime' in their config
|
||||||
|
@ -38,7 +38,7 @@ nThen(function (w) {
|
||||||
store = _;
|
store = _;
|
||||||
})); // load the list of pinned files so you know which files
|
})); // load the list of pinned files so you know which files
|
||||||
// should not be archived or deleted
|
// should not be archived or deleted
|
||||||
Pinned.load(w(function (err, _) {
|
Pins.list(w(function (err, _) {
|
||||||
if (err) {
|
if (err) {
|
||||||
w.abort();
|
w.abort();
|
||||||
return void console.error(err);
|
return void console.error(err);
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
/*jshint esversion: 6 */
|
||||||
|
const Pins = require("../../lib/pins");
|
||||||
|
|
||||||
|
var stats = {
|
||||||
|
users: 0,
|
||||||
|
lines: 0,
|
||||||
|
pinned: 0,
|
||||||
|
events: 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
Pins.list(function (err, pinned) {
|
||||||
|
for (var id in pinned) {
|
||||||
|
console.log(id);
|
||||||
|
stats.pinned++;
|
||||||
|
}
|
||||||
|
console.log(stats);
|
||||||
|
}, {
|
||||||
|
pinPath: require("../../lib/load-config").pinPath
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
function (ref, safeKey, pinned) {
|
||||||
|
stats.users++;
|
||||||
|
stats.lines += ref.index;
|
||||||
|
|
||||||
|
Object.keys(ref.pins).forEach(function (id) {
|
||||||
|
if (!pinned[id]) {
|
||||||
|
pinned[id] = true;
|
||||||
|
stats.pinned++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//console.log("pin", stats.events++);
|
||||||
|
//console.log(ref, safeKey);
|
||||||
|
}*/
|
Loading…
Reference in New Issue