Skip to content

Commit d58e025

Browse files
committed
Added fake datastore and service key store so kairos can run in pure remote mode.
1 parent c6ff44f commit d58e025

File tree

6 files changed

+122
-2
lines changed

6 files changed

+122
-2
lines changed

build.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ saw.setProperty(Tablesaw.PROP_MULTI_THREAD_OUTPUT, Tablesaw.PROP_VALUE_ON)
2828

2929
programName = "kairos-remote"
3030
//Do not use '-' in version string, it breaks rpm uninstall.
31-
version = "1.0"
31+
version = "1.1"
3232
release = saw.getProperty("KAIROS_RELEASE_NUMBER", "1") //package release number
3333
summary = "KairosDB Remote"
3434
description = """\

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>org.kairosdb</groupId>
66
<artifactId>kairos-remote</artifactId>
7-
<version>1.0</version>
7+
<version>1.1</version>
88
<packaging>jar</packaging>
99

1010
<name>kairos-remote</name>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package org.kairosdb.plugin.remote;
2+
3+
import org.kairosdb.core.datastore.Datastore;
4+
import org.kairosdb.core.datastore.DatastoreMetricQuery;
5+
import org.kairosdb.core.datastore.QueryCallback;
6+
import org.kairosdb.core.datastore.TagSet;
7+
import org.kairosdb.core.datastore.TagSetImpl;
8+
import org.kairosdb.core.exception.DatastoreException;
9+
10+
import java.util.Collections;
11+
12+
public class FakeDatastore implements Datastore
13+
{
14+
@Override
15+
public void close() throws InterruptedException, DatastoreException
16+
{
17+
18+
}
19+
20+
@Override
21+
public Iterable<String> getMetricNames(String prefix) throws DatastoreException
22+
{
23+
return Collections.emptyList();
24+
}
25+
26+
@Override
27+
public Iterable<String> getTagNames() throws DatastoreException
28+
{
29+
return Collections.emptyList();
30+
}
31+
32+
@Override
33+
public Iterable<String> getTagValues() throws DatastoreException
34+
{
35+
return Collections.emptyList();
36+
}
37+
38+
@Override
39+
public void queryDatabase(DatastoreMetricQuery query, QueryCallback queryCallback) throws DatastoreException
40+
{
41+
42+
}
43+
44+
@Override
45+
public void deleteDataPoints(DatastoreMetricQuery deleteQuery) throws DatastoreException
46+
{
47+
48+
}
49+
50+
@Override
51+
public TagSet queryMetricTags(DatastoreMetricQuery query) throws DatastoreException
52+
{
53+
return new TagSetImpl();
54+
}
55+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package org.kairosdb.plugin.remote;
2+
3+
import com.google.inject.AbstractModule;
4+
import com.google.inject.Scopes;
5+
import org.kairosdb.core.datastore.Datastore;
6+
import org.kairosdb.core.datastore.ServiceKeyStore;
7+
8+
public class FakeDatastoreModule extends AbstractModule
9+
10+
{
11+
@Override
12+
protected void configure()
13+
{
14+
bind(Datastore.class).to(FakeDatastore.class).in(Scopes.SINGLETON);
15+
bind(ServiceKeyStore.class).to(FakeServiceKeyStore.class).in(Scopes.SINGLETON);
16+
}
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package org.kairosdb.plugin.remote;
2+
3+
import org.kairosdb.core.datastore.ServiceKeyStore;
4+
import org.kairosdb.core.exception.DatastoreException;
5+
6+
import java.util.Collections;
7+
8+
public class FakeServiceKeyStore implements ServiceKeyStore
9+
{
10+
@Override
11+
public void setValue(String service, String serviceKey, String key, String value) throws DatastoreException
12+
{
13+
14+
}
15+
16+
@Override
17+
public String getValue(String service, String serviceKey, String key) throws DatastoreException
18+
{
19+
return null;
20+
}
21+
22+
@Override
23+
public Iterable<String> listServiceKeys(String service) throws DatastoreException
24+
{
25+
return Collections.emptyList();
26+
}
27+
28+
@Override
29+
public Iterable<String> listKeys(String service, String serviceKey) throws DatastoreException
30+
{
31+
return Collections.emptyList();
32+
}
33+
34+
@Override
35+
public Iterable<String> listKeys(String service, String serviceKey, String keyStartsWith) throws DatastoreException
36+
{
37+
return Collections.emptyList();
38+
}
39+
40+
@Override
41+
public void deleteKey(String service, String serviceKey, String key) throws DatastoreException
42+
{
43+
44+
}
45+
}

src/main/resources/kairos-remote.properties

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
# Sample use case is to run clusters in parallel before migrating to larger cluster
77
#kairosdb.service.remote=org.kairosdb.plugin.remote.ListenerModule
88

9+
# If you want kairos to run without any local datastore you can uncomment this line
10+
#kairosdb.service.datastore=org.kairosdb.plugin.remote.FakeDatastoreModule
11+
912
# Location to store data locally before it is sent off
1013
kairosdb.remote.data_dir=.
1114
kairosdb.remote.remote_url=http://10.92.1.41:8080

0 commit comments

Comments
 (0)