Search in sources :

Example 1 with ByzantineWriter

use of com.srotya.sidewinder.core.storage.compression.byzantine.ByzantineWriter in project sidewinder by srotya.

the class TestDiskStorageEngine method testSeriesToDataPointConversion.

@Test
public void testSeriesToDataPointConversion() throws IOException {
    List<DataPoint> points = new ArrayList<>();
    long headerTimestamp = System.currentTimeMillis();
    HashMap<String, String> map = new HashMap<>();
    map.put("metadata.dir", "target/db1/mdq");
    map.put("index.dir", "target/db1/index");
    map.put("data.dir", "target/db1/data");
    map.put(StorageEngine.PERSISTENCE_DISK, "true");
    ByteBuffer buf = ByteBuffer.allocate(100);
    Writer timeSeries = new ByzantineWriter();
    timeSeries.configure(map, buf, true, 1, false);
    timeSeries.setHeaderTimestamp(headerTimestamp);
    timeSeries.addValue(headerTimestamp, 1L);
    TimeSeries.seriesToDataPoints("value", Arrays.asList("test=1"), points, timeSeries, null, null, false);
    assertEquals(1, points.size());
    points.clear();
    Predicate timepredicate = new BetweenPredicate(Long.MAX_VALUE, Long.MAX_VALUE);
    TimeSeries.seriesToDataPoints("value", Arrays.asList("test=1"), points, timeSeries, timepredicate, null, false);
    assertEquals(0, points.size());
}
Also used : BetweenPredicate(com.srotya.sidewinder.core.predicates.BetweenPredicate) DataPoint(com.srotya.sidewinder.core.storage.DataPoint) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) ByzantineWriter(com.srotya.sidewinder.core.storage.compression.byzantine.ByzantineWriter) ArrayList(java.util.ArrayList) ByteBuffer(java.nio.ByteBuffer) Writer(com.srotya.sidewinder.core.storage.compression.Writer) ByzantineWriter(com.srotya.sidewinder.core.storage.compression.byzantine.ByzantineWriter) BetweenPredicate(com.srotya.sidewinder.core.predicates.BetweenPredicate) Predicate(com.srotya.sidewinder.core.predicates.Predicate) Test(org.junit.Test)

Example 2 with ByzantineWriter

use of com.srotya.sidewinder.core.storage.compression.byzantine.ByzantineWriter in project sidewinder by srotya.

the class TestMemStorageEngine method testSeriesToDataPointConversion.

@Test
public void testSeriesToDataPointConversion() throws IOException {
    List<DataPoint> points = new ArrayList<>();
    long headerTimestamp = System.currentTimeMillis();
    ByteBuffer buf = ByteBuffer.allocate(1024);
    Writer timeSeries = new ByzantineWriter();
    timeSeries.configure(conf, buf, true, 1, false);
    timeSeries.setHeaderTimestamp(headerTimestamp);
    timeSeries.addValue(headerTimestamp, 1L);
    TimeSeries.seriesToDataPoints("value", Arrays.asList("test=2"), points, timeSeries, null, null, false);
    assertEquals(1, points.size());
    points.clear();
    Predicate timepredicate = new BetweenPredicate(Long.MAX_VALUE, Long.MAX_VALUE);
    TimeSeries.seriesToDataPoints("value", Arrays.asList("test=2"), points, timeSeries, timepredicate, null, false);
    assertEquals(0, points.size());
}
Also used : BetweenPredicate(com.srotya.sidewinder.core.predicates.BetweenPredicate) DataPoint(com.srotya.sidewinder.core.storage.DataPoint) ByzantineWriter(com.srotya.sidewinder.core.storage.compression.byzantine.ByzantineWriter) ArrayList(java.util.ArrayList) ByteBuffer(java.nio.ByteBuffer) Writer(com.srotya.sidewinder.core.storage.compression.Writer) ByzantineWriter(com.srotya.sidewinder.core.storage.compression.byzantine.ByzantineWriter) Predicate(com.srotya.sidewinder.core.predicates.Predicate) BetweenPredicate(com.srotya.sidewinder.core.predicates.BetweenPredicate) Test(org.junit.Test)

Aggregations

BetweenPredicate (com.srotya.sidewinder.core.predicates.BetweenPredicate)2 Predicate (com.srotya.sidewinder.core.predicates.Predicate)2 DataPoint (com.srotya.sidewinder.core.storage.DataPoint)2 Writer (com.srotya.sidewinder.core.storage.compression.Writer)2 ByzantineWriter (com.srotya.sidewinder.core.storage.compression.byzantine.ByzantineWriter)2 ByteBuffer (java.nio.ByteBuffer)2 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1