mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-21 23:20:23 +00:00
More git storage rework
This commit is contained in:
parent
71e0ce35e8
commit
c5f94a7b0b
3 changed files with 12 additions and 7 deletions
|
@ -244,6 +244,7 @@ public abstract class OperationMode {
|
|||
if (inShutdownHook) {
|
||||
ThreadHelper.runAsync(() -> {
|
||||
ThreadHelper.sleep(15000);
|
||||
TrackEvent.info("Shutdown took too long. Halting ...");
|
||||
OperationMode.halt(1);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -16,15 +16,17 @@ public interface GitStorageHandler {
|
|||
|
||||
void init(Path dir);
|
||||
|
||||
void prepareForLoad();
|
||||
void beforeStorageLoad();
|
||||
|
||||
void prepareForSave();
|
||||
void afterStorageLoad();
|
||||
|
||||
void beforeStorageSave();
|
||||
|
||||
void afterStorageSave();
|
||||
|
||||
void handleEntry(DataStoreEntry entry, boolean exists, boolean dirty);
|
||||
|
||||
void handleCategory(DataStoreCategory category, boolean exists, boolean dirty);
|
||||
|
||||
void handleDeletion(Path target, String name);
|
||||
|
||||
void postSave();
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import io.xpipe.app.comp.store.StoreSortMode;
|
|||
import io.xpipe.app.issue.ErrorEvent;
|
||||
import io.xpipe.app.issue.TrackEvent;
|
||||
import io.xpipe.app.prefs.AppPrefs;
|
||||
import io.xpipe.app.util.ThreadHelper;
|
||||
import io.xpipe.app.util.XPipeSession;
|
||||
import io.xpipe.core.store.LocalStore;
|
||||
import lombok.Getter;
|
||||
|
@ -111,7 +112,7 @@ public class StandardStorage extends DataStorage {
|
|||
}
|
||||
|
||||
public synchronized void load() {
|
||||
this.gitStorageHandler.prepareForLoad();
|
||||
this.gitStorageHandler.beforeStorageLoad();
|
||||
|
||||
var storesDir = getStoresDir();
|
||||
var categoriesDir = getCategoriesDir();
|
||||
|
@ -300,6 +301,7 @@ public class StandardStorage extends DataStorage {
|
|||
deleteLeftovers();
|
||||
|
||||
loaded = true;
|
||||
this.gitStorageHandler.afterStorageLoad();
|
||||
}
|
||||
|
||||
public synchronized void save() {
|
||||
|
@ -307,7 +309,7 @@ public class StandardStorage extends DataStorage {
|
|||
return;
|
||||
}
|
||||
|
||||
this.gitStorageHandler.prepareForSave();
|
||||
this.gitStorageHandler.beforeStorageSave();
|
||||
|
||||
try {
|
||||
FileUtils.forceMkdir(getStoresDir().toFile());
|
||||
|
@ -358,7 +360,7 @@ public class StandardStorage extends DataStorage {
|
|||
}
|
||||
|
||||
deleteLeftovers();
|
||||
gitStorageHandler.postSave();
|
||||
gitStorageHandler.afterStorageSave();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue