public class CounterTimeseriesTable extends AbstractDataset
TimeseriesTable
for long values and provides increment methods for counting.
For more information on choosing values for rowPartitionIntervalSize
and tag usage, please see the
TimeseriesTable
class description.
TimeseriesTable
Modifier and Type | Class and Description |
---|---|
static class |
CounterTimeseriesTable.Counter
Defines an object for counters in
CounterTimeseriesTable . |
Modifier and Type | Field and Description |
---|---|
static String |
ATTR_TIME_INTERVAL_TO_STORE_PER_ROW |
static long |
DEFAULT_TIME_INTERVAL_PER_ROW
See
TimeseriesTable javadoc for description. |
static int |
MAX_ROWS_TO_SCAN_PER_READ
Limit on the number of rows to scan per read.
|
protected Table |
table |
static String |
TYPE
Type name
|
Constructor and Description |
---|
CounterTimeseriesTable(DatasetSpecification spec,
Table table)
Creates an instance of the DataSet.
|
Modifier and Type | Method and Description |
---|---|
long |
increment(byte[] counter,
long amount,
long timestamp,
byte[]... tags)
Increments the value for a counter for a row and timestamp.
|
Iterator<CounterTimeseriesTable.Counter> |
read(byte[] counter,
long startTime,
long endTime,
byte[]... tags)
Reads entries for a given time range and returns an
Iterator . |
Iterator<CounterTimeseriesTable.Counter> |
read(byte[] counter,
long startTime,
long endTime,
int offset,
int limit,
byte[]... tags)
Reads entries for a given time range and returns an
Iterator . |
void |
set(byte[] counter,
long value,
long timestamp,
byte[]... tags)
Set the value for a counter.
|
close, commitTx, getName, getTransactionAwareName, getTxChanges, postTxCommit, rollbackTx, setMetricsCollector, startTx, toString, updateTx
public static final String TYPE
public static final String ATTR_TIME_INTERVAL_TO_STORE_PER_ROW
public static final long DEFAULT_TIME_INTERVAL_PER_ROW
TimeseriesTable
javadoc for description.public static final int MAX_ROWS_TO_SCAN_PER_READ
protected final Table table
public CounterTimeseriesTable(DatasetSpecification spec, Table table)
public long increment(byte[] counter, long amount, long timestamp, byte[]... tags)
counter
- the name of the counter to incrementamount
- the amount to increment bytimestamp
- timestamp of the entrytags
- optional list of tags associated with the counter. See TimeseriesTable
class description
for more details.public void set(byte[] counter, long value, long timestamp, byte[]... tags)
counter
- the name of the counter to setvalue
- the value to settimestamp
- timestamp of the entrytags
- optional list of tags associated with the counter. See TimeseriesTable
class description
for more details.public Iterator<CounterTimeseriesTable.Counter> read(byte[] counter, long startTime, long endTime, byte[]... tags)
Iterator
.
NOTE: A limit is placed on the max number of time intervals to be scanned during a read, as defined by
MAX_ROWS_TO_SCAN_PER_READ
.counter
- name of the counter to readstartTime
- defines start of the time range to read, inclusiveendTime
- defines end of the time range to read, inclusivetags
- a set of tags which entries returned must contain. Tags for entries are defined at write-time and an
entry is only returned if it contains all of these tags.public Iterator<CounterTimeseriesTable.Counter> read(byte[] counter, long startTime, long endTime, int offset, int limit, byte[]... tags)
Iterator
.
Provides the same functionality as read(byte[], long, long, byte[]...)
but accepts additional parameters for pagination purposes.counter
- name of the counter to readstartTime
- defines start of the time range to read, inclusiveendTime
- defines end of the time range to read, inclusiveoffset
- the number of initial entries to ignore and not add to the resultslimit
- upper limit on number of results returned. If limit is exceeded, the first limit
results
are returned.tags
- a set of tags which entries returned must contain. Tags for entries are defined at write-time and an
entry is only returned if it contains all of these tags.Copyright © 2021 Cask Data, Inc. Licensed under the Apache License, Version 2.0.