introduce index clustering (part 1)
In order to prevent files from getting too big and make it easier to implement retention policies, we are splitting all files into chunks. Each chunk contains the data for a time interval (1 month per default). This first changeset introduces the ClusteredPersistentMap that implements this for PersistentMap. It is used for a couple (not all) of indices.
This commit is contained in:
76
pdb-ui/src/main/java/org/lucares/pdbui/domain/DateRange.java
Normal file
76
pdb-ui/src/main/java/org/lucares/pdbui/domain/DateRange.java
Normal file
@@ -0,0 +1,76 @@
|
||||
package org.lucares.pdbui.domain;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.time.ZoneOffset;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
import org.lucares.pdb.api.DateTimeRange;
|
||||
|
||||
public class DateRange {
|
||||
|
||||
private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
private String startDate;
|
||||
private String endDate;
|
||||
|
||||
DateRange() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param startDate date in format 'yyyy-MM-dd HH:mm:ss'
|
||||
* @param endDate date in format 'yyyy-MM-dd HH:mm:ss'
|
||||
*/
|
||||
public DateRange(final String startDate, final String endDate) {
|
||||
this.startDate = startDate;
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return date in format 'yyyy-MM-dd HH:mm:ss'
|
||||
*/
|
||||
public String getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param startDate date in format 'yyyy-MM-dd HH:mm:ss'
|
||||
*/
|
||||
public void setStartDate(final String startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return date in format 'yyyy-MM-dd HH:mm:ss'
|
||||
*/
|
||||
public String getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param endDate date in format 'yyyy-MM-dd HH:mm:ss'
|
||||
*/
|
||||
public void setEndDate(final String endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return startDate + " - " + endDate;
|
||||
}
|
||||
|
||||
public DateTimeRange toDateTimeRange() {
|
||||
|
||||
final OffsetDateTime start = LocalDateTime.parse(startDate, DATE_FORMAT).atOffset(ZoneOffset.UTC);
|
||||
final OffsetDateTime end = LocalDateTime.parse(endDate, DATE_FORMAT).atOffset(ZoneOffset.UTC);
|
||||
|
||||
return new DateTimeRange(start, end);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user