forked from influxdata/influxdb-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInfluxDB.java
More file actions
164 lines (145 loc) · 4.08 KB
/
InfluxDB.java
File metadata and controls
164 lines (145 loc) · 4.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
package org.influxdb;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.influxdb.dto.BatchPoints;
import org.influxdb.dto.Point;
import org.influxdb.dto.Pong;
import org.influxdb.dto.Query;
import org.influxdb.dto.QueryResult;
/**
* Interface with all available methods to access a InfluxDB database.
*
* A full list of currently available interfaces is implemented in:
*
* <a
* href="https://github.com/influxdb/influxdb/blob/master/src/api/http/api.go">https://github.com/
* influxdb/influxdb/blob/master/src/api/http/api.go</a>
*
* @author stefan.majer [at] gmail.com
*
*/
public interface InfluxDB {
/** Controls the level of logging of the REST layer. */
public enum LogLevel {
/** No logging. */
NONE,
/** Log only the request method and URL and the response status code and execution time. */
BASIC,
/** Log the basic information along with request and response headers. */
HEADERS,
/**
* Log the headers, body, and metadata for both requests and responses.
* <p>
* Note: This requires that the entire request and response body be buffered in memory!
*/
FULL;
}
/**
* ConsistencyLevel for write Operations.
*/
public enum ConsistencyLevel {
/** Write succeeds only if write reached all cluster members. */
ALL("all"),
/** Write succeeds if write reached any cluster members. */
ANY("any"),
/** Write succeeds if write reached at least one cluster members. */
ONE("one"),
/** Write succeeds only if write reached a quorum of cluster members. */
QUORUM("quorum");
private final String value;
private ConsistencyLevel(final String value) {
this.value = value;
}
/**
* Get the String value of the ConsistencyLevel.
*
* @return the lowercase String.
*/
public String value() {
return this.value;
}
}
/**
* Set the loglevel which is used for REST related actions.
*
* @param logLevel
* the loglevel to set.
* @return the InfluxDB instance to be able to use it in a fluent manner.
*/
public InfluxDB setLogLevel(final LogLevel logLevel);
/**
* Enable Batching of single Point writes to speed up writes significant. If either actions or
* flushDurations is reached first, a batchwrite is issued.
*
* @param actions
* the number of actions to collect
* @param flushDuration
* the time to wait at most.
* @param flushDurationTimeUnit
* @return the InfluxDB instance to be able to use it in a fluent manner.
*/
public InfluxDB enableBatch(final int actions, final int flushDuration, final TimeUnit flushDurationTimeUnit);
/**
* Disable Batching.
*/
public void disableBatch();
/**
* Ping this influxDB-
*
* @return the response of the ping execution.
*/
public Pong ping();
/**
* Return the version of the connected influxDB Server.
*
* @return the version String, otherwise unknown.
*/
public String version();
/**
* Write a single Point to the database.
*
* @param database
* the database to write to.
* @param retentionPolicy
* the retentionPolicy to use.
* @param point
* The point to write
*/
public void write(final String database, final String retentionPolicy, final Point point);
/**
* Write a set of Points to the influxdb database with the new (>= 0.9.0rc32) lineprotocol.
*
* {@linkplain "https://github.com/influxdb/influxdb/pull/2696"}
*
* @param batchPoints
*/
public void write(final BatchPoints batchPoints);
/**
* Execute a query agains a database.
*
* @param query
* the query to execute.
* @return a List of Series which matched the query.
*/
public QueryResult query(final Query query);
/**
* Create a new Database.
*
* @param name
* the name of the new database.
*/
public void createDatabase(final String name);
/**
* Delete a database.
*
* @param name
* the name of the database to delete.
*/
public void deleteDatabase(final String name);
/**
* Describe all available databases.
*
* @return a List of all Database names.
*/
public List<String> describeDatabases();
}