|
|
@ -49,6 +49,7 @@ class Persistence { |
|
|
|
* @param {object} [options.modes] Modes to use for FS permissions. Will not work on Windows. |
|
|
|
* @param {object} [options.modes] Modes to use for FS permissions. Will not work on Windows. |
|
|
|
* @param {number} [options.modes.fileMode=0o644] Mode to use for files. |
|
|
|
* @param {number} [options.modes.fileMode=0o644] Mode to use for files. |
|
|
|
* @param {number} [options.modes.dirMode=0o755] Mode to use for directories. |
|
|
|
* @param {number} [options.modes.dirMode=0o755] Mode to use for directories. |
|
|
|
|
|
|
|
* @param {boolean} [options.testSerializationHooks=true] Whether to test the serialization hooks or not, might be CPU-intensive |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
constructor (options) { |
|
|
|
constructor (options) { |
|
|
|
this.db = options.db |
|
|
|
this.db = options.db |
|
|
@ -77,6 +78,7 @@ class Persistence { |
|
|
|
this.afterSerialization = options.afterSerialization || (s => s) |
|
|
|
this.afterSerialization = options.afterSerialization || (s => s) |
|
|
|
this.beforeDeserialization = options.beforeDeserialization || (s => s) |
|
|
|
this.beforeDeserialization = options.beforeDeserialization || (s => s) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (options.testSerializationHooks === undefined || options.testSerializationHooks) { |
|
|
|
for (let i = 1; i < 30; i += 1) { |
|
|
|
for (let i = 1; i < 30; i += 1) { |
|
|
|
for (let j = 0; j < 10; j += 1) { |
|
|
|
for (let j = 0; j < 10; j += 1) { |
|
|
|
const randomString = customUtils.uid(i) |
|
|
|
const randomString = customUtils.uid(i) |
|
|
@ -86,6 +88,7 @@ class Persistence { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Internal version without using the {@link Datastore#executor} of {@link Datastore#compactDatafileAsync}, use it instead. |
|
|
|
* Internal version without using the {@link Datastore#executor} of {@link Datastore#compactDatafileAsync}, use it instead. |
|
|
|