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 class
static class
Batch writer options.static enum
Determines which mode of operation to use when flushing the writer. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Append a new row to the local table cache.void
append
(Table table, LocalDateTime timestamp, Value[] values) Append a new row to the local table cache.void
Append a new row to the local table cache.void
append
(Table table, WritableRow row) Append a new row to the local table cache.static Writer.Builder
Create a builder instance.void
close()
Closes the timeseries table and local cache so that memory can be reclaimed.protected void
finalize()
Cleans up the internal representation of the batch table.void
flush()
void
void
Prepare internal data structure for flushing.void
prepareFlush
(TimeRange[] ranges) Prepare internal data structure for flushing.long
size()
Returns the amount of values appended to the writer, not yet pushed/flushed.protected void
trackMinMaxTimestamp
(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:
close
in interfaceAutoCloseable
- Throws:
IOException
-
flush
- Specified by:
flush
in 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 anAutoFlushWriter
is 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 anAutoFlushWriter
is 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 anAutoFlushWriter
is 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 anAutoFlushWriter
is 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.
-