From 7681f9e1eca3cfff8f54e088c36df6f06366aa48 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Thu, 22 Oct 2020 10:04:52 +0200 Subject: [PATCH] jsl data source - renamed private methods --- .../api/src/utility/JsonLinesDatastore.js | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/api/src/utility/JsonLinesDatastore.js b/packages/api/src/utility/JsonLinesDatastore.js index 95e6845d..f3fa048b 100644 --- a/packages/api/src/utility/JsonLinesDatastore.js +++ b/packages/api/src/utility/JsonLinesDatastore.js @@ -11,7 +11,7 @@ class JsonLinesDatastore { this.notifyChangedCallback = null; } - closeReader() { + _closeReader() { if (!this.reader) return; const reader = this.reader; this.reader = null; @@ -23,14 +23,14 @@ class JsonLinesDatastore { async notifyChanged(callback) { this.notifyChangedCallback = callback; await lock.acquire('reader', async () => { - this.closeReader(); + this._closeReader(); }); const call = this.notifyChangedCallback; this.notifyChangedCallback = null; if (call) call(); } - async openReader() { + async _openReader() { return new Promise((resolve, reject) => lineReader.open(this.file, (err, reader) => { if (err) reject(err); @@ -39,7 +39,7 @@ class JsonLinesDatastore { ); } - readLine() { + _readLine() { return new Promise((resolve, reject) => { const reader = this.reader; if (!reader.hasNextLine()) { @@ -55,28 +55,28 @@ class JsonLinesDatastore { }); } - async ensureReader(offset) { + async _ensureReader(offset) { if (this.readedDataRowCount > offset) { - this.closeReader(); + this._closeReader(); } if (!this.reader) { - const reader = await this.openReader(); + const reader = await this._openReader(); this.reader = reader; } if (!this.readedSchemaRow) { - await this.readLine(); // skip structure + await this._readLine(); // skip structure } while (this.readedDataRowCount < offset) { - await this.readLine(); + await this._readLine(); } } async getRows(offset, limit) { const res = []; await lock.acquire('reader', async () => { - await this.ensureReader(offset); + await this._ensureReader(offset); for (let i = 0; i < limit; i += 1) { - const line = await this.readLine(); + const line = await this._readLine(); if (line == null) break; res.push(JSON.parse(line)); }