InfluxDB.ConsistencyLevel, InfluxDB.LogLevel
Constructor and Description |
---|
InfluxDBImpl(String url,
String username,
String password,
okhttp3.OkHttpClient.Builder client) |
InfluxDBImpl(String url,
String username,
String password,
okhttp3.OkHttpClient.Builder client,
String database,
String retentionPolicy,
InfluxDB.ConsistencyLevel consistency) |
Modifier and Type | Method and Description |
---|---|
void |
close()
close thread for asynchronous batch write and UDP socket to release resources if need.
|
void |
createDatabase(String name)
Create a new Database.
|
void |
createRetentionPolicy(String rpName,
String database,
String duration,
int replicationFactor,
boolean isDefault)
Creates a retentionPolicy.
|
void |
createRetentionPolicy(String rpName,
String database,
String duration,
String shardDuration,
int replicationFactor)
Creates a retentionPolicy.
|
void |
createRetentionPolicy(String rpName,
String database,
String duration,
String shardDuration,
int replicationFactor,
boolean isDefault)
Creates a retentionPolicy.
|
boolean |
databaseExists(String name)
Check if a database exists.
|
void |
deleteDatabase(String name)
Delete a database.
|
List<String> |
describeDatabases()
Describe all available databases.
|
void |
disableBatch()
Disable Batching.
|
InfluxDB |
disableGzip()
Disable Gzip compress for http request body.
|
void |
dropRetentionPolicy(String rpName,
String database)
Drops a retentionPolicy in a database.
|
InfluxDB |
enableBatch(int actions,
int flushDuration,
TimeUnit flushDurationTimeUnit)
Enable batching of single Point writes as
InfluxDB.enableBatch(int, int, TimeUnit, ThreadFactory) }
using default thread factory. |
InfluxDB |
enableBatch(int actions,
int flushDuration,
TimeUnit flushDurationTimeUnit,
ThreadFactory threadFactory)
Enable batching of single Point writes as
InfluxDB.enableBatch(int, int, TimeUnit, ThreadFactory, BiConsumer)
using with a exceptionHandler that does nothing. |
InfluxDB |
enableBatch(int actions,
int flushDuration,
TimeUnit flushDurationTimeUnit,
ThreadFactory threadFactory,
BiConsumer<Iterable<Point>,Throwable> exceptionHandler)
Enable batching of single Point writes to speed up writes significant.
|
InfluxDB |
enableGzip()
Enable Gzip compress for http request body.
|
void |
flush()
Send any buffered points to InfluxDB.
|
boolean |
isBatchEnabled()
Returns whether Batching is enabled.
|
boolean |
isGzipEnabled()
Returns whether Gzip compress for http request body is enabled.
|
Pong |
ping()
Ping this influxDB.
|
QueryResult |
query(Query query)
Execute a query against a database.
|
void |
query(Query query,
Consumer<QueryResult> onSuccess,
Consumer<Throwable> onFailure)
Execute a query against a database.
|
void |
query(Query query,
int chunkSize,
Consumer<QueryResult> consumer)
Execute a streaming query against a database.
|
QueryResult |
query(Query query,
TimeUnit timeUnit)
Execute a query against a database.
|
InfluxDB |
setConsistency(InfluxDB.ConsistencyLevel consistency)
Set the consistency level which is used for writing points.
|
InfluxDB |
setDatabase(String database)
Set the database which is used for writing points.
|
InfluxDB |
setLogLevel(InfluxDB.LogLevel logLevel)
Set the loglevel which is used for REST related actions.
|
InfluxDB |
setRetentionPolicy(String retentionPolicy)
Set the retention policy which is used for writing points.
|
String |
version()
Return the version of the connected influxDB Server.
|
void |
write(BatchPoints batchPoints)
Write a set of Points to the influxdb database with the new (>= 0.9.0rc32) lineprotocol.
|
void |
write(int udpPort,
List<String> records)
Write a set of Points to the influxdb database with the list of string records through UDP.
|
void |
write(int udpPort,
Point point)
Write a single Point to the database through UDP.
|
void |
write(int udpPort,
String records)
Write a set of Points to the influxdb database with the string records through UDP.
|
void |
write(List<String> records)
Write a set of Points to the default database with the list of string records.
|
void |
write(Point point)
Write a single Point to the default database.
|
void |
write(String records)
Write a set of Points to the default database with the string records.
|
void |
write(String database,
String retentionPolicy,
InfluxDB.ConsistencyLevel consistency,
List<String> records)
Write a set of Points to the influxdb database with the list of string records.
|
void |
write(String database,
String retentionPolicy,
InfluxDB.ConsistencyLevel consistency,
String records)
Write a set of Points to the influxdb database with the string records.
|
void |
write(String database,
String retentionPolicy,
Point point)
Write a single Point to the database.
|
public InfluxDBImpl(String url, String username, String password, okhttp3.OkHttpClient.Builder client)
public InfluxDB setLogLevel(InfluxDB.LogLevel logLevel)
InfluxDB
setLogLevel
in interface InfluxDB
logLevel
- the loglevel to set.public InfluxDB enableGzip()
enableGzip
in interface InfluxDB
public InfluxDB disableGzip()
disableGzip
in interface InfluxDB
public boolean isGzipEnabled()
isGzipEnabled
in interface InfluxDB
public InfluxDB enableBatch(int actions, int flushDuration, TimeUnit flushDurationTimeUnit)
InfluxDB
InfluxDB.enableBatch(int, int, TimeUnit, ThreadFactory)
}
using default thread factory.enableBatch
in interface InfluxDB
actions
- the number of actions to collectflushDuration
- the time to wait at most.flushDurationTimeUnit
- the TimeUnit for the given flushDuration.InfluxDB.enableBatch(int, int, TimeUnit, ThreadFactory)
public InfluxDB enableBatch(int actions, int flushDuration, TimeUnit flushDurationTimeUnit, ThreadFactory threadFactory)
InfluxDB
InfluxDB.enableBatch(int, int, TimeUnit, ThreadFactory, BiConsumer)
using with a exceptionHandler that does nothing.enableBatch
in interface InfluxDB
actions
- the number of actions to collectflushDuration
- the time to wait at most.flushDurationTimeUnit
- the TimeUnit for the given flushDuration.threadFactory
- a ThreadFactory instance to be used.InfluxDB.enableBatch(int, int, TimeUnit, ThreadFactory, BiConsumer)
public InfluxDB enableBatch(int actions, int flushDuration, TimeUnit flushDurationTimeUnit, ThreadFactory threadFactory, BiConsumer<Iterable<Point>,Throwable> exceptionHandler)
InfluxDB
enableBatch
in interface InfluxDB
actions
- the number of actions to collectflushDuration
- the time to wait at most.flushDurationTimeUnit
- the TimeUnit for the given flushDuration.threadFactory
- a ThreadFactory instance to be used.exceptionHandler
- a consumer function to handle asynchronous errorspublic void disableBatch()
InfluxDB
disableBatch
in interface InfluxDB
public boolean isBatchEnabled()
InfluxDB
isBatchEnabled
in interface InfluxDB
public String version()
InfluxDB
public void write(Point point)
InfluxDB
public void write(String records)
InfluxDB
public void write(List<String> records)
InfluxDB
public void write(String database, String retentionPolicy, Point point)
InfluxDB
public void write(int udpPort, Point point)
public void write(BatchPoints batchPoints)
InfluxDB
public void write(String database, String retentionPolicy, InfluxDB.ConsistencyLevel consistency, String records)
InfluxDB
public void write(String database, String retentionPolicy, InfluxDB.ConsistencyLevel consistency, List<String> records)
InfluxDB
public void write(int udpPort, String records)
public void write(int udpPort, List<String> records)
public QueryResult query(Query query)
public void query(Query query, Consumer<QueryResult> onSuccess, Consumer<Throwable> onFailure)
public void query(Query query, int chunkSize, Consumer<QueryResult> consumer)
public QueryResult query(Query query, TimeUnit timeUnit)
public void createDatabase(String name)
createDatabase
in interface InfluxDB
name
- the name of the new database.public void deleteDatabase(String name)
deleteDatabase
in interface InfluxDB
name
- the name of the database to delete.public List<String> describeDatabases()
describeDatabases
in interface InfluxDB
public boolean databaseExists(String name)
databaseExists
in interface InfluxDB
name
- the name of the database to search.public void flush()
public void close()
public InfluxDB setConsistency(InfluxDB.ConsistencyLevel consistency)
InfluxDB
setConsistency
in interface InfluxDB
consistency
- the consistency level to set.public InfluxDB setDatabase(String database)
InfluxDB
setDatabase
in interface InfluxDB
database
- the database to set.public InfluxDB setRetentionPolicy(String retentionPolicy)
InfluxDB
setRetentionPolicy
in interface InfluxDB
retentionPolicy
- the retention policy to set.public void createRetentionPolicy(String rpName, String database, String duration, String shardDuration, int replicationFactor, boolean isDefault)
createRetentionPolicy
in interface InfluxDB
rpName
- the name of the retentionPolicy(rp)database
- the name of the databaseduration
- the duration of the rpshardDuration
- the shardDurationreplicationFactor
- the replicationFactor of the rpisDefault
- if the rp is the default rp for the database or notpublic void createRetentionPolicy(String rpName, String database, String duration, int replicationFactor, boolean isDefault)
createRetentionPolicy
in interface InfluxDB
rpName
- the name of the retentionPolicy(rp)database
- the name of the databaseduration
- the duration of the rpreplicationFactor
- the replicationFactor of the rpisDefault
- if the rp is the default rp for the database or notpublic void createRetentionPolicy(String rpName, String database, String duration, String shardDuration, int replicationFactor)
createRetentionPolicy
in interface InfluxDB
rpName
- the name of the retentionPolicy(rp)database
- the name of the databaseduration
- the duration of the rpshardDuration
- the shardDurationreplicationFactor
- the replicationFactor of the rppublic void dropRetentionPolicy(String rpName, String database)
dropRetentionPolicy
in interface InfluxDB
rpName
- the name of the retentionPolicydatabase
- the name of the databaseCopyright © 2017. All rights reserved.