Rename syncServer to syncService
This commit is contained in:
parent
ea1c73a3c9
commit
60b6d90b6c
2 changed files with 12 additions and 12 deletions
|
|
@ -7,11 +7,11 @@ let isRunning = false;
|
||||||
|
|
||||||
export async function applyRemoteChangesLocally({
|
export async function applyRemoteChangesLocally({
|
||||||
database,
|
database,
|
||||||
syncServer,
|
syncService,
|
||||||
syncer,
|
syncer,
|
||||||
}: {
|
}: {
|
||||||
database: Database;
|
database: Database;
|
||||||
syncServer: SyncService;
|
syncService: SyncService;
|
||||||
syncer: Syncer;
|
syncer: Syncer;
|
||||||
}): Promise<void> {
|
}): Promise<void> {
|
||||||
if (!database.getSettings().isSyncEnabled) {
|
if (!database.getSettings().isSyncEnabled) {
|
||||||
|
|
@ -29,7 +29,7 @@ export async function applyRemoteChangesLocally({
|
||||||
isRunning = true;
|
isRunning = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const remote = await syncServer.getAll(database.getLastSeenUpdateId());
|
const remote = await syncService.getAll(database.getLastSeenUpdateId());
|
||||||
|
|
||||||
if (remote.latestDocuments.length === 0) {
|
if (remote.latestDocuments.length === 0) {
|
||||||
Logger.getInstance().debug("No remote changes to apply");
|
Logger.getInstance().debug("No remote changes to apply");
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import type { components } from "src/services/types.js";
|
||||||
|
|
||||||
export class Syncer {
|
export class Syncer {
|
||||||
private readonly database: Database;
|
private readonly database: Database;
|
||||||
private readonly syncServer: SyncService;
|
private readonly syncService: SyncService;
|
||||||
private readonly operations: FileOperations;
|
private readonly operations: FileOperations;
|
||||||
private readonly history: SyncHistory;
|
private readonly history: SyncHistory;
|
||||||
|
|
||||||
|
|
@ -27,17 +27,17 @@ export class Syncer {
|
||||||
|
|
||||||
public constructor({
|
public constructor({
|
||||||
database,
|
database,
|
||||||
syncServer,
|
syncService,
|
||||||
operations,
|
operations,
|
||||||
history,
|
history,
|
||||||
}: {
|
}: {
|
||||||
database: Database;
|
database: Database;
|
||||||
syncServer: SyncService;
|
syncService: SyncService;
|
||||||
operations: FileOperations;
|
operations: FileOperations;
|
||||||
history: SyncHistory;
|
history: SyncHistory;
|
||||||
}) {
|
}) {
|
||||||
this.database = database;
|
this.database = database;
|
||||||
this.syncServer = syncServer;
|
this.syncService = syncService;
|
||||||
this.operations = operations;
|
this.operations = operations;
|
||||||
this.history = history;
|
this.history = history;
|
||||||
|
|
||||||
|
|
@ -87,7 +87,7 @@ export class Syncer {
|
||||||
const contentBytes = await this.operations.read(relativePath);
|
const contentBytes = await this.operations.read(relativePath);
|
||||||
const contentHash = hash(contentBytes);
|
const contentHash = hash(contentBytes);
|
||||||
|
|
||||||
const response = await this.syncServer.create({
|
const response = await this.syncService.create({
|
||||||
relativePath,
|
relativePath,
|
||||||
contentBytes,
|
contentBytes,
|
||||||
createdDate: updateTime,
|
createdDate: updateTime,
|
||||||
|
|
@ -162,7 +162,7 @@ export class Syncer {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.syncServer.delete({
|
await this.syncService.delete({
|
||||||
documentId: metadata.documentId,
|
documentId: metadata.documentId,
|
||||||
relativePath,
|
relativePath,
|
||||||
// We got the event now, so it must have been deleted just now
|
// We got the event now, so it must have been deleted just now
|
||||||
|
|
@ -223,7 +223,7 @@ export class Syncer {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await this.syncServer.put({
|
const response = await this.syncService.put({
|
||||||
documentId: metadata.documentId,
|
documentId: metadata.documentId,
|
||||||
parentVersionId: metadata.parentVersionId,
|
parentVersionId: metadata.parentVersionId,
|
||||||
relativePath,
|
relativePath,
|
||||||
|
|
@ -462,7 +462,7 @@ export class Syncer {
|
||||||
}
|
}
|
||||||
|
|
||||||
const content = (
|
const content = (
|
||||||
await this.syncServer.get({
|
await this.syncService.get({
|
||||||
documentId: remoteVersion.documentId,
|
documentId: remoteVersion.documentId,
|
||||||
})
|
})
|
||||||
).contentBase64;
|
).contentBase64;
|
||||||
|
|
@ -527,7 +527,7 @@ export class Syncer {
|
||||||
}
|
}
|
||||||
|
|
||||||
const content = (
|
const content = (
|
||||||
await this.syncServer.get({
|
await this.syncService.get({
|
||||||
documentId: remoteVersion.documentId,
|
documentId: remoteVersion.documentId,
|
||||||
})
|
})
|
||||||
).contentBase64;
|
).contentBase64;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue