程序包 com.cnosdb
接口 CnosDB
- 所有超级接口:
AutoCloseable
- 所有已知实现类:
CnosDBImpl
Interface with all available methods to access a CnosDB database.
A full list of currently available interfaces is implemented in:
- 作者:
- stefan.majer [at] gmail.com
-
嵌套类概要
嵌套类修饰符和类型接口说明static interfaceA cancelable allows to discontinue a streaming query.static enumConsistencyLevel for write Operations.static enumControls the level of logging of the REST layer.static enumFormat of HTTP Response body from CnosDB server. -
字段概要
字段修饰符和类型字段说明static final StringThe system property key to set the http logging level across the JVM. -
方法概要
修饰符和类型方法说明voidclose()close thread for asynchronous batch write and UDP socket to release resources if need.voidcreateDatabase(String name) 已过时。voidcreateRetentionPolicy(String rpName, String database, String duration, int replicationFactor, boolean isDefault) 已过时。(since 2.9, removed in 3.0) Usecom.cnosdb.CnosDB.query(Query)to execute a parameterized CREATE RETENTION POLICY query.voidcreateRetentionPolicy(String rpName, String database, String duration, String shardDuration, int replicationFactor) 已过时。(since 2.9, removed in 3.0) Usecom.cnosdb.CnosDB.query(Query)to execute a parameterized CREATE RETENTION POLICY query.voidcreateRetentionPolicy(String rpName, String database, String duration, String shardDuration, int replicationFactor, boolean isDefault) 已过时。(since 2.9, removed in 3.0) Usecom.cnosdb.CnosDB.query(Query)to execute a parameterized CREATE RETENTION POLICY query.booleandatabaseExists(String name) 已过时。(since 2.9, removed in 3.0) Usecom.cnosdb.CnosDB.query(Query)to execute a SHOW DATABASES query and inspect the result.voiddeleteDatabase(String name) 已过时。(since 2.9, removed in 3.0) Usecom.cnosdb.CnosDB.query(Query)to execute a DROP DATABASE query.已过时。(since 2.9, removed in 3.0) Usecom.cnosdb.CnosDB.query(Query)to execute a SHOW DATABASES query.voidDisable Batching.Disable Gzip compress for http request body.voiddropRetentionPolicy(String rpName, String database) 已过时。(since 2.9, removed in 3.0) Usecom.cnosdb.CnosDB.query(Query)to execute a DROP RETENTION POLICY query.Enable batching of single Point writes to speed up writes significantly.enableBatch(int actions, int flushDuration, TimeUnit flushDurationTimeUnit) Enable batching of single Point writes asenableBatch(int, int, TimeUnit, ThreadFactory)} using default thread factory.enableBatch(int actions, int flushDuration, TimeUnit flushDurationTimeUnit, ThreadFactory threadFactory) Enable batching of single Point writes asenableBatch(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.
-
字段详细资料
-
LOG_LEVEL_PROPERTY
The system property key to set the http logging level across the JVM.- 另请参阅:
-
-
方法详细资料
-
setLogLevel
Set the loglevel which is used for REST related actions.- 参数:
logLevel- the loglevel to set.- 返回:
- the CnosDB instance to be able to use it in a fluent manner.
-
enableGzip
CnosDB enableGzip()Enable Gzip compress for http request body.- 返回:
- the CnosDB instance to be able to use it in a fluent manner.
-
disableGzip
CnosDB disableGzip()Disable Gzip compress for http request body.- 返回:
- the CnosDB instance to be able to use it in a fluent manner.
-
isGzipEnabled
boolean isGzipEnabled()Returns whether Gzip compress for http request body is enabled.- 返回:
- true if gzip is enabled.
-
enableBatch
CnosDB enableBatch()Enable batching of single Point writes to speed up writes significantly. This is the same as calling CnosDB.enableBatch(BatchOptions.DEFAULTS)- 返回:
- the CnosDB instance to be able to use it in a fluent manner.
-
enableBatch
Enable 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().- 参数:
batchOptions- the options to set for batching the writes.- 返回:
- the CnosDB instance to be able to use it in a fluent manner.
-
enableBatch
Enable batching of single Point writes asenableBatch(int, int, TimeUnit, ThreadFactory)} using default thread factory.- 参数:
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
CnosDB enableBatch(int actions, int flushDuration, TimeUnit flushDurationTimeUnit, ThreadFactory threadFactory) Enable batching of single Point writes asenableBatch(int, int, TimeUnit, ThreadFactory, BiConsumer)using with a exceptionHandler that does nothing.- 参数:
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
CnosDB 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. Note that batch processing needs to be explicitly stopped before the application is shutdown. To do so call disableBatch(). Default consistency is ONE.- 参数:
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
CnosDB 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. 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().- 参数:
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
void disableBatch()Disable Batching. -
isBatchEnabled
boolean isBatchEnabled()Returns whether Batching is enabled.- 返回:
- true if batch is enabled.
-
ping
Pong ping()Ping this cnosDB.- 返回:
- the response of the ping execution.
-
version
String version()Return the version of the connected cnosDB Server.- 返回:
- the version String, otherwise unknown.
-
write
Write a single Point to the default database.- 参数:
point- The point to write
-
write
Write a set of Points to the default database with the string records.- 参数:
records- the points in the correct lineprotocol.
-
write
Write a set of Points to the default database with the list of string records.- 参数:
records- the List of points in the correct lineprotocol.
-
write
Write a single Point to the database.- 参数:
database- the database to write to.retentionPolicy- the retentionPolicy to use.point- The point to write
-
write
Write a single Point to the database through UDP.- 参数:
udpPort- the udpPort to write to.point- The point to write.
-
write
Write a set of Points to the cnosdb database with the new (>= 0.9.0rc32) lineprotocol.- 参数:
batchPoints- the points to write in BatchPoints.- 另请参阅:
-
writeWithRetry
Write 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 aswrite(BatchPoints)- 参数:
batchPoints- the points to write in BatchPoints.- 另请参阅:
-
write
void write(String database, String retentionPolicy, CnosDB.ConsistencyLevel consistency, String records) Write a set of Points to the cnosdb database with the string records.- 参数:
database- the name of the database to writeretentionPolicy- the retentionPolicy to useconsistency- the ConsistencyLevel to userecords- the points in the correct lineprotocol.- 另请参阅:
-
write
void write(String database, String retentionPolicy, CnosDB.ConsistencyLevel consistency, TimeUnit precision, String records) Write a set of Points to the cnosdb database with the string records.- 参数:
database- the name of the database to writeretentionPolicy- the retentionPolicy to useconsistency- the ConsistencyLevel to useprecision- the time precision to userecords- the points in the correct lineprotocol.- 另请参阅:
-
write
void write(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.- 参数:
database- the name of the database to writeretentionPolicy- the retentionPolicy to useconsistency- the ConsistencyLevel to userecords- the List of points in the correct lineprotocol.- 另请参阅:
-
write
void write(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.- 参数:
database- the name of the database to writeretentionPolicy- the retentionPolicy to useconsistency- the ConsistencyLevel to useprecision- the time precision to userecords- the List of points in the correct lineprotocol.- 另请参阅:
-
write
Write a set of Points to the cnosdb database with the string records through UDP.- 参数:
udpPort- the udpPort where cnosdb is listeningrecords- the content will be encoded by UTF-8 before sent.
-
write
Write a set of Points to the cnosdb database with the list of string records through UDP.- 参数:
udpPort- the udpPort where cnosdb is listeningrecords- list of record, the content will be encoded by UTF-8 before sent.
-
query
Execute a query against a database.- 参数:
query- the query to execute.- 返回:
- a List of Series which matched the query.
-
query
Execute a query against a database. One of the consumers will be executed.- 参数:
query- the query to execute.onSuccess- the consumer to invoke when result is receivedonFailure- the consumer to invoke when error is thrown
-
query
Execute a streaming query against a database.- 参数:
query- the query to execute.chunkSize- the number of QueryResults to process in one chunk.onNext- the consumer to invoke for each received QueryResult
-
query
Execute a streaming query against a database.- 参数:
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 query
-
query
Execute a streaming query against a database.- 参数:
query- the query to execute.chunkSize- the number of QueryResults to process in one chunk.onNext- the consumer to invoke for each received QueryResultonComplete- the onComplete to invoke for successfully end of stream
-
query
void query(Query query, int chunkSize, BiConsumer<CnosDB.Cancellable, QueryResult> onNext, Runnable onComplete) Execute a streaming query against a database.- 参数:
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
void query(Query query, int chunkSize, BiConsumer<CnosDB.Cancellable, QueryResult> onNext, Runnable onComplete, Consumer<Throwable> onFailure) Execute a streaming query against a database.- 参数:
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.- 参数:
query- the query to execute.timeUnit- the time unit of the results.- 返回:
- a List of Series which matched the query.
-
createDatabase
已过时。(since 2.9, removed in 3.0) Usecom.cnosdb.CnosDB.query(Query)to execute a parameterized CREATE DATABASE query.Create a new Database.- 参数:
name- the name of the new database.
-
deleteDatabase
已过时。(since 2.9, removed in 3.0) Usecom.cnosdb.CnosDB.query(Query)to execute a DROP DATABASE query.Delete a database.- 参数:
name- the name of the database to delete.
-
describeDatabases
已过时。(since 2.9, removed in 3.0) Usecom.cnosdb.CnosDB.query(Query)to execute a SHOW DATABASES query.Describe all available databases.- 返回:
- a List of all Database names.
-
databaseExists
已过时。(since 2.9, removed in 3.0) Usecom.cnosdb.CnosDB.query(Query)to execute a SHOW DATABASES query and inspect the result.Check if a database exists.- 参数:
name- the name of the database to search.- 返回:
- true if the database exists or false if it doesn't exist
-
flush
void flush()Send any buffered points to CnosDB. This method is synchronous and will block while all pending points are written.- 抛出:
IllegalStateException- if batching is not enabled.
-
close
void close()close thread for asynchronous batch write and UDP socket to release resources if need.- 指定者:
close在接口中AutoCloseable
-
setConsistency
Set the consistency level which is used for writing points.- 参数:
consistency- the consistency level to set.- 返回:
- the CnosDB instance to be able to use it in a fluent manner.
-
setDatabase
Set the database which is used for writing points.- 参数:
database- the database to set.- 返回:
- the CnosDB instance to be able to use it in a fluent manner.
-
setRetentionPolicy
Set the retention policy which is used for writing points.- 参数:
retentionPolicy- the retention policy to set.- 返回:
- the CnosDB instance to be able to use it in a fluent manner.
-
createRetentionPolicy
@Deprecated void createRetentionPolicy(String rpName, String database, String duration, String shardDuration, int replicationFactor, boolean isDefault) 已过时。(since 2.9, removed in 3.0) Usecom.cnosdb.CnosDB.query(Query)to execute a parameterized CREATE RETENTION POLICY query.Creates a retentionPolicy.- 参数:
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
@Deprecated void createRetentionPolicy(String rpName, String database, String duration, int replicationFactor, boolean isDefault) 已过时。(since 2.9, removed in 3.0) Usecom.cnosdb.CnosDB.query(Query)to execute a parameterized CREATE RETENTION POLICY query.Creates a retentionPolicy. (optional shardDuration)- 参数:
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
@Deprecated void createRetentionPolicy(String rpName, String database, String duration, String shardDuration, int replicationFactor) 已过时。(since 2.9, removed in 3.0) Usecom.cnosdb.CnosDB.query(Query)to execute a parameterized CREATE RETENTION POLICY query.Creates a retentionPolicy. (optional shardDuration and isDefault)- 参数:
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
已过时。(since 2.9, removed in 3.0) Usecom.cnosdb.CnosDB.query(Query)to execute a DROP RETENTION POLICY query.Drops a retentionPolicy in a database.- 参数:
rpName- the name of the retentionPolicydatabase- the name of the database
-
com.cnosdb.CnosDB.query(Query)to execute a parameterized CREATE DATABASE query.