程序包 com.cnosdb.impl
类 CnosDBImpl
java.lang.Object
com.cnosdb.impl.CnosDBImpl
- 所有已实现的接口:
CnosDB,AutoCloseable
Implementation of a InluxDB API.
- 作者:
- stefan.majer [at] gmail.com
-
嵌套类概要
从接口继承的嵌套类/接口 com.cnosdb.CnosDB
CnosDB.Cancellable, CnosDB.ConsistencyLevel, CnosDB.LogLevel, CnosDB.ResponseFormat -
字段概要
从接口继承的字段 com.cnosdb.CnosDB
LOG_LEVEL_PROPERTY -
构造器概要
构造器构造器说明CnosDBImpl(String url, String username, String password, okhttp3.OkHttpClient.Builder client) CnosDBImpl(String url, String username, String password, okhttp3.OkHttpClient.Builder okHttpBuilder, CnosDB.ResponseFormat responseFormat) Constructs a newCnosDBImpl.CnosDBImpl(String url, String username, String password, okhttp3.OkHttpClient.Builder client, String database, String retentionPolicy, CnosDB.ConsistencyLevel consistency) CnosDBImpl(String url, String username, String password, okhttp3.OkHttpClient.Builder okHttpBuilder, retrofit2.Retrofit.Builder retrofitBuilder, CnosDB.ResponseFormat responseFormat) Constructs a newCnosDBImpl. -
方法概要
修饰符和类型方法说明voidclose()close thread for asynchronous batch write and UDP socket to release resources if need.voidcreateDatabase(String name) Create a new Database.voidcreateRetentionPolicy(String rpName, String database, String duration, int replicationFactor, boolean isDefault) Creates a retentionPolicy.voidcreateRetentionPolicy(String rpName, String database, String duration, String shardDuration, int replicationFactor) Creates a retentionPolicy.voidcreateRetentionPolicy(String rpName, String database, String duration, String shardDuration, int replicationFactor, boolean isDefault) Creates a retentionPolicy.booleandatabaseExists(String name) Check if a database exists.voiddeleteDatabase(String name) Delete a database.Describe all available databases.voidDisable Batching.Disable Gzip compress for http request body.voiddropRetentionPolicy(String rpName, String database) Drops a retentionPolicy in a database.Enable batching of single Point writes to speed up writes significantly.enableBatch(int actions, int flushDuration, TimeUnit flushDurationTimeUnit) Enable batching of single Point writes asCnosDB.enableBatch(int, int, TimeUnit, ThreadFactory)} using default thread factory.enableBatch(int actions, int flushDuration, TimeUnit flushDurationTimeUnit, ThreadFactory threadFactory) Enable batching of single Point writes asCnosDB.enableBatch(int, int, TimeUnit, ThreadFactory, BiConsumer)using with a exceptionHandler that does nothing.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.enableBatch(int actions, int flushDuration, TimeUnit flushDurationTimeUnit, ThreadFactory threadFactory, BiConsumer<Iterable<Point>, Throwable> exceptionHandler, CnosDB.ConsistencyLevel consistency) Enable batching of single Point writes with consistency set for an entire batch flushDurations is reached first, a batch write is issued.enableBatch(BatchOptions batchOptions) Enable batching of single Point writes to speed up writes significantly.Enable Gzip compress for http request body.voidflush()Send any buffered points to CnosDB.booleanReturns whether Batching is enabled.booleanReturns whether Gzip compress for http request body is enabled.ping()Ping this cnosDB.Execute a query against a database.voidquery(Query query, int chunkSize, BiConsumer<CnosDB.Cancellable, QueryResult> onNext) Execute a streaming query against a database.voidquery(Query query, int chunkSize, BiConsumer<CnosDB.Cancellable, QueryResult> onNext, Runnable onComplete) Execute a streaming query against a database.voidquery(Query query, int chunkSize, BiConsumer<CnosDB.Cancellable, QueryResult> onNext, Runnable onComplete, Consumer<Throwable> onFailure) Execute a streaming query against a database.voidquery(Query query, int chunkSize, Consumer<QueryResult> onNext) Execute a streaming query against a database.voidquery(Query query, int chunkSize, Consumer<QueryResult> onNext, Runnable onComplete) Execute a streaming query against a database.Execute a query against a database.voidExecute a query against a database.setConsistency(CnosDB.ConsistencyLevel consistency) Set the consistency level which is used for writing points.setDatabase(String database) Set the database which is used for writing points.setLogLevel(CnosDB.LogLevel logLevel) Set the loglevel which is used for REST related actions.setRetentionPolicy(String retentionPolicy) Set the retention policy which is used for writing points.version()Return the version of the connected cnosDB Server.voidWrite a single Point to the database through UDP.voidWrite a set of Points to the cnosdb database with the string records through UDP.voidWrite a set of Points to the cnosdb database with the list of string records through UDP.voidwrite(BatchPoints batchPoints) Write a set of Points to the cnosdb database with the new (>= 0.9.0rc32) lineprotocol.voidWrite a single Point to the default database.voidWrite a set of Points to the default database with the string records.voidwrite(String database, String retentionPolicy, CnosDB.ConsistencyLevel consistency, String records) Write a set of Points to the cnosdb database with the string records.voidwrite(String database, String retentionPolicy, CnosDB.ConsistencyLevel consistency, TimeUnit precision, String records) Write a set of Points to the cnosdb database with the string records.voidwrite(String database, String retentionPolicy, CnosDB.ConsistencyLevel consistency, TimeUnit precision, List<String> records) Write a set of Points to the cnosdb database with the list of string records.voidwrite(String database, String retentionPolicy, CnosDB.ConsistencyLevel consistency, List<String> records) Write a set of Points to the cnosdb database with the list of string records.voidWrite a single Point to the database.voidWrite a set of Points to the default database with the list of string records.voidwriteWithRetry(BatchPoints batchPoints) Write a set of Points to the cnosdb database with the new (>= 0.9.0rc32) lineprotocol.
-
构造器详细资料
-
CnosDBImpl
public CnosDBImpl(String url, String username, String password, okhttp3.OkHttpClient.Builder okHttpBuilder, CnosDB.ResponseFormat responseFormat) Constructs a newCnosDBImpl.- 参数:
url- The CnosDB server API URLusername- The CnosDB user namepassword- The CnosDB user passwordokHttpBuilder- The OkHttp Client BuilderresponseFormat- TheResponseFormatto use for response from CnosDB server
-
CnosDBImpl
public CnosDBImpl(String url, String username, String password, okhttp3.OkHttpClient.Builder okHttpBuilder, retrofit2.Retrofit.Builder retrofitBuilder, CnosDB.ResponseFormat responseFormat) Constructs a newCnosDBImpl.- 参数:
url- The CnosDB server API URLusername- The CnosDB user namepassword- The CnosDB user passwordokHttpBuilder- The OkHttp Client BuilderretrofitBuilder- The Retrofit BuilderresponseFormat- TheResponseFormatto use for response from CnosDB server
-
CnosDBImpl
-
CnosDBImpl
-
-
方法详细资料
-
setLogLevel
从接口复制的说明:CnosDBSet the loglevel which is used for REST related actions.- 指定者:
setLogLevel在接口中CnosDB- 参数:
logLevel- the loglevel to set.- 返回:
- the CnosDB instance to be able to use it in a fluent manner.
-
enableGzip
Enable Gzip compress for http request body.- 指定者:
enableGzip在接口中CnosDB- 返回:
- the CnosDB instance to be able to use it in a fluent manner.
-
disableGzip
Disable Gzip compress for http request body.- 指定者:
disableGzip在接口中CnosDB- 返回:
- the CnosDB instance to be able to use it in a fluent manner.
-
isGzipEnabled
public boolean isGzipEnabled()Returns whether Gzip compress for http request body is enabled.- 指定者:
isGzipEnabled在接口中CnosDB- 返回:
- true if gzip is enabled.
-
enableBatch
从接口复制的说明:CnosDBEnable batching of single Point writes to speed up writes significantly. This is the same as calling CnosDB.enableBatch(BatchOptions.DEFAULTS)- 指定者:
enableBatch在接口中CnosDB- 返回:
- the CnosDB instance to be able to use it in a fluent manner.
-
enableBatch
从接口复制的说明:CnosDBEnable batching of single Point writes to speed up writes significantly. If either number of points written or flushDuration time limit is reached, a batch write is issued. Note that batch processing needs to be explicitly stopped before the application is shutdown. To do so call disableBatch().- 指定者:
enableBatch在接口中CnosDB- 参数:
batchOptions- the options to set for batching the writes.- 返回:
- the CnosDB instance to be able to use it in a fluent manner.
-
enableBatch
从接口复制的说明:CnosDBEnable batching of single Point writes asCnosDB.enableBatch(int, int, TimeUnit, ThreadFactory)} using default thread factory.- 指定者:
enableBatch在接口中CnosDB- 参数:
actions- the number of actions to collectflushDuration- the time to wait at most.flushDurationTimeUnit- the TimeUnit for the given flushDuration.- 返回:
- the CnosDB instance to be able to use it in a fluent manner.
- 另请参阅:
-
enableBatch
public CnosDB enableBatch(int actions, int flushDuration, TimeUnit flushDurationTimeUnit, ThreadFactory threadFactory) 从接口复制的说明:CnosDBEnable batching of single Point writes asCnosDB.enableBatch(int, int, TimeUnit, ThreadFactory, BiConsumer)using with a exceptionHandler that does nothing.- 指定者:
enableBatch在接口中CnosDB- 参数:
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.- 返回:
- the CnosDB instance to be able to use it in a fluent manner.
- 另请参阅:
-
enableBatch
public CnosDB enableBatch(int actions, int flushDuration, TimeUnit flushDurationTimeUnit, ThreadFactory threadFactory, BiConsumer<Iterable<Point>, Throwable> exceptionHandler, CnosDB.ConsistencyLevel consistency) 从接口复制的说明:CnosDBEnable batching of single Point writes with consistency set for an entire batch flushDurations is reached first, a batch write is issued. Note that batch processing needs to be explicitly stopped before the application is shutdown. To do so call disableBatch(). Default consistency is ONE.- 指定者:
enableBatch在接口中CnosDB- 参数:
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 errorsconsistency- a consistency setting for batch writes.- 返回:
- the CnosDB instance to be able to use it in a fluent manner.
-
enableBatch
public CnosDB enableBatch(int actions, int flushDuration, TimeUnit flushDurationTimeUnit, ThreadFactory threadFactory, BiConsumer<Iterable<Point>, Throwable> exceptionHandler) 从接口复制的说明:CnosDBEnable batching of single Point writes to speed up writes significant. If either actions or flushDurations is reached first, a batch write is issued. Note that batch processing needs to be explicitly stopped before the application is shutdown. To do so call disableBatch().- 指定者:
enableBatch在接口中CnosDB- 参数:
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 errors- 返回:
- the CnosDB instance to be able to use it in a fluent manner.
-
disableBatch
public void disableBatch()从接口复制的说明:CnosDBDisable Batching.- 指定者:
disableBatch在接口中CnosDB
-
isBatchEnabled
public boolean isBatchEnabled()从接口复制的说明:CnosDBReturns whether Batching is enabled.- 指定者:
isBatchEnabled在接口中CnosDB- 返回:
- true if batch is enabled.
-
ping
从接口复制的说明:CnosDBPing this cnosDB. -
version
从接口复制的说明:CnosDBReturn the version of the connected cnosDB Server. -
write
从接口复制的说明:CnosDBWrite a single Point to the default database. -
write
从接口复制的说明:CnosDBWrite a set of Points to the default database with the string records. -
write
从接口复制的说明:CnosDBWrite a set of Points to the default database with the list of string records. -
write
从接口复制的说明:CnosDBWrite a single Point to the database. -
write
Write a single Point to the database through UDP. -
write
从接口复制的说明:CnosDBWrite a set of Points to the cnosdb database with the new (>= 0.9.0rc32) lineprotocol. -
writeWithRetry
从接口复制的说明:CnosDBWrite a set of Points to the cnosdb database with the new (>= 0.9.0rc32) lineprotocol. If batching is enabled with appropriateBatchOptionssettings (BatchOptions.bufferLimitgreater thanBatchOptions.actions) This method will try to retry in case of some recoverable errors. Otherwise it just works asCnosDB.write(BatchPoints)- 指定者:
writeWithRetry在接口中CnosDB- 参数:
batchPoints- the points to write in BatchPoints.- 另请参阅:
-
write
public void write(String database, String retentionPolicy, CnosDB.ConsistencyLevel consistency, TimeUnit precision, String records) 从接口复制的说明:CnosDBWrite a set of Points to the cnosdb database with the string records. -
write
public void write(String database, String retentionPolicy, CnosDB.ConsistencyLevel consistency, String records) 从接口复制的说明:CnosDBWrite a set of Points to the cnosdb database with the string records. -
write
public void write(String database, String retentionPolicy, CnosDB.ConsistencyLevel consistency, List<String> records) 从接口复制的说明:CnosDBWrite a set of Points to the cnosdb database with the list of string records. -
write
public void write(String database, String retentionPolicy, CnosDB.ConsistencyLevel consistency, TimeUnit precision, List<String> records) 从接口复制的说明:CnosDBWrite a set of Points to the cnosdb database with the list of string records. -
write
Write a set of Points to the cnosdb database with the string records through UDP. -
write
Write a set of Points to the cnosdb database with the list of string records through UDP. -
query
Execute a query against a database. -
query
Execute a query against a database. One of the consumers will be executed. -
query
Execute a streaming query against a database. -
query
Execute a streaming query against a database. -
query
Execute a streaming query against a database. -
query
public void query(Query query, int chunkSize, BiConsumer<CnosDB.Cancellable, QueryResult> onNext, Runnable onComplete) 从接口复制的说明:CnosDBExecute a streaming query against a database.- 指定者:
query在接口中CnosDB- 参数:
query- the query to execute.chunkSize- the number of QueryResults to process in one chunk.onNext- the consumer to invoke for each received QueryResult; with capability to discontinue a streaming queryonComplete- the onComplete to invoke for successfully end of stream
-
query
public void query(Query query, int chunkSize, BiConsumer<CnosDB.Cancellable, QueryResult> onNext, Runnable onComplete, Consumer<Throwable> onFailure) Execute a streaming query against a database.- 指定者:
query在接口中CnosDB- 参数:
query- the query to execute.chunkSize- the number of QueryResults to process in one chunk.onNext- the consumer to invoke for each received QueryResult; with capability to discontinue a streaming queryonComplete- the onComplete to invoke for successfully end of streamonFailure- the consumer for error handling
-
query
Execute a query against a database. -
createDatabase
Create a new Database.- 指定者:
createDatabase在接口中CnosDB- 参数:
name- the name of the new database.
-
deleteDatabase
Delete a database.- 指定者:
deleteDatabase在接口中CnosDB- 参数:
name- the name of the database to delete.
-
describeDatabases
Describe all available databases.- 指定者:
describeDatabases在接口中CnosDB- 返回:
- a List of all Database names.
-
databaseExists
Check if a database exists.- 指定者:
databaseExists在接口中CnosDB- 参数:
name- the name of the database to search.- 返回:
- true if the database exists or false if it doesn't exist
-
flush
public void flush()Send any buffered points to CnosDB. This method is synchronous and will block while all pending points are written. -
close
public void close()close thread for asynchronous batch write and UDP socket to release resources if need.- 指定者:
close在接口中AutoCloseable- 指定者:
close在接口中CnosDB
-
setConsistency
从接口复制的说明:CnosDBSet the consistency level which is used for writing points.- 指定者:
setConsistency在接口中CnosDB- 参数:
consistency- the consistency level to set.- 返回:
- the CnosDB instance to be able to use it in a fluent manner.
-
setDatabase
从接口复制的说明:CnosDBSet the database which is used for writing points.- 指定者:
setDatabase在接口中CnosDB- 参数:
database- the database to set.- 返回:
- the CnosDB instance to be able to use it in a fluent manner.
-
setRetentionPolicy
从接口复制的说明:CnosDBSet the retention policy which is used for writing points.- 指定者:
setRetentionPolicy在接口中CnosDB- 参数:
retentionPolicy- the retention policy to set.- 返回:
- the CnosDB instance to be able to use it in a fluent manner.
-
createRetentionPolicy
public void createRetentionPolicy(String rpName, String database, String duration, String shardDuration, int replicationFactor, boolean isDefault) Creates a retentionPolicy.- 指定者:
createRetentionPolicy在接口中CnosDB- 参数:
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 not
-
createRetentionPolicy
public void createRetentionPolicy(String rpName, String database, String duration, int replicationFactor, boolean isDefault) Creates a retentionPolicy. (optional shardDuration)- 指定者:
createRetentionPolicy在接口中CnosDB- 参数:
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 not
-
createRetentionPolicy
public void createRetentionPolicy(String rpName, String database, String duration, String shardDuration, int replicationFactor) Creates a retentionPolicy. (optional shardDuration and isDefault)- 指定者:
createRetentionPolicy在接口中CnosDB- 参数:
rpName- the name of the retentionPolicy(rp)database- the name of the databaseduration- the duration of the rpshardDuration- the shardDurationreplicationFactor- the replicationFactor of the rp
-
dropRetentionPolicy
Drops a retentionPolicy in a database.- 指定者:
dropRetentionPolicy在接口中CnosDB- 参数:
rpName- the name of the retentionPolicydatabase- the name of the database
-