public Map<String, String> getAzurePaths(final DataSegment segment) { final String storageDir = DataSegmentPusherUtil.getStorageDir(segment); return ImmutableMap.of( "index", String.format("%s/%s", storageDir, AzureStorageDruidModule.INDEX_ZIP_FILE_NAME), "descriptor", String.format("%s/%s", storageDir, AzureStorageDruidModule.DESCRIPTOR_FILE_NAME) ); }
public StorageLocation findStorageLocationIfLoaded(final DataSegment segment) { for (StorageLocation location : locations) { File localStorageDir = new File(location.getPath(), DataSegmentPusherUtil.getStorageDir(segment)); if (localStorageDir.exists()) { return location; } } return null; }
@Override public void cleanup(DataSegment segment) throws SegmentLoadingException { if (!config.isDeleteOnRemove()) { return; } StorageLocation loc = findStorageLocationIfLoaded(segment); if (loc == null) { log.info("Asked to cleanup something[%s] that didn't exist. Skipping.", segment); return; } try { File cacheFile = new File(loc.getPath(), DataSegmentPusherUtil.getStorageDir(segment)); log.info("Deleting directory[%s]", cacheFile); FileUtils.deleteDirectory(cacheFile); loc.removeSegment(segment); } catch (IOException e) { throw new SegmentLoadingException(e, e.getMessage()); } }
File storageDir = new File(loc.getPath(), DataSegmentPusherUtil.getStorageDir(segment)); if (!storageDir.mkdirs()) { log.debug("Unable to make parent file[%s]", storageDir); retVal = new File(loc.getPath(), DataSegmentPusherUtil.getStorageDir(segment));
String key = JOINER.join( config.getKeyspace().isEmpty() ? null : config.getKeyspace(), DataSegmentPusherUtil.getStorageDir(segment) );
@Override public DataSegment push(File dataSegmentFile, DataSegment segment) throws IOException { File outDir = new File(config.getStorageDirectory(), DataSegmentPusherUtil.getStorageDir(segment)); if (dataSegmentFile.equals(outDir)) { long size = 0; for (File file : dataSegmentFile.listFiles()) { size += file.length(); } return createDescriptorFile( segment.withLoadSpec(makeLoadSpec(outDir)) .withSize(size) .withBinaryVersion(SegmentUtils.getVersionFromDir(dataSegmentFile)), outDir ); } outDir.mkdirs(); File outFile = new File(outDir, "index.zip"); log.info("Compressing files from[%s] to [%s]", dataSegmentFile, outFile); long size = CompressionUtils.zip(dataSegmentFile, outFile); return createDescriptorFile( segment.withLoadSpec(makeLoadSpec(outFile)) .withSize(size) .withBinaryVersion(SegmentUtils.getVersionFromDir(dataSegmentFile)), outDir ); }