THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
InfluxDB的接口适配主要包括write和query两个重要函数:write函数绝大多数接口已经实现,还有一个重试的写入接口未开始;query函数正在开发中。
其中五个接口已完成,一个接口在进行中,九个接口未开始。
未开始的接口中包括一些无需适配的接口:
setLogLevel:设置rest的相关LogLevel。
enableGzip、disableGzip和isGzipEnabled:Http request body的压缩方式有关处理函数。
由于当前适配器采用thrift的方式,因此上述接口无需适配。
一、已完成
1. write()
write函数有很多接口,主要的适配目标包括:以Point的形式,以String字符串的形式将数据写入数据库中。
已经实现的接口有:
/**
* Write a single Point to the default database.
*/
public void write(final Point point);
/**
* Write a set of Points to the default database with the string records.
*/
public void write(final String records);
/**
* Write a set of Points to the default database with the list of string records.]]
*/
public void write(final List<String> records);
/**
* Write a single Point to the database.
*/
public void write(final String database, final String retentionPolicy, final Point point);
/**
* Write a single Point to the database through UDP.
*/
public void write(final int udpPort, final Point point);
/**
* Write a set of Points to the influxdb database with the new lineprotocol.
*/
public void write(final BatchPoints batchPoints);
/**
* Write a set of Points to the influxdb database with the string records.
*/
public void write(final String database, final String retentionPolicy,
final ConsistencyLevel consistency, final String records);
/**
* Write a set of Points to the influxdb database with the string records.
*/
public void write(final String database, final String retentionPolicy,
final ConsistencyLevel consistency, final TimeUnit precision, final String records);
/**
* Write a set of Points to the influxdb database with the list of string records.
*/
public void write(final String database, final String retentionPolicy,
final ConsistencyLevel consistency, final List<String> records);
/**
* Write a set of Points to the influxdb database with the list of string records.
*/
public void write(final String database, final String retentionPolicy,
final ConsistencyLevel consistency, final TimeUnit precision, final List<String> records);
/**
* Write a set of Points to the influxdb database with the string records through UDP.
*/
public void write(final int udpPort, final String records);
/**
* Write a set of Points to the influxdb database with the list of string records through UDP.
*/
public void write(final int udpPort, final List<String> records);
2. ping()
/**
* Ping this influxDB.
*/
public Pong ping();
3. version()
/**
* Return the version of the connected influxDB Server.
*/
public String version();
4. flush()
/**
* Send any buffered points to InfluxDB. This method is synchronous and will block while all pending points are
* written.
*/
public void flush();
5. close()
/**
* close thread for asynchronous batch write and UDP socket to release resources if need.
*/
public void close();
6. setDatabase()
/**
* Set the database which is used for writing points.
*/
public InfluxDB setDatabase(final String database);
二、进行中
1. query()
query函数有很多接口,主要的适配目标包括:支持常规过滤、值过滤和tag过滤。同时支持聚合函数,选择函数等等功能。
已经实现的接口有:
/**
* Execute a query against a database.
*/
public QueryResult query(final Query query);
/**
* Execute a query against a database.
*/
public void query(final Query query, final Consumer<QueryResult> onSuccess, final Consumer<Throwable> onFailure);
/**
* Execute a streaming query against a database.
*/
public void query(Query query, int chunkSize, Consumer<QueryResult> onNext);
/**
* Execute a streaming query against a database.
*/
public void query(Query query, int chunkSize, BiConsumer<Cancellable, QueryResult> onNext);
/**
* Execute a streaming query against a database.
*/
public void query(Query query, int chunkSize, Consumer<QueryResult> onNext, Runnable onComplete);
/**
* Execute a streaming query against a database.
*/
public void query(Query query, int chunkSize, BiConsumer<Cancellable, QueryResult> onNext, Runnable onComplete);
/**
* Execute a streaming query against a database.
*/
public void query(Query query, int chunkSize, BiConsumer<Cancellable, QueryResult> onNext, Runnable onComplete,
Consumer<Throwable> onFailure);
/**
* Execute a query against a database.
*/
public QueryResult query(final Query query, TimeUnit timeUnit);
三、未开始
1. write()
write函数绝大多数接口已经实现,目前还有一个写入重试的接口未实现:
/**
* Write a set of Points to the influxdb database with the new (>= 0.9.0rc32) lineprotocol.
*
* If batching is enabled with appropriate {@code BatchOptions} settings
* ({@code BatchOptions.bufferLimit} greater than {@code BatchOptions.actions})
* This method will try to retry in case of some recoverable errors.
* Otherwise it just works as {@link #write(BatchPoints)}
*/
public void writeWithRetry(final BatchPoints batchPoints);
2. setLogLevel() (无需适配)
write函数绝大多数接口已经实现,目前还有一个写入重试的接口未开始实现:
/**
* Set the loglevel which is used for REST related actions.
*/
public InfluxDB setLogLevel(final LogLevel logLevel);
3. enableGzip() (无需适配)
/**
* Enable Gzip compress for http request body.
*/
public InfluxDB enableGzip();
4. disableGzip() (无需适配)
/**
* Enable Gzip compress for http request body.
*/
public InfluxDB enableGzip();
4. isGzipEnabled() (无需适配)
/**
* Returns whether Gzip compress for http request body is enabled.
*/
public boolean isGzipEnabled();
5. enableBatch()
enableBatch函数有很多接口,目前都还未完成,具体的接口如下:
/**
* Enable batching of single Point writes to speed up writes significantly. This is the same as calling
*/
public InfluxDB 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().
*/
public InfluxDB enableBatch(final BatchOptions batchOptions);
/**
* Enable batching of single Point writes as {@link #enableBatch(int, int, TimeUnit, ThreadFactory)}}
*/
public InfluxDB enableBatch(final int actions, final int flushDuration, final TimeUnit flushDurationTimeUnit);
/**
* Enable batching of single Point writes as
* {@link #enableBatch(int, int, TimeUnit, ThreadFactory, BiConsumer)}
* using with a exceptionHandler that does nothing.
*/
public InfluxDB enableBatch(final int actions, final int flushDuration, final TimeUnit flushDurationTimeUnit,
final ThreadFactory threadFactory);
/**
* 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.
*/
InfluxDB enableBatch(int actions, int flushDuration, TimeUnit flushDurationTimeUnit,
ThreadFactory threadFactory, BiConsumer<Iterable<Point>, Throwable> exceptionHandler,
ConsistencyLevel consistency);
/**
* 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().
*/
public InfluxDB enableBatch(final int actions, final int flushDuration, final TimeUnit flushDurationTimeUnit,
final ThreadFactory threadFactory,
final BiConsumer<Iterable<Point>, Throwable> exceptionHandler);
6. disableBatch()
/**
* Disable Batching.
*/
public void disableBatch();
7. disableBatch()
/**
* Returns whether Batching is enabled.
*/
public boolean isBatchEnabled();
8. setConsistency()
/**
* Set the consistency level which is used for writing points.
*/
public InfluxDB setConsistency(final ConsistencyLevel consistency)
9. setRetentionPolicy()
/**
* Set the retention policy which is used for writing points.
*/
public InfluxDB setRetentionPolicy(final String retentionPolicy);
1 Comment
gaoyang
你好,我看现在的实现是Thrift,请问将来有支持HTTP的打算吗?