Package io.activej.state.file
Class FileStateManager<T>
java.lang.Object
io.activej.state.file.FileStateManager<T>
- All Implemented Interfaces:
io.activej.common.initializer.WithInitializer<FileStateManager<T>>,StateManager<T,Long>
public final class FileStateManager<T>
extends Object
implements StateManager<T,Long>, io.activej.common.initializer.WithInitializer<FileStateManager<T>>
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> FileStateManager<T>create(BlockingFs fs, FileNamingScheme fileNamingScheme, StreamCodec<T> codec) static <T> FileStateManager<T>create(BlockingFs fs, FileNamingScheme fileNamingScheme, StreamDecoder<T> decoder) static <T> FileStateManager<T>create(BlockingFs fs, FileNamingScheme fileNamingScheme, StreamEncoder<T> encoder) static <T> FileStateManager<T>create(BlockingFs fs, FileNamingScheme fileNamingScheme, StreamEncoder<T> encoder, StreamDecoder<T> decoder) @Nullable LonggetLastDiffRevision(@NotNull Long currentRevision) @Nullable Longload()loadSnapshot(@NotNull Long revision) @NotNull Long@NotNull LongvoidvoidvoidsaveSnapshot(T state, @NotNull Long revision) tryLoad()tryLoadDiff(T state, @NotNull Long revisionFrom, @NotNull Long revisionTo) tryLoadSnapshot(@NotNull Long revision) withMaxSaveDiffs(int maxSaveDiffs) withTempDir(String tempDir) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.activej.common.initializer.WithInitializer
withInitializer
-
Field Details
-
DEFAULT_TEMP_DIR
- See Also:
-
-
Method Details
-
create
public static <T> FileStateManager<T> create(BlockingFs fs, FileNamingScheme fileNamingScheme, StreamCodec<T> codec) -
create
public static <T> FileStateManager<T> create(BlockingFs fs, FileNamingScheme fileNamingScheme, StreamEncoder<T> encoder, StreamDecoder<T> decoder) -
create
public static <T> FileStateManager<T> create(BlockingFs fs, FileNamingScheme fileNamingScheme, StreamEncoder<T> encoder) -
create
public static <T> FileStateManager<T> create(BlockingFs fs, FileNamingScheme fileNamingScheme, StreamDecoder<T> decoder) -
withMaxSaveDiffs
-
withTempDir
-
newRevision
- Specified by:
newRevisionin interfaceStateManager<T,Long> - Throws:
IOException
-
getLastSnapshotRevision
- Specified by:
getLastSnapshotRevisionin interfaceStateManager<T,Long> - Throws:
IOException
-
getLastDiffRevision
@Nullable public @Nullable Long getLastDiffRevision(@NotNull @NotNull Long currentRevision) throws IOException - Specified by:
getLastDiffRevisionin interfaceStateManager<T,Long> - Throws:
IOException
-
loadSnapshot
- Specified by:
loadSnapshotin interfaceStateManager<T,Long> - Throws:
IOException
-
tryLoadSnapshot
- Specified by:
tryLoadSnapshotin interfaceStateManager<T,Long> - Throws:
IOException
-
loadDiff
@NotNull public T loadDiff(@NotNull T state, @NotNull @NotNull Long revisionFrom, @NotNull @NotNull Long revisionTo) throws IOException - Specified by:
loadDiffin interfaceStateManager<T,Long> - Throws:
IOException
-
tryLoadDiff
@Nullable public T tryLoadDiff(@NotNull T state, @NotNull @NotNull Long revisionFrom, @NotNull @NotNull Long revisionTo) throws IOException - Specified by:
tryLoadDiffin interfaceStateManager<T,Long> - Throws:
IOException
-
saveSnapshot
- Specified by:
saveSnapshotin interfaceStateManager<T,Long> - Throws:
IOException
-
saveDiff
public void saveDiff(@NotNull T state, @NotNull @NotNull Long revision, @NotNull T stateFrom, @NotNull @NotNull Long revisionFrom) throws IOException - Specified by:
saveDiffin interfaceStateManager<T,Long> - Throws:
IOException
-
load
- Throws:
IOException
-
tryLoad
- Throws:
IOException
-
load
@NotNull public @NotNull FileState<T> load(@NotNull T stateFrom, @NotNull @NotNull Long revisionFrom) throws IOException - Throws:
IOException
-
tryLoad
@Nullable public @Nullable FileState<T> tryLoad(@NotNull T stateFrom, @NotNull @NotNull Long revisionFrom) throws IOException - Throws:
IOException
-
save
- Throws:
IOException
-
save
- Throws:
IOException
-