Package io.camunda.zeebe.snapshots.impl
Class FileBasedSnapshotStoreImpl
java.lang.Object
io.camunda.zeebe.snapshots.impl.FileBasedSnapshotStoreImpl
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFileBasedSnapshotStoreImpl(int brokerId, Path root, CRC32CChecksumProvider checksumProvider, ConcurrencyControl actor, SnapshotMetrics metrics) -
Method Summary
Modifier and TypeMethodDescriptionaddSnapshotListener(PersistedSnapshotListener listener) voidclose()copyForBootstrap(PersistedSnapshot persistedSnapshot, BiConsumer<Path, Path> copySnapshot) Take a copy of the given persisted snapshot and move it to the bootstrap snapshots directory, applying the function to the files.delete()longgetPath()booleanhasSnapshotId(String id) newReceivedSnapshot(String snapshotId) newTransientSnapshot(long index, long term, long processedPosition, long exportedPosition, boolean forceSnapshot) restore(PersistedSnapshot snapshot) voidvoidstart()toString()
-
Field Details
-
VERSION
public static final int VERSION- See Also:
-
SNAPSHOTS_DIRECTORY
- See Also:
-
METADATA_FILE_NAME
- See Also:
-
SNAPSHOTS_BOOTSTRAP_DIRECTORY
- See Also:
-
CHECKSUM_SUFFIX
- See Also:
-
-
Constructor Details
-
FileBasedSnapshotStoreImpl
public FileBasedSnapshotStoreImpl(int brokerId, Path root, CRC32CChecksumProvider checksumProvider, ConcurrencyControl actor, SnapshotMetrics metrics)
-
-
Method Details
-
start
public void start() -
close
public void close() -
hasSnapshotId
-
getLatestSnapshot
-
getAvailableSnapshots
-
getCompactionBound
-
abortPendingSnapshots
-
addSnapshotListener
-
removeSnapshotListener
-
getCurrentSnapshotIndex
public long getCurrentSnapshotIndex() -
delete
-
getPath
-
newReceivedSnapshot
-
newTransientSnapshot
public Either<SnapshotException,TransientSnapshot> newTransientSnapshot(long index, long term, long processedPosition, long exportedPosition, boolean forceSnapshot) -
toString
-
restore
- Throws:
IOException
-
restore
-
copyForBootstrap
public ActorFuture<PersistedSnapshot> copyForBootstrap(PersistedSnapshot persistedSnapshot, BiConsumer<Path, Path> copySnapshot) Take a copy of the given persisted snapshot and move it to the bootstrap snapshots directory, applying the function to the files. Only one snapshot for bootstrap can be taken at a time. It will be located into the "bootstrap-snapshots" folder.- Parameters:
persistedSnapshot- to copy fromcopySnapshot- function to copy the files from the snapshot into the target folder: the arguments are (sourcePath, targetPath)- Returns:
- a future with the persisted snapshot for bootstrap.
-
getBootstrapSnapshot
-