Class AzureArchiveManager
- java.lang.Object
-
- org.apache.jackrabbit.oak.segment.azure.AzureArchiveManager
-
- All Implemented Interfaces:
SegmentArchiveManager
public class AzureArchiveManager extends java.lang.Object implements SegmentArchiveManager
-
-
Field Summary
Fields Modifier and Type Field Description protected com.microsoft.azure.storage.blob.CloudBlobDirectory
cloudBlobDirectory
protected IOMonitor
ioMonitor
protected FileStoreMonitor
monitor
-
Constructor Summary
Constructors Constructor Description AzureArchiveManager(com.microsoft.azure.storage.blob.CloudBlobDirectory segmentstoreDirectory, IOMonitor ioMonitor, FileStoreMonitor fileStoreMonitor, WriteAccessController writeAccessController)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
backup(@NotNull java.lang.String archiveName, @NotNull java.lang.String backupArchiveName, @NotNull java.util.Set<java.util.UUID> recoveredEntries)
Method is not deleting segments from the directory given witharchiveName
, if they are in the set of recovered segments.void
copyFile(java.lang.String from, java.lang.String to)
Copies the archive with all the segments.SegmentArchiveWriter
create(java.lang.String archiveName)
Creates a new archive.boolean
delete(java.lang.String archiveName)
Deletes the archive if exists.boolean
exists(java.lang.String archiveName)
Check if archive exists.SegmentArchiveReader
forceOpen(java.lang.String archiveName)
Opens an archive that wasn't closed correctly.protected com.microsoft.azure.storage.blob.CloudBlobDirectory
getDirectory(java.lang.String archiveName)
java.util.List<java.lang.String>
listArchives()
List names of the available .tar archives.SegmentArchiveReader
open(java.lang.String archiveName)
Opens a given archive for reading.void
recoverEntries(java.lang.String archiveName, java.util.LinkedHashMap<java.util.UUID,byte[]> entries)
Finds all the segments included in the archive.boolean
renameTo(java.lang.String from, java.lang.String to)
Renames the archive.
-
-
-
Field Detail
-
cloudBlobDirectory
protected final com.microsoft.azure.storage.blob.CloudBlobDirectory cloudBlobDirectory
-
ioMonitor
protected final IOMonitor ioMonitor
-
monitor
protected final FileStoreMonitor monitor
-
-
Constructor Detail
-
AzureArchiveManager
public AzureArchiveManager(com.microsoft.azure.storage.blob.CloudBlobDirectory segmentstoreDirectory, IOMonitor ioMonitor, FileStoreMonitor fileStoreMonitor, WriteAccessController writeAccessController)
-
-
Method Detail
-
listArchives
public java.util.List<java.lang.String> listArchives() throws java.io.IOException
Description copied from interface:SegmentArchiveManager
List names of the available .tar archives.- Specified by:
listArchives
in interfaceSegmentArchiveManager
- Returns:
- archive list
- Throws:
java.io.IOException
-
open
public SegmentArchiveReader open(java.lang.String archiveName) throws java.io.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:
java.io.IOException
-
forceOpen
public SegmentArchiveReader forceOpen(java.lang.String archiveName) throws java.io.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:
java.io.IOException
-
create
public SegmentArchiveWriter create(java.lang.String archiveName) throws java.io.IOException
Description copied from interface:SegmentArchiveManager
Creates a new archive.- Specified by:
create
in interfaceSegmentArchiveManager
- Returns:
- the archive writer
- Throws:
java.io.IOException
-
delete
public boolean delete(java.lang.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(java.lang.String from, java.lang.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(java.lang.String from, java.lang.String to) throws java.io.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:
java.io.IOException
-
exists
public boolean exists(java.lang.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(java.lang.String archiveName, java.util.LinkedHashMap<java.util.UUID,byte[]> entries) throws java.io.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:
java.io.IOException
-
backup
public void backup(@NotNull @NotNull java.lang.String archiveName, @NotNull @NotNull java.lang.String backupArchiveName, @NotNull @NotNull java.util.Set<java.util.UUID> recoveredEntries) throws java.io.IOException
Method is not deleting segments from the directory given witharchiveName
, if they are in the set of recovered segments. Reason for that is because during execution of this method, remote repository can be accessed by another application, and deleting a valid segment can cause consistency issues there.- Specified by:
backup
in interfaceSegmentArchiveManager
- Throws:
java.io.IOException
-
getDirectory
protected com.microsoft.azure.storage.blob.CloudBlobDirectory getDirectory(java.lang.String archiveName) throws java.io.IOException
- Throws:
java.io.IOException
-
-