BaseEventIndexManager: Add a method to load file events of a room.

This commit is contained in:
Damir Jelić 2020-01-15 12:04:27 +01:00
parent 4f63b10465
commit 263370c9ae

View file

@ -62,11 +62,18 @@ export interface SearchArgs {
room_id: ?string; room_id: ?string;
} }
export interface HistoricEvent { export interface EventAndProfile {
event: MatrixEvent; event: MatrixEvent;
profile: MatrixProfile; profile: MatrixProfile;
} }
export interface LoadArgs {
roomId: string;
limit: number;
fromEvent: string;
direction: string;
}
/** /**
* Base class for classes that provide platform-specific event indexing. * Base class for classes that provide platform-specific event indexing.
* *
@ -145,7 +152,7 @@ export default class BaseEventIndexManager {
* *
* This is used to add a batch of events to the index. * This is used to add a batch of events to the index.
* *
* @param {[HistoricEvent]} events The list of events and profiles that * @param {[EventAndProfile]} events The list of events and profiles that
* should be added to the event index. * should be added to the event index.
* @param {[CrawlerCheckpoint]} checkpoint A new crawler checkpoint that * @param {[CrawlerCheckpoint]} checkpoint A new crawler checkpoint that
* should be stored in the index which should be used to continue crawling * should be stored in the index which should be used to continue crawling
@ -158,7 +165,7 @@ export default class BaseEventIndexManager {
* were already added to the index, false otherwise. * were already added to the index, false otherwise.
*/ */
async addHistoricEvents( async addHistoricEvents(
events: [HistoricEvent], events: [EventAndProfile],
checkpoint: CrawlerCheckpoint | null, checkpoint: CrawlerCheckpoint | null,
oldCheckpoint: CrawlerCheckpoint | null, oldCheckpoint: CrawlerCheckpoint | null,
): Promise<bool> { ): Promise<bool> {
@ -201,6 +208,23 @@ export default class BaseEventIndexManager {
throw new Error("Unimplemented"); throw new Error("Unimplemented");
} }
/** Load events that contain an mxc URL to a file from the index.
*
* @param {object} args Arguments object for the method.
* @param {string} args.roomId The ID of the room for which the events
* should be loaded.
* @param {number} args.limit The maximum number of events to return.
* @param {string} args.fromEvent An event id of a previous event returned
* by this method. If set events that are older than the event with the
* given event ID will be returned.
*
* @return {Promise<[EventAndProfile]>} A promise that will resolve to an array
* of Matrix events that contain mxc URLs.
*/
async loadFileEvents(args: LoadArgs): Promise<[EventAndProfile]> {
throw new Error("Unimplemented");
}
/** /**
* close our event index. * close our event index.
* *