Class SegmentTarManager
- java.lang.Object
-
- org.apache.jackrabbit.oak.segment.file.tar.SegmentTarManager
-
- All Implemented Interfaces:
SegmentArchiveManager
public class SegmentTarManager extends Object implements SegmentArchiveManager
-
-
Constructor Summary
Constructors Constructor Description SegmentTarManager(File segmentstoreDir, FileStoreMonitor fileStoreMonitor, IOMonitor ioMonitor, boolean memoryMapping, boolean offHeapAccess)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
backup(@NotNull String archiveName, @NotNull String backupArchiveName, @NotNull Set<UUID> recoveredEntries)
Method that is doing a backup of the archive given witharchiveName
intobackupArchiveName
.void
copyFile(String from, String to)
Copies the archive with all the segments.SegmentArchiveWriter
create(String archiveName)
Creates a new archive.boolean
delete(String archiveName)
Deletes the archive if exists.boolean
exists(String archiveName)
Check if archive exists.SegmentArchiveReader
forceOpen(String archiveName)
Opens an archive that wasn't closed correctly.List<String>
listArchives()
List names of the available .tar archives.SegmentArchiveReader
open(String name)
Opens a given archive for reading.void
recoverEntries(String archiveName, LinkedHashMap<UUID,byte[]> entries)
Finds all the segments included in the archive.boolean
renameTo(String from, String to)
Renames the archive.
-
-
-
Constructor Detail
-
SegmentTarManager
public SegmentTarManager(File segmentstoreDir, FileStoreMonitor fileStoreMonitor, IOMonitor ioMonitor, boolean memoryMapping, boolean offHeapAccess)
-
-
Method Detail
-
listArchives
public List<String> listArchives()
Description copied from interface:SegmentArchiveManager
List names of the available .tar archives.- Specified by:
listArchives
in interfaceSegmentArchiveManager
- Returns:
- archive list
-
open
public SegmentArchiveReader open(String name) throws IOException
Description copied from interface:SegmentArchiveManager
Opens a given archive for reading.- Specified by:
open
in interfaceSegmentArchiveManager
- Returns:
- the archive reader or null if the archive doesn't exist or doesn't have a valid index
- Throws:
IOException
-
forceOpen
public SegmentArchiveReader forceOpen(String archiveName) throws IOException
Description copied from interface:SegmentArchiveManager
Opens an archive that wasn't closed correctly.- Specified by:
forceOpen
in interfaceSegmentArchiveManager
- Returns:
- the archive reader or null if the implementation doesn't support opening an unclosed archive
- Throws:
IOException
-
create
public SegmentArchiveWriter create(String archiveName)
Description copied from interface:SegmentArchiveManager
Creates a new archive.- Specified by:
create
in interfaceSegmentArchiveManager
- Returns:
- the archive writer
-
delete
public boolean delete(String archiveName)
Description copied from interface:SegmentArchiveManager
Deletes the archive if exists.- Specified by:
delete
in interfaceSegmentArchiveManager
- Returns:
- true if the archive was removed, false otherwise
-
renameTo
public boolean renameTo(String from, String to)
Description copied from interface:SegmentArchiveManager
Renames the archive.- Specified by:
renameTo
in interfaceSegmentArchiveManager
- Parameters:
from
- the existing archiveto
- new name- Returns:
- true if the archive was renamed, false otherwise
-
copyFile
public void copyFile(String from, String to) throws IOException
Description copied from interface:SegmentArchiveManager
Copies the archive with all the segments.- Specified by:
copyFile
in interfaceSegmentArchiveManager
- Parameters:
from
- the existing archiveto
- new name- Throws:
IOException
-
exists
public boolean exists(String archiveName)
Description copied from interface:SegmentArchiveManager
Check if archive exists.- Specified by:
exists
in interfaceSegmentArchiveManager
- Parameters:
archiveName
- archive to check- Returns:
- true if archive exists, false otherwise
-
recoverEntries
public void recoverEntries(String archiveName, LinkedHashMap<UUID,byte[]> entries) throws IOException
Description copied from interface:SegmentArchiveManager
Finds all the segments included in the archive.- Specified by:
recoverEntries
in interfaceSegmentArchiveManager
- Parameters:
archiveName
- archive to recoverentries
- results will be put there, in the order of presence in the archive- Throws:
IOException
-
backup
public void backup(@NotNull @NotNull String archiveName, @NotNull @NotNull String backupArchiveName, @NotNull @NotNull Set<UUID> recoveredEntries) throws IOException
Description copied from interface:SegmentArchiveManager
Method that is doing a backup of the archive given witharchiveName
intobackupArchiveName
. 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.- Specified by:
backup
in interfaceSegmentArchiveManager
- Throws:
IOException
-
-