messagestorage: remove implementation details from interface

The interface should not contain things that aren't the API of the
storage interface.
Further, rename ISqliteMessageStorage to SearchableMessageStorage,
as that's also an implementation detail.
We'll never have a second sqlite backend, so the name seems
strange.
This commit is contained in:
Reto Brunner 2022-12-30 16:06:46 +01:00
parent 8b1a4f72fa
commit 661d5cb5b0
2 changed files with 5 additions and 11 deletions

View file

@ -8,11 +8,7 @@ import Msg, {Message} from "../../models/msg";
import Client from "../../client";
import Chan, {Channel} from "../../models/chan";
import Helper from "../../helper";
import type {
SearchResponse,
SearchQuery,
SqliteMessageStorage as ISqliteMessageStorage,
} from "./types";
import type {SearchResponse, SearchQuery, SearchableMessageStorage} from "./types";
import Network from "../../models/network";
// TODO; type
@ -49,11 +45,11 @@ class Deferred {
}
}
class SqliteMessageStorage implements ISqliteMessageStorage {
client: Client;
class SqliteMessageStorage implements SearchableMessageStorage {
isEnabled: boolean;
database!: Database;
initDone: Deferred;
client: Client;
constructor(client: Client) {
this.client = client;

View file

@ -6,7 +6,6 @@ import {Network} from "../../models/network";
import Client from "../../client";
interface MessageStorage {
client: Client;
isEnabled: boolean;
enable(): Promise<void>;
@ -38,7 +37,6 @@ export type SearchResponse =
type SearchFunction = (query: SearchQuery) => Promise<SearchResponse>;
export interface SqliteMessageStorage extends MessageStorage {
database: Database;
search: SearchFunction | [];
export interface SearchableMessageStorage extends MessageStorage {
search: SearchFunction;
}