new file format

Store values in sequences of variable length. Instead of using 8 bytes
per entry we are now using between 2 and 20 bytes. But we are also able
to store every non-negative long value.
This commit is contained in:
2016-12-27 10:24:56 +01:00
parent c5f0e8514c
commit db0b3d6d24
19 changed files with 522 additions and 350 deletions

View File

@@ -13,8 +13,6 @@ public class Entry {
*/
public static final Entry POISON = new Entry(0, -1);
public static final long MAX_VALUE = 0xFF_FF_FF_FFL;
private final long epochMilli;
private final long value;
@@ -28,8 +26,8 @@ public class Entry {
}
public Entry(final long epochMilli, final long value, final Tags tags) {
if (value < 0 || value > MAX_VALUE) {
throw new IllegalArgumentException("value must be between 0 and " + MAX_VALUE + ", but was " + value);
if (value < 0) {
throw new IllegalArgumentException("value must be between 0 and " + Long.MAX_VALUE + ", but was " + value);
}
this.epochMilli = epochMilli;

View File

@@ -10,7 +10,9 @@ import java.util.TreeSet;
import java.util.function.BiConsumer;
public class Tags {
static final Tags EMPTY = new Tags();
// TODO @ahr move class to org.lcuares.performance.db and make this package
// private
public static final Tags EMPTY = new Tags();
private final Map<String, Tag> tags;