Class AzureArchiveManager
- java.lang.Object
-
- org.apache.jackrabbit.oak.segment.azure.AzureArchiveManager
-
- All Implemented Interfaces:
SegmentArchiveManager
public class AzureArchiveManager extends Object implements SegmentArchiveManager
-
-
Field Summary
Fields Modifier and Type Field Description protected IOMonitorioMonitorprotected FileStoreMonitormonitorprotected com.azure.storage.blob.BlobContainerClientreadBlobContainerClientprotected StringrootPrefixprotected com.azure.storage.blob.BlobContainerClientwriteBlobContainerClient
-
Constructor Summary
Constructors Constructor Description AzureArchiveManager(com.azure.storage.blob.BlobContainerClient readBlobContainerClient, com.azure.storage.blob.BlobContainerClient writeBlobContainerClient, String rootPrefix, IOMonitor ioMonitor, FileStoreMonitor fileStoreMonitor, WriteAccessController writeAccessController)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbackup(@NotNull String archiveName, @NotNull String backupArchiveName, @NotNull Set<UUID> recoveredEntries)Method is not deleting segments from the directory given witharchiveName, if they are in the set of recovered segments.voidcopyFile(String from, String to)Copies the archive with all the segments.SegmentArchiveWritercreate(String archiveName)Creates a new archive.booleandelete(String archiveName)Deletes the archive if exists.booleanexists(String archiveName)Check if archive exists.SegmentArchiveReaderforceOpen(String archiveName)Opens an archive that wasn't closed correctly.protected StringgetDirectory(String archiveName)it must end with "/" otherwise we could overflow to other archives like data00000a.tar.bakList<String>listArchives()List names of the available .tar archives.SegmentArchiveReaderopen(String archiveName)Opens a given archive for reading.voidrecoverEntries(String archiveName, LinkedHashMap<UUID,byte[]> entries)Finds all the segments included in the archive.booleanrenameTo(String from, String to)Renames the archive.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.jackrabbit.oak.segment.spi.persistence.SegmentArchiveManager
isReadOnly
-
-
-
-
Field Detail
-
readBlobContainerClient
protected final com.azure.storage.blob.BlobContainerClient readBlobContainerClient
-
writeBlobContainerClient
protected final com.azure.storage.blob.BlobContainerClient writeBlobContainerClient
-
rootPrefix
protected final String rootPrefix
-
ioMonitor
protected final IOMonitor ioMonitor
-
monitor
protected final FileStoreMonitor monitor
-
-
Constructor Detail
-
AzureArchiveManager
public AzureArchiveManager(com.azure.storage.blob.BlobContainerClient readBlobContainerClient, com.azure.storage.blob.BlobContainerClient writeBlobContainerClient, String rootPrefix, IOMonitor ioMonitor, FileStoreMonitor fileStoreMonitor, WriteAccessController writeAccessController)
-
-
Method Detail
-
listArchives
public List<String> listArchives() throws IOException
Description copied from interface:SegmentArchiveManagerList names of the available .tar archives.- Specified by:
listArchivesin interfaceSegmentArchiveManager- Returns:
- archive list
- Throws:
IOException
-
open
public SegmentArchiveReader open(String archiveName) throws IOException
Description copied from interface:SegmentArchiveManagerOpens a given archive for reading.- Specified by:
openin 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:SegmentArchiveManagerOpens an archive that wasn't closed correctly.- Specified by:
forceOpenin 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) throws IOException
Description copied from interface:SegmentArchiveManagerCreates a new archive.- Specified by:
createin interfaceSegmentArchiveManager- Returns:
- the archive writer
- Throws:
IOException
-
delete
public boolean delete(String archiveName)
Description copied from interface:SegmentArchiveManagerDeletes the archive if exists.- Specified by:
deletein interfaceSegmentArchiveManager- Returns:
- true if the archive was removed, false otherwise
-
renameTo
public boolean renameTo(String from, String to)
Description copied from interface:SegmentArchiveManagerRenames the archive.- Specified by:
renameToin 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:SegmentArchiveManagerCopies the archive with all the segments.- Specified by:
copyFilein interfaceSegmentArchiveManager- Parameters:
from- the existing archiveto- new name- Throws:
IOException
-
exists
public boolean exists(String archiveName)
Description copied from interface:SegmentArchiveManagerCheck if archive exists.- Specified by:
existsin 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:SegmentArchiveManagerFinds all the segments included in the archive.- Specified by:
recoverEntriesin 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 IOExceptionMethod 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:
backupin interfaceSegmentArchiveManager- Throws:
IOException
-
-