use of com.srotya.sidewinder.core.storage.mem.MemStorageEngine in project sidewinder by srotya.
the class TestDatabaseOpsApi method testQuerySeries.
@Test
public void testQuerySeries() throws IOException {
MemStorageEngine engine = new MemStorageEngine();
engine.configure(new HashMap<>(), null);
engine.startup();
Builder dp = Point.newBuilder();
dp.setDbName("test1");
dp.addFp(false);
dp.addValue(1L);
dp.setMeasurementName("cpu");
dp.setTimestamp(System.currentTimeMillis());
dp.addAllTags(Arrays.asList(Tag.newBuilder().setTagKey("host").setTagValue("1").build(), Tag.newBuilder().setTagKey("vm").setTagValue("1").build()));
dp.addValueFieldName("value");
engine.writeDataPointWithLock(dp.build(), false);
DatabaseOpsApi api = new DatabaseOpsApi(engine);
String querySeries = api.querySeries("test1", "2000-12-10T10:10:10<cpu.value.host=1|te=2&vm=1<2020-12-10T10:10:10");
JsonArray results = new Gson().fromJson(querySeries, JsonArray.class);
assertEquals(1, results.size());
querySeries = api.querySeries("test1", "2000-12-10T10:10:10<cpu.value.host=2<2020-12-10T10:10:10");
results = new Gson().fromJson(querySeries, JsonArray.class);
assertEquals(0, results.size());
querySeries = api.querySeries("test1", "2000-12-10T10:10:10<cpu.value.vm=1<2020-12-10T10:10:10");
results = new Gson().fromJson(querySeries, JsonArray.class);
assertEquals(1, results.size());
System.out.println(results);
}
use of com.srotya.sidewinder.core.storage.mem.MemStorageEngine in project sidewinder by srotya.
the class TestGRPWriterServiceImpl method beforeClass.
@BeforeClass
public static void beforeClass() throws Exception {
ScheduledExecutorService bgTaskPool = Executors.newScheduledThreadPool(1);
engine = new MemStorageEngine();
engine.configure(new HashMap<>(), bgTaskPool);
int port = 50051;
server = ServerBuilder.forPort(port).decompressorRegistry(DecompressorRegistry.getDefaultInstance()).addService(new WriterServiceImpl(engine, new HashMap<>())).build().start();
System.out.println("Server started, listening on " + port);
channel = ManagedChannelBuilder.forAddress("localhost", port).compressorRegistry(CompressorRegistry.getDefaultInstance()).usePlaintext(true).build();
}
use of com.srotya.sidewinder.core.storage.mem.MemStorageEngine in project sidewinder by srotya.
the class TestMappedBitmapTagIndex method before.
@BeforeClass
public static void before() throws IOException {
engine = new MemStorageEngine();
engine.configure(new HashMap<>(), Executors.newScheduledThreadPool(1));
}
use of com.srotya.sidewinder.core.storage.mem.MemStorageEngine in project sidewinder by srotya.
the class TestTagIndices method beforeClass.
@BeforeClass
public static void beforeClass() throws IOException {
engine = new MemStorageEngine();
engine.configure(new HashMap<>(), Executors.newScheduledThreadPool(1));
}
use of com.srotya.sidewinder.core.storage.mem.MemStorageEngine in project sidewinder by srotya.
the class TestSchemaAndBasicQueries method testDatabaseSchemaFail.
@Test
public void testDatabaseSchemaFail() throws Exception {
StorageEngine engine = new MemStorageEngine();
engine.configure(new HashMap<>(), null);
engine.getOrCreateMeasurement("db1", "m1");
try {
new SidewinderDatabaseSchema(engine, null, 100);
fail("Must throw exception");
} catch (Exception e) {
}
}
Aggregations