@Override public SegmentArchiveReader forceOpen(String archiveName) throws IOException { CloudBlobDirectory archiveDirectory = getDirectory(archiveName); return new AzureSegmentArchiveReader(archiveDirectory, ioMonitor); }
@Override public SegmentArchiveWriter create(String archiveName) throws IOException { return new AzureSegmentArchiveWriter(getDirectory(archiveName), ioMonitor, monitor); }
@Override public SegmentArchiveWriter create(String archiveName) throws IOException { return new AzureSegmentArchiveWriter(getDirectory(archiveName), ioMonitor, monitor); }
@Override public SegmentArchiveReader forceOpen(String archiveName) throws IOException { CloudBlobDirectory archiveDirectory = getDirectory(archiveName); return new AzureSegmentArchiveReader(archiveDirectory, ioMonitor); }
private Stream<CloudBlob> getBlobs(String archiveName) throws IOException { return AzureUtilities.getBlobs(getDirectory(archiveName)); }
private Stream<CloudBlob> getBlobs(String archiveName) throws IOException { return AzureUtilities.getBlobs(getDirectory(archiveName)); }
@Override public void copyFile(String from, String to) throws IOException { CloudBlobDirectory targetDirectory = getDirectory(to); getBlobs(from) .forEach(cloudBlob -> { try { copyBlob(cloudBlob, targetDirectory); } catch (IOException e) { log.error("Can't copy segment {}", cloudBlob.getUri().getPath(), e); } }); }
@Override public SegmentArchiveReader open(String archiveName) throws IOException { try { CloudBlobDirectory archiveDirectory = getDirectory(archiveName); if (!archiveDirectory.getBlockBlobReference("closed").exists()) { throw new IOException("The archive " + archiveName + " hasn't been closed correctly."); } return new AzureSegmentArchiveReader(archiveDirectory, ioMonitor); } catch (StorageException | URISyntaxException e) { throw new IOException(e); } }
@Override public void copyFile(String from, String to) throws IOException { CloudBlobDirectory targetDirectory = getDirectory(to); getBlobs(from) .forEach(cloudBlob -> { try { copyBlob(cloudBlob, targetDirectory); } catch (IOException e) { log.error("Can't copy segment {}", cloudBlob.getUri().getPath(), e); } }); }
@Override public SegmentArchiveReader open(String archiveName) throws IOException { try { CloudBlobDirectory archiveDirectory = getDirectory(archiveName); if (!archiveDirectory.getBlockBlobReference("closed").exists()) { throw new IOException("The archive " + archiveName + " hasn't been closed correctly."); } return new AzureSegmentArchiveReader(archiveDirectory, ioMonitor); } catch (StorageException | URISyntaxException e) { throw new IOException(e); } }
@Override public boolean renameTo(String from, String to) { try { CloudBlobDirectory targetDirectory = getDirectory(to); getBlobs(from) .forEach(cloudBlob -> { try { renameBlob(cloudBlob, targetDirectory); } catch (IOException e) { log.error("Can't rename segment {}", cloudBlob.getUri().getPath(), e); } }); return true; } catch (IOException e) { log.error("Can't rename archive {} to {}", from, to, e); return false; } }
@Override public boolean renameTo(String from, String to) { try { CloudBlobDirectory targetDirectory = getDirectory(to); getBlobs(from) .forEach(cloudBlob -> { try { renameBlob(cloudBlob, targetDirectory); } catch (IOException e) { log.error("Can't rename segment {}", cloudBlob.getUri().getPath(), e); } }); return true; } catch (IOException e) { log.error("Can't rename archive {} to {}", from, to, e); return false; } }