EventIndexPanel: Get more stats for our indexer, not just the size.
This commit is contained in:
parent
695b8aff5b
commit
1b9b30d4ea
4 changed files with 74 additions and 24 deletions
|
@ -67,6 +67,12 @@ export interface HistoricEvent {
|
|||
profile: MatrixProfile;
|
||||
}
|
||||
|
||||
export interface IndexStats {
|
||||
size: number;
|
||||
event_count: number;
|
||||
room_count: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Base class for classes that provide platform-specific event indexing.
|
||||
*
|
||||
|
@ -118,9 +124,12 @@ export default class BaseEventIndexManager {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the disk usage of the index
|
||||
* Get statistical information of the index.
|
||||
*
|
||||
* @return {Promise<IndexStats>} A promise that will resolve to the index
|
||||
* statistics.
|
||||
*/
|
||||
async indexSize(): Promise<number> {
|
||||
async getStats(): Promise<IndexStats> {
|
||||
throw new Error("Unimplemented");
|
||||
}
|
||||
|
||||
|
|
|
@ -425,9 +425,9 @@ export default class EventIndex {
|
|||
return indexManager.searchEventIndex(searchArgs);
|
||||
}
|
||||
|
||||
async indexSize() {
|
||||
async getStats() {
|
||||
const indexManager = PlatformPeg.get().getEventIndexingManager();
|
||||
return indexManager.indexSize();
|
||||
return indexManager.getStats();
|
||||
}
|
||||
|
||||
currentlyCrawledRooms() {
|
||||
|
@ -456,4 +456,27 @@ export default class EventIndex {
|
|||
|
||||
return {crawlingRooms, totalRooms};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the room that we are currently crawling.
|
||||
*
|
||||
* @returns A MatrixRoom that is being currently crawled, null if no room is
|
||||
* currently being crawled.
|
||||
*/
|
||||
currentRoom() {
|
||||
if (this._currentCheckpoint === null && this.crawlerCheckpoints.length === 0) {
|
||||
console.log("EventIndex: No current nor any checkpoint");
|
||||
return null;
|
||||
}
|
||||
|
||||
const client = MatrixClientPeg.get();
|
||||
|
||||
if (this._currentCheckpoint !== null) {
|
||||
console.log("EventIndex: Current checkpoint available");
|
||||
return client.getRoom(this._currentCheckpoint.roomId);
|
||||
} else {
|
||||
console.log("EventIndex: No current but have checkpoint available");
|
||||
return client.getRoom(this.crawlerCheckpoints[0].roomId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue