Class HistoryManager
java.lang.Object
net.mcreator.workspace.localhistory.HistoryManager
- All Implemented Interfaces:
AutoCloseable
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckpoint(String checkpointName, Object... parameters) Saves checkpoint with a given name.voidclose()voidgetCheckpoints(Consumer<List<HistoryCheckpoint>> callback) static FilegetLocalHistoryRoot(File workspaceFolder) voidimportantCheckpoint(String checkpointName, Object... parameters) Creates an important checkpoint in the history with the specified name.voidimportantCheckpoint(Supplier<Boolean> ifImportantBusySyncWriteConfirm, String checkpointName, Object... parameters) Creates an important checkpoint in the history with the specified name.booleanbooleanisBusy()voidvoidrevertToCheckpoint(HistoryCheckpoint checkpoint) voidsetBusyListener(Consumer<Boolean> listener) voidsetCheckpointListener(Runnable listener)
-
Constructor Details
-
HistoryManager
-
-
Method Details
-
checkpoint
-
importantCheckpoint
Creates an important checkpoint in the history with the specified name. This method will block if the local history backend is busy until the checkpoint is written.- Parameters:
checkpointName- The name of the checkpoint. This name should represent the current state of the workspace when the checkpoint is created.parameters- Additional parameters related to the checkpoint that can provide further context or metadata for the checkpoint event.
-
importantCheckpoint
public void importantCheckpoint(@Nullable Supplier<Boolean> ifImportantBusySyncWriteConfirm, String checkpointName, Object... parameters) Creates an important checkpoint in the history with the specified name. This method allows specifying additional parameters and an optional synchronization mechanism.- Parameters:
ifImportantBusySyncWriteConfirm- A supplier that provides a boolean indicating whether the checkpoint should be written synchronously during a busy state. If null, the checkpoint is always written synchronously by default.checkpointName- The name of the checkpoint. This name should represent the current state of the workspace when the checkpoint is created.parameters- Additional parameters related to the checkpoint that can provide further context or metadata for the checkpoint event.
-
setCheckpointListener
-
setBusyListener
-
getCheckpoints
-
optimizeStorage
public void optimizeStorage() -
revertToCheckpoint
- Throws:
LocalHistoryException
-
isAvailable
public boolean isAvailable() -
isBusy
public boolean isBusy() -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
getLocalHistoryRoot
-