1
0
mirror of https://github.com/vrtmrz/obsidian-livesync.git synced 2025-03-03 15:32:25 +02:00
- Now journal synchronisation considers untransferred each from sent and received.
  - Journal sync now handles retrying.
  - Journal synchronisation no longer considers the synchronisation of chunks as revision updates (Simply ignored).
  - Journal sync now splits the journal pack to prevent mobile device rebooting.
  - Maintenance menus which had been on the command palette are now back in the maintain pane on the setting dialogue.
- Improved:
  - Now all changes which have been replicated while rebuilding will be postponed.
This commit is contained in:
vorotamoroz 2024-04-30 01:39:09 +09:00
parent 5b4309c09d
commit 29532193cb
4 changed files with 59 additions and 61 deletions

View File

@ -1,4 +1,4 @@
import { type EntryDoc, type ObsidianLiveSyncSettings, DEFAULT_SETTINGS, LOG_LEVEL_NOTICE, REMOTE_COUCHDB, REMOTE_MINIO } from "./lib/src/types";
import { type EntryDoc, type ObsidianLiveSyncSettings, DEFAULT_SETTINGS, LOG_LEVEL_NOTICE, REMOTE_COUCHDB } from "./lib/src/types";
import { configURIBase } from "./types";
import { Logger } from "./lib/src/logger";
import { PouchDB } from "./lib/src/pouchdb-browser.js";
@ -312,7 +312,7 @@ Of course, we are able to disable these features.`
}
async suspendReflectingDatabase() {
if (this.plugin.settings.doNotSuspendOnFetching) return;
if (this.plugin.settings.remoteType == REMOTE_MINIO) return;
// if (this.plugin.settings.remoteType == REMOTE_MINIO) return;
Logger(`Suspending reflection: Database and storage changes will not be reflected in each other until completely finished the fetching.`, LOG_LEVEL_NOTICE);
this.plugin.settings.suspendParseReplicationResult = true;
this.plugin.settings.suspendFileWatching = true;
@ -320,7 +320,7 @@ Of course, we are able to disable these features.`
}
async resumeReflectingDatabase() {
if (this.plugin.settings.doNotSuspendOnFetching) return;
if (this.plugin.settings.remoteType == REMOTE_MINIO) return;
// if (this.plugin.settings.remoteType == REMOTE_MINIO) return;
Logger(`Database and storage reflection has been resumed!`, LOG_LEVEL_NOTICE);
this.plugin.settings.suspendParseReplicationResult = false;
this.plugin.settings.suspendFileWatching = false;

View File

@ -2321,6 +2321,61 @@ ${stringifyYaml(pluginConfig)}`;
})
)
if (this.plugin.settings.remoteType != REMOTE_COUCHDB) {
new Setting(containerMaintenanceEl)
.setName("Reset journal received history")
.setDesc("Initialise journal received history. On the next sync, every item except this device sent will be downloaded again.")
.addButton((button) =>
button
.setButtonText("Reset received")
.setWarning()
.setDisabled(false)
.onClick(async () => {
await this.plugin.getMinioJournalSyncClient().updateCheckPointInfo((info) => ({ ...info, receivedFiles: [], knownIDs: [] }));
Logger(`Journal received history has been cleared.`, LOG_LEVEL_NOTICE);
})
)
new Setting(containerMaintenanceEl)
.setName("Reset journal sent history")
.setDesc("Initialise journal sent history. On the next sync, every item except this device received will be sent again.")
.addButton((button) =>
button
.setButtonText("Reset sent history")
.setWarning()
.setDisabled(false)
.onClick(async () => {
await this.plugin.getMinioJournalSyncClient().updateCheckPointInfo((info) => ({ ...info, lastLocalSeq: 0, sentIDs: [], sentFiles: [] }));
Logger(`Journal sent history has been cleared.`, LOG_LEVEL_NOTICE);
})
)
new Setting(containerMaintenanceEl)
.setName("Reset all journal counter")
.setDesc("Initialise all journal history, On the next sync, every item will be received and sent.")
.addButton((button) =>
button
.setButtonText("Reset all")
.setWarning()
.setDisabled(false)
.onClick(async () => {
await this.plugin.getMinioJournalSyncClient().updateCheckPointInfo((info) => ({ ...info, receivedFiles: [], knownIDs: [], lastLocalSeq: 0, sentIDs: [], sentFiles: [] }));
Logger(`Journal exchange history has been cleared.`, LOG_LEVEL_NOTICE);
})
)
new Setting(containerMaintenanceEl)
.setName("Make empty the bucket")
.setDesc("Delete all data on the remote.")
.addButton((button) =>
button
.setButtonText("Delete")
.setWarning()
.setDisabled(false)
.onClick(async () => {
await this.plugin.getMinioJournalSyncClient().updateCheckPointInfo((info) => ({ ...info, receivedFiles: [], knownIDs: [], lastLocalSeq: 0, sentIDs: [], sentFiles: [] }));
await this.plugin.resetRemoteBucket();
Logger(`the bucket has been cleared.`, LOG_LEVEL_NOTICE);
})
)
}
containerMaintenanceEl.createEl("h4", { text: "Local database" });

@ -1 +1 @@
Subproject commit 5da1dbc7fc83d0b9a82fcc60228d4394874c5be8
Subproject commit 0d1ed24e31f754515a698b170d24b46dca8caaf5

View File

@ -682,63 +682,6 @@ Note: We can always able to read V1 format. It will be progressively converted.
this.addOnConfigSync.showPluginSyncModal();
}).addClass("livesync-ribbon-showcustom");
this.addCommand({
id: "debug-x1",
name: "Journal send",
callback: () => {
this.journalSendTest();
}
});
this.addCommand({
id: "debug-x3",
name: "Journal receive",
callback: () => {
this.journalFetchTest();
}
});
this.addCommand({
id: "debug-x4",
name: "Sync By Journal",
callback: () => {
this.journalSyncTest();
}
});
this.addCommand({
id: "debug-x5",
name: "Reset journal sync",
callback: () => {
this.resetJournalSync();
}
});
this.addCommand({
id: "debug-x6",
name: "Reset journal sync and delete all items on the bucket",
callback: () => {
this.resetRemoteBucket();
}
})
this.addCommand({
id: "debug-x7",
name: "Perform Test",
callback: () => {
// const p = getMockedPouch();
// this.localDatabase.localDatabase.replicate.to(p, { since: 1000, checkpoint: "source" });
}
})
this.addCommand({
id: "debug-x8",
name: "Pack test",
callback: async () => {
const minioJournal = this.getMinioJournalSyncClient();
// const pack = await minioJournal.createJournalPack();
// console.warn();
console.warn(await minioJournal._createJournalPack());
}
})
this.addCommand({
id: "view-log",
name: "Show log",