public class Writer extends Object implements AutoCloseable, Flushable
Modifier and Type | Class and Description |
---|---|
static class |
Writer.PushMode
Determines which mode of operation to use when flushing the writer.
|
static class |
Writer.TableColumn
Helper class to represent a table and column pair, which we
need because we need to lay out all columns as flat array.
|
Modifier and Type | Field and Description |
---|---|
protected List<Writer.TableColumn> |
columns |
protected long |
pointsSinceFlush |
Modifier | Constructor and Description |
---|---|
protected |
Writer(Session session,
Table[] tables) |
protected |
Writer(Session session,
Table[] tables,
Writer.PushMode mode) |
Modifier and Type | Method and Description |
---|---|
void |
append(Integer offset,
java.time.LocalDateTime timestamp,
Value[] values)
Append a new row to the local table cache.
|
void |
append(Integer offset,
Timespec timestamp,
Value[] values)
Append a new row to the local table cache.
|
void |
append(Integer offset,
Timestamp timestamp,
Value[] values)
Append a new row to the local table cache.
|
void |
append(Integer offset,
WritableRow row)
Append a new row to the local table cache.
|
void |
append(java.time.LocalDateTime timestamp,
Value[] values)
Append a new row to the local table cache.
|
void |
append(String tableName,
java.time.LocalDateTime timestamp,
Value[] values)
Append a new row to the local table cache.
|
void |
append(String tableName,
Timespec timestamp,
Value[] values)
Append a new row to the local table cache.
|
void |
append(String tableName,
Timestamp timestamp,
Value[] values)
Append a new row to the local table cache.
|
void |
append(String tableName,
WritableRow row)
Append a new row to the local table cache.
|
void |
append(Timespec timestamp,
Value[] values)
Append a new row to the local table cache.
|
void |
append(Timestamp timestamp,
Value[] values)
Append a new row to the local table cache.
|
void |
append(WritableRow row)
Append a new row to the local table cache.
|
void |
close()
Closes the timeseries table and local cache so that memory can be reclaimed.
|
void |
extraTables(Table table) |
void |
extraTables(Table[] tables)
After a writer is already initialized, this function allows extra tables to
be added to the internal state.
|
protected void |
finalize()
Cleans up the internal representation of the batch table.
|
void |
flush()
Flush current local cache to server.
|
void |
flush(TimeRange range)
Flush with specific time range, only useful in the context of a truncate push mode.
|
void |
flush(TimeRange[] ranges)
Flush with specific time range, only useful in the context of a truncate push mode.
|
Writer.PushMode |
pushMode() |
protected Table |
tableByIndex(int index)
Reverse of tableIndexByName, based on a (column) index, resolves the table.
|
int |
tableIndexByName(String name)
Utility function that looks up a table's index with the batch being written
by its name.
|
protected void |
trackMinMaxTimestamp(Timespec timestamp) |
protected long pointsSinceFlush
protected List<Writer.TableColumn> columns
protected Writer(Session session, Table[] tables, Writer.PushMode mode)
public void extraTables(Table[] tables)
public void extraTables(Table table)
public int tableIndexByName(String name)
protected Table tableByIndex(int index)
protected void finalize() throws Throwable
public void close() throws IOException
close
in interface AutoCloseable
IOException
public Writer.PushMode pushMode()
public void flush() throws IOException
flush
in interface Flushable
IOException
public void flush(TimeRange range) throws IOException
IOException
public void flush(TimeRange[] ranges) throws IOException
IOException
public void append(Integer offset, Timespec timestamp, Value[] values) throws IOException
AutoFlushWriter
is used.offset
- Relative offset of the table inside the batch. Use #tableIndexByName
to determine the appropriate value.timestamp
- Timestamp of the rowvalues
- Values being inserted, mapped to columns by their relative offset.IOException
tableIndexByName(java.lang.String)
,
flush()
,
Table.autoFlushWriter(net.quasardb.qdb.Session, java.lang.String)
protected void trackMinMaxTimestamp(Timespec timestamp)
public void append(String tableName, Timespec timestamp, Value[] values) throws IOException
AutoFlushWriter
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.tableName
- Name of the table to insert to.timestamp
- Timestamp of the rowvalues
- Values being inserted, mapped to columns by their relative offset.IOException
tableIndexByName(java.lang.String)
,
flush()
,
Table.autoFlushWriter(net.quasardb.qdb.Session, java.lang.String)
public void append(Timespec timestamp, Value[] values) throws IOException
AutoFlushWriter
is used.
This is a convenience function that assumes only one table is being inserted
to and should not be used when inserts to multiple tables are being batched.timestamp
- Timestamp of the rowvalues
- Values being inserted, mapped to columns by their relative offset.IOException
tableIndexByName(java.lang.String)
,
flush()
,
Table.autoFlushWriter(net.quasardb.qdb.Session, java.lang.String)
public void append(Integer offset, WritableRow row) throws IOException
AutoFlushWriter
is used.offset
- Relative offset of the table inside the batch. Use #tableIndexByName
to determine the appropriate value.row
- Row being inserted.IOException
tableIndexByName(java.lang.String)
,
flush()
,
Table.autoFlushWriter(net.quasardb.qdb.Session, java.lang.String)
public void append(String tableName, WritableRow row) throws IOException
AutoFlushWriter
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.tableName
- Name of the table to insert to.row
- Row being inserted.IOException
tableIndexByName(java.lang.String)
,
flush()
,
Table.autoFlushWriter(net.quasardb.qdb.Session, java.lang.String)
public void append(WritableRow row) throws IOException
AutoFlushWriter
is used.
This is a convenience function that assumes only one table is being inserted
to and should not be used when inserts to multiple tables are being batched.row
- Row being inserted.IOException
tableIndexByName(java.lang.String)
,
flush()
,
Table.autoFlushWriter(net.quasardb.qdb.Session, java.lang.String)
public void append(Integer offset, java.time.LocalDateTime timestamp, Value[] values) throws IOException
AutoFlushWriter
is used.offset
- Relative offset of the table inside the batch. Use #tableIndexByName
to determine the appropriate value.timestamp
- Timestamp of the rowvalues
- Values being inserted, mapped to columns by their relative offset.IOException
tableIndexByName(java.lang.String)
,
flush()
,
Table.autoFlushWriter(net.quasardb.qdb.Session, java.lang.String)
public void append(String tableName, java.time.LocalDateTime timestamp, Value[] values) throws IOException
AutoFlushWriter
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.tableName
- Name of the table to insert to.timestamp
- Timestamp of the rowvalues
- Values being inserted, mapped to columns by their relative offset.IOException
tableIndexByName(java.lang.String)
,
flush()
,
Table.autoFlushWriter(net.quasardb.qdb.Session, java.lang.String)
public void append(java.time.LocalDateTime timestamp, Value[] values) throws IOException
AutoFlushWriter
is used.
This is a convenience function that assumes only one table is being inserted
to and should not be used when inserts to multiple tables are being batched.timestamp
- Timestamp of the rowvalues
- Values being inserted, mapped to columns by their relative offset.IOException
tableIndexByName(java.lang.String)
,
flush()
,
Table.autoFlushWriter(net.quasardb.qdb.Session, java.lang.String)
public void append(Integer offset, Timestamp timestamp, Value[] values) throws IOException
AutoFlushWriter
is used.offset
- Relative offset of the table inside the batch. Use #tableIndexByName
to determine the appropriate value.timestamp
- Timestamp of the rowvalues
- Values being inserted, mapped to columns by their relative offset.IOException
tableIndexByName(java.lang.String)
,
flush()
,
Table.autoFlushWriter(net.quasardb.qdb.Session, java.lang.String)
public void append(String tableName, Timestamp timestamp, Value[] values) throws IOException
AutoFlushWriter
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.tableName
- Name of the table to insert to.timestamp
- Timestamp of the rowvalues
- Values being inserted, mapped to columns by their relative offset.IOException
tableIndexByName(java.lang.String)
,
flush()
,
Table.autoFlushWriter(net.quasardb.qdb.Session, java.lang.String)
public void append(Timestamp timestamp, Value[] values) throws IOException
AutoFlushWriter
is used.
This is a convenience function that assumes only one table is being inserted
to and should not be used when inserts to multiple tables are being batched.timestamp
- Timestamp of the rowvalues
- Values being inserted, mapped to columns by their relative offset.IOException
tableIndexByName(java.lang.String)
,
flush()
,
Table.autoFlushWriter(net.quasardb.qdb.Session, java.lang.String)
Copyright © 2021. All rights reserved.