Package net.quasardb.qdb.ts
Class Writer
java.lang.Object
net.quasardb.qdb.ts.Writer
- All Implemented Interfaces:
Flushable,AutoCloseable
- Direct Known Subclasses:
AutoFlushWriter
High-performance bulk writer for a QuasarDB timeseries table.
Usage of instances of this class is not thread-safe. Use a Writer
instance per Thread in multi-threaded situations.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic classBatch writer options.static enumDetermines which mode of operation to use when flushing the writer. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAppend a new row to the local table cache.voidappend(Table table, LocalDateTime timestamp, Value[] values) Append a new row to the local table cache.voidAppend a new row to the local table cache.voidappend(Table table, WritableRow row) Append a new row to the local table cache.static Writer.BuilderCreate a builder instance.voidclose()Closes the timeseries table and local cache so that memory can be reclaimed.protected voidfinalize()Cleans up the internal representation of the batch table.voidflush()voidvoidPrepare internal data structure for flushing.voidprepareFlush(TimeRange[] ranges) Prepare internal data structure for flushing.longsize()Returns the amount of values appended to the writer, not yet pushed/flushed.protected voidtrackMinMaxTimestamp(Timespec timestamp)
-
Field Details
-
pointsSinceFlush
protected long pointsSinceFlush
-
-
Constructor Details
-
Writer
-
-
Method Details
-
builder
Create a builder instance.- Parameters:
session- Active connection with the QuasarDB cluster.
-
finalize
Cleans up the internal representation of the batch table. -
close
Closes the timeseries table and local cache so that memory can be reclaimed. Flushes all remaining output.- Specified by:
closein interfaceAutoCloseable- Throws:
IOException
-
flush
- Specified by:
flushin interfaceFlushable- Throws:
IOException
-
flush
- Throws:
IOException
-
prepareFlush
Prepare internal data structure for flushing. Will be automatically called if not called explicitly.- Throws:
IOException
-
prepareFlush
Prepare internal data structure for flushing. Will be automatically called if not called explicitly. -
trackMinMaxTimestamp
-
append
Append a new row to the local table cache. Should be periodically flushed, unless anAutoFlushWriteris used. This function automatically looks up a table's offset by its name. For performance reason, you are encouraged to manually invoke and cache the value of #tableIndexByName whenever possible.- Parameters:
table- Table to insert into.timestamp- Timestamp of the rowvalues- Values being inserted, mapped to columns by their relative offset.- Throws:
IOException- See Also:
-
append
Append a new row to the local table cache. Should be periodically flushed, unless anAutoFlushWriteris used.- Parameters:
table- Table to insert intorow- Row being inserted.- Throws:
IOException- See Also:
-
append
Append a new row to the local table cache. Should be periodically flushed, unless anAutoFlushWriteris used.- Parameters:
table- Table to insert intotimestamp- Timestamp of the rowvalues- Values being inserted, mapped to columns by their relative offset.- Throws:
IOException- See Also:
-
append
Append a new row to the local table cache. Should be periodically flushed, unless anAutoFlushWriteris used.- Parameters:
table- Table to insert intotimestamp- Timestamp of the rowvalues- Values being inserted, mapped to columns by their relative offset.- Throws:
IOException- See Also:
-
size
public long size()Returns the amount of values appended to the writer, not yet pushed/flushed.
-