mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-03-30 13:45:19 +00:00
- Rewrite the service's binding/handler assignment systems - Removed loopholes that allowed traversal between services to clarify dependencies. - Consolidated the hidden state-related state, the handler, and the addition of bindings to the handler into a single object. - Currently, functions that can have handlers added implement either addHandler or setHandler directly on the function itself. I understand there are differing opinions on this, but for now, this is how it stands. - Services now possess a Context. Please ensure each platform has a class that inherits from ServiceContext. - To permit services to be dynamically bound, the services themselves are now defined by interfaces.
19 lines
1000 B
TypeScript
19 lines
1000 B
TypeScript
import { REMOTE_MINIO, type RemoteDBSettings } from "../../lib/src/common/types";
|
|
import { LiveSyncJournalReplicator } from "../../lib/src/replication/journal/LiveSyncJournalReplicator";
|
|
import type { LiveSyncAbstractReplicator } from "../../lib/src/replication/LiveSyncAbstractReplicator";
|
|
import type { LiveSyncCore } from "../../main";
|
|
import { AbstractModule } from "../AbstractModule";
|
|
|
|
export class ModuleReplicatorMinIO extends AbstractModule {
|
|
_anyNewReplicator(settingOverride: Partial<RemoteDBSettings> = {}): Promise<LiveSyncAbstractReplicator | false> {
|
|
const settings = { ...this.settings, ...settingOverride };
|
|
if (settings.remoteType == REMOTE_MINIO) {
|
|
return Promise.resolve(new LiveSyncJournalReplicator(this.core));
|
|
}
|
|
return Promise.resolve(false);
|
|
}
|
|
onBindFunction(core: LiveSyncCore, services: typeof core.services): void {
|
|
services.replicator.getNewReplicator.addHandler(this._anyNewReplicator.bind(this));
|
|
}
|
|
}
|