From e556bb242ffc7683e4b4531809e5ab39dc1c7565 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Fri, 22 Nov 2019 11:02:52 +0100 Subject: [PATCH 1/2] ElectronPlatform: Add the indexSize method. --- electron_app/src/electron-main.js | 11 +++++++++++ src/vector/platform/ElectronPlatform.js | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/electron_app/src/electron-main.js b/electron_app/src/electron-main.js index 6e477f90..11b28258 100644 --- a/electron_app/src/electron-main.js +++ b/electron_app/src/electron-main.js @@ -381,6 +381,17 @@ ipcMain.on('seshat', async function(ev, payload) { } break; + case 'indexSize': + if (eventIndex === null) ret = 0; + else { + try { + ret = await eventIndex.getSize(); + } catch (e) { + ret = 0; + } + } + break; + default: mainWindow.webContents.send('seshatReply', { id: payload.id, diff --git a/src/vector/platform/ElectronPlatform.js b/src/vector/platform/ElectronPlatform.js index 9968504a..02f2e62b 100644 --- a/src/vector/platform/ElectronPlatform.js +++ b/src/vector/platform/ElectronPlatform.js @@ -155,6 +155,10 @@ class SeshatIndexManager extends BaseEventIndexManager { async deleteEventIndex(): Promise<> { return this._ipcCall('deleteEventIndex'); } + + async indexSize(): Promise<> { + return this._ipcCall('indexSize'); + } } export default class ElectronPlatform extends VectorBasePlatform { From e1e3bba290384a662691d04f1f3b15130c49c27c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Tue, 21 Jan 2020 13:33:20 +0100 Subject: [PATCH 2/2] ElectronPlatform: Replace the indexSize method with the getStats method. --- electron_app/src/electron-main.js | 23 ++++++++++++----------- src/vector/platform/ElectronPlatform.js | 8 ++++---- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/electron_app/src/electron-main.js b/electron_app/src/electron-main.js index 11b28258..8794b4a4 100644 --- a/electron_app/src/electron-main.js +++ b/electron_app/src/electron-main.js @@ -346,6 +346,18 @@ ipcMain.on('seshat', async function(ev, payload) { } break; + case 'getStats': + if (eventIndex === null) ret = 0; + else { + try { + ret = await eventIndex.getStats(); + } catch (e) { + sendError(payload.id, e); + return; + } + } + break; + case 'removeCrawlerCheckpoint': if (eventIndex === null) ret = false; else { @@ -381,17 +393,6 @@ ipcMain.on('seshat', async function(ev, payload) { } break; - case 'indexSize': - if (eventIndex === null) ret = 0; - else { - try { - ret = await eventIndex.getSize(); - } catch (e) { - ret = 0; - } - } - break; - default: mainWindow.webContents.send('seshatReply', { id: payload.id, diff --git a/src/vector/platform/ElectronPlatform.js b/src/vector/platform/ElectronPlatform.js index 02f2e62b..d2d82ec6 100644 --- a/src/vector/platform/ElectronPlatform.js +++ b/src/vector/platform/ElectronPlatform.js @@ -152,12 +152,12 @@ class SeshatIndexManager extends BaseEventIndexManager { return this._ipcCall('closeEventIndex'); } - async deleteEventIndex(): Promise<> { - return this._ipcCall('deleteEventIndex'); + async getStats(): Promise<> { + return this._ipcCall('getStats'); } - async indexSize(): Promise<> { - return this._ipcCall('indexSize'); + async deleteEventIndex(): Promise<> { + return this._ipcCall('deleteEventIndex'); } }