use of cz.o2.proxima.direct.bulk.DefaultNamingConvention in project proxima-platform by O2-Czech-Republic.
the class ComplexWriteTest method initWriter.
AbstractBulkFileSystemAttributeWriter initWriter() throws IOException {
FileFormat format = FileFormatUtils.getFileFormatFromName("binary", false);
NamingConvention naming = new DefaultNamingConvention(Duration.ofMillis(rollPeriod), "prefix", "suffix");
FileSystem fs = FileSystem.local(new File(tempFolder.newFolder(), UUID.randomUUID().toString()), naming);
return new AbstractBulkFileSystemAttributeWriter(entity, uri, fs, naming, format, direct.getContext(), rollPeriod, allowedLateness) {
@Override
public BulkAttributeWriter.Factory<?> asFactory() {
return repo -> ExceptionUtils.uncheckedFactory(() -> initWriter());
}
@Override
protected void flush(Bulk v) {
try {
List<StreamElement> elements = Lists.newArrayList(format.openReader(v.getPath(), entity));
flushed.addAndGet(elements.size());
log.info("Written {} elements to stamp {}", elements.size(), v.getMaxTs());
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
};
}
use of cz.o2.proxima.direct.bulk.DefaultNamingConvention in project proxima-platform by O2-Czech-Republic.
the class BulkBlobWriterTest method initWriter.
void initWriter(Map<String, Object> cfg) {
accessor = new TestBlobStorageAccessor(TestUtils.createTestFamily(entity, URI.create("blob-test://bucket/path"), cfg), () -> Optional.ofNullable(latch.get()).ifPresent(CountDownLatch::countDown), onFlushToBlob) {
@Override
public NamingConvention getNamingConvention() {
return new DefaultNamingConvention(Duration.ofMillis(getRollPeriod()), "prefix", "suffix", () -> "uuid");
}
};
writer = accessor.new BlobWriter(direct.getContext());
}
Aggregations