Interface SegmentArchiveManager
-
- All Known Implementing Classes:
AwsArchiveManager,AzureArchiveManager,AzureArchiveManagerV8,CachingArchiveManager,SegmentTarManager,SplitSegmentArchiveManager
public interface SegmentArchiveManagerSegmentArchiveManager provides a low-level access to the segment files (eg. stored in the .tar). It allows to perform a few FS-like operations (delete, rename, copy, etc.) and also opens the segment archives either for reading or reading and writing.The implementation doesn't need to be thread-safe.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidbackup(@NotNull String archiveName, @NotNull String backupArchiveName, @NotNull Set<UUID> recoveredEntries)Method that is doing a backup of the archive given witharchiveNameintobackupArchiveName.voidcopyFile(@NotNull String from, @NotNull String to)Copies the archive with all the segments.@NotNull SegmentArchiveWritercreate(@NotNull String archiveName)Creates a new archive.booleandelete(@NotNull String archiveName)Deletes the archive if exists.booleanexists(@NotNull String archiveName)Check if archive exists.@Nullable SegmentArchiveReaderforceOpen(String archiveName)Opens an archive that wasn't closed correctly.default booleanisReadOnly(String archiveName)Check if the named archive is a read-only archive or not.@NotNull List<String>listArchives()List names of the available .tar archives.@Nullable SegmentArchiveReaderopen(@NotNull String archiveName)Opens a given archive for reading.voidrecoverEntries(@NotNull String archiveName, @NotNull LinkedHashMap<UUID,byte[]> entries)Finds all the segments included in the archive.booleanrenameTo(@NotNull String from, @NotNull String to)Renames the archive.
-
-
-
Method Detail
-
listArchives
@NotNull @NotNull List<String> listArchives() throws IOException
List names of the available .tar archives.- Returns:
- archive list
- Throws:
IOException
-
open
@Nullable @Nullable SegmentArchiveReader open(@NotNull @NotNull String archiveName) throws IOException
Opens a given archive for reading.- Parameters:
archiveName-- Returns:
- the archive reader or null if the archive doesn't exist or doesn't have a valid index
- Throws:
IOException
-
forceOpen
@Nullable @Nullable SegmentArchiveReader forceOpen(String archiveName) throws IOException
Opens an archive that wasn't closed correctly.- Parameters:
archiveName-- Returns:
- the archive reader or null if the implementation doesn't support opening an unclosed archive
- Throws:
IOException
-
create
@NotNull @NotNull SegmentArchiveWriter create(@NotNull @NotNull String archiveName) throws IOException
Creates a new archive.- Parameters:
archiveName-- Returns:
- the archive writer
- Throws:
IOException
-
delete
boolean delete(@NotNull @NotNull String archiveName)Deletes the archive if exists.- Parameters:
archiveName-- Returns:
- true if the archive was removed, false otherwise
-
renameTo
boolean renameTo(@NotNull @NotNull String from, @NotNull @NotNull String to)Renames the archive.- Parameters:
from- the existing archiveto- new name- Returns:
- true if the archive was renamed, false otherwise
-
copyFile
void copyFile(@NotNull @NotNull String from, @NotNull @NotNull String to) throws IOExceptionCopies the archive with all the segments.- Parameters:
from- the existing archiveto- new name- Throws:
IOException
-
exists
boolean exists(@NotNull @NotNull String archiveName)Check if archive exists.- Parameters:
archiveName- archive to check- Returns:
- true if archive exists, false otherwise
-
recoverEntries
void recoverEntries(@NotNull @NotNull String archiveName, @NotNull @NotNull LinkedHashMap<UUID,byte[]> entries) throws IOExceptionFinds all the segments included in the archive.- Parameters:
archiveName- archive to recoverentries- results will be put there, in the order of presence in the archive- Throws:
IOException
-
backup
void backup(@NotNull @NotNull String archiveName, @NotNull @NotNull String backupArchiveName, @NotNull @NotNull Set<UUID> recoveredEntries) throws IOExceptionMethod that is doing a backup of the archive given witharchiveNameintobackupArchiveName. In addition, set of UUIDs of recovered segments is provided which can be inspected during backup. Method is invoked during archive recovery procedure and concrete implementation can decide whether original archive should be deleted or modified.- Parameters:
archiveName-backupArchiveName-recoveredEntries-- Throws:
IOException
-
isReadOnly
default boolean isReadOnly(String archiveName)
Check if the named archive is a read-only archive or not. Read-only archives cannot be modified, renamed or removed. E.g. they can not be deleted by compaction even if they no longer contain any referenced segments.- Parameters:
archiveName- The name identifying the archive.- Returns:
trueif the named archive is read-only, false otherwise.
-
-