use of de.invesdwin.util.time.duration.Duration in project invesdwin-context-persistence by subes.
the class ADatabasePerformanceTest method printProgress.
protected void printProgress(final String action, final Instant start, final long count, final int maxCount) {
final Duration duration = start.toDuration();
log.info("%s: %s/%s (%s) %s during %s", action, count, maxCount, new Percent(count, maxCount).toString(PercentScale.PERCENT), new ProcessedEventsRateString(count, duration), duration);
}
use of de.invesdwin.util.time.duration.Duration in project invesdwin-context-persistence by subes.
the class ADelegateDailyDownloadTableRequest method printProgress.
protected void printProgress(final String action, final Instant start, final int count) {
final Duration duration = start.toDuration();
log.info("%s: %s %s during %s", action, count, new ProcessedEventsRateString(count, duration), duration);
}
use of de.invesdwin.util.time.duration.Duration in project invesdwin-context-persistence by subes.
the class ASegmentedTimeSeriesDBWithCacheTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
final AHistoricalCache<TimeRange> segmentFinder = PeriodicalSegmentFinder.newCache(new Duration(2, FTimeUnit.YEARS), false);
table = new ASegmentedTimeSeriesDB<String, FDate>(getClass().getSimpleName()) {
@Override
public AHistoricalCache<TimeRange> getSegmentFinder(final String key) {
return segmentFinder;
}
@Override
protected ISerde<FDate> newValueSerde() {
return new TypeDelegateSerde<FDate>(FDate.class);
}
@Override
protected Integer newValueFixedLength() {
return null;
}
@Override
protected String innerHashKeyToString(final String key) {
return key;
}
@Override
protected File getBaseDirectory() {
return ContextProperties.TEMP_DIRECTORY;
}
@Override
protected ICloseableIterable<? extends FDate> downloadSegmentElements(final SegmentedKey<String> segmentedKey) {
return new ASkippingIterable<FDate>(WrapperCloseableIterable.maybeWrap(entities)) {
private final FDate from = segmentedKey.getSegment().getFrom();
private final FDate to = segmentedKey.getSegment().getTo();
@Override
protected boolean skip(final FDate element) {
return element.isBefore(from) || element.isAfter(to);
}
};
}
@Override
protected FDate extractEndTime(final FDate value) {
return value;
}
@Override
public FDate getFirstAvailableHistoricalSegmentFrom(final String key) {
if (entities.isEmpty()) {
return null;
}
return segmentFinder.query().getValue(entities.get(0)).getFrom();
}
@Override
public FDate getLastAvailableHistoricalSegmentTo(final String key, final FDate updateTo) {
if (entities.isEmpty()) {
return null;
}
return segmentFinder.query().getValue(entities.get(entities.size() - 1)).getTo();
}
@Override
protected String getElementsName() {
return "values";
}
};
}
use of de.invesdwin.util.time.duration.Duration in project invesdwin-context-persistence by subes.
the class ASegmentedTimeSeriesDBWithUnlimitedCacheTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
final AHistoricalCache<TimeRange> segmentFinder = PeriodicalSegmentFinder.newCache(new Duration(2, FTimeUnit.YEARS), false);
table = new ASegmentedTimeSeriesDB<String, FDate>(getClass().getSimpleName()) {
@Override
public AHistoricalCache<TimeRange> getSegmentFinder(final String key) {
return segmentFinder;
}
@Override
protected ISerde<FDate> newValueSerde() {
return new TypeDelegateSerde<FDate>(FDate.class);
}
@Override
protected Integer newValueFixedLength() {
return null;
}
@Override
protected String innerHashKeyToString(final String key) {
return key;
}
@Override
protected File getBaseDirectory() {
return ContextProperties.TEMP_DIRECTORY;
}
@Override
protected ICloseableIterable<? extends FDate> downloadSegmentElements(final SegmentedKey<String> segmentedKey) {
return new ASkippingIterable<FDate>(WrapperCloseableIterable.maybeWrap(entities)) {
private final FDate from = segmentedKey.getSegment().getFrom();
private final FDate to = segmentedKey.getSegment().getTo();
@Override
protected boolean skip(final FDate element) {
return element.isBefore(from) || element.isAfter(to);
}
};
}
@Override
protected FDate extractEndTime(final FDate value) {
return value;
}
@Override
public FDate getFirstAvailableHistoricalSegmentFrom(final String key) {
if (entities.isEmpty()) {
return null;
}
return segmentFinder.query().getValue(entities.get(0)).getFrom();
}
@Override
public FDate getLastAvailableHistoricalSegmentTo(final String key, final FDate updateTo) {
if (entities.isEmpty()) {
return null;
}
return segmentFinder.query().getValue(entities.get(entities.size() - 1)).getTo();
}
@Override
protected String getElementsName() {
return "values";
}
};
}
use of de.invesdwin.util.time.duration.Duration in project invesdwin-context-persistence by subes.
the class ASegmentedTimeSeriesDBWithNoCacheTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
final AHistoricalCache<TimeRange> segmentFinder = PeriodicalSegmentFinder.newCache(new Duration(2, FTimeUnit.YEARS), false);
table = new ASegmentedTimeSeriesDB<String, FDate>(getClass().getSimpleName()) {
@Override
public AHistoricalCache<TimeRange> getSegmentFinder(final String key) {
return segmentFinder;
}
@Override
protected ISerde<FDate> newValueSerde() {
return new TypeDelegateSerde<FDate>(FDate.class);
}
@Override
protected Integer newValueFixedLength() {
return null;
}
@Override
protected String innerHashKeyToString(final String key) {
return key;
}
@Override
protected File getBaseDirectory() {
return ContextProperties.TEMP_DIRECTORY;
}
@Override
protected ICloseableIterable<? extends FDate> downloadSegmentElements(final SegmentedKey<String> segmentedKey) {
return new ASkippingIterable<FDate>(WrapperCloseableIterable.maybeWrap(entities)) {
private final FDate from = segmentedKey.getSegment().getFrom();
private final FDate to = segmentedKey.getSegment().getTo();
@Override
protected boolean skip(final FDate element) {
return element.isBefore(from) || element.isAfter(to);
}
};
}
@Override
protected FDate extractEndTime(final FDate value) {
return value;
}
@Override
public FDate getFirstAvailableHistoricalSegmentFrom(final String key) {
if (entities.isEmpty()) {
return null;
}
return segmentFinder.query().getValue(entities.get(0)).getFrom();
}
@Override
public FDate getLastAvailableHistoricalSegmentTo(final String key, final FDate updateTo) {
if (entities.isEmpty()) {
return null;
}
return segmentFinder.query().getValue(entities.get(entities.size() - 1)).getTo();
}
@Override
protected String getElementsName() {
return "values";
}
};
}
Aggregations