public class UniqueVisitCount extends AbstractDataset implements RecordScannable<KeyValue<String,Long>>
Dataset that stores IP to total visit counts. It uses a KeyValueTable
underneath to hold the data. It also implements the RecordScannable interface so
that it can be queried using ad-hoc SQL.| Constructor and Description |
|---|
UniqueVisitCount(DatasetSpecification spec,
KeyValueTable keyValueTable)
Constructor for the Dataset.
|
| Modifier and Type | Method and Description |
|---|---|
RecordScanner<KeyValue<String,Long>> |
createSplitRecordScanner(Split split) |
long |
getCount(String ip)
Reads the visit count for a given IP.
|
Type |
getRecordType() |
List<Split> |
getSplits() |
void |
increment(String ip,
long amount)
Performs increments of visit count of the given IP.
|
close, commitTx, getName, getTransactionAwareName, getTxChanges, postTxCommit, rollbackTx, setMetricsCollector, startTx, toString, updateTxpublic UniqueVisitCount(DatasetSpecification spec, KeyValueTable keyValueTable)
KeyValueTable.spec - The specification of the Dataset instance.keyValueTable - The underlying tablepublic void increment(String ip, long amount)
ip - The IP to incrementamount - The amount to incrementpublic long getCount(String ip)
ip - The IP to lookuppublic Type getRecordType()
getRecordType in interface RecordScannable<KeyValue<String,Long>>public List<Split> getSplits()
getSplits in interface RecordScannable<KeyValue<String,Long>>public RecordScanner<KeyValue<String,Long>> createSplitRecordScanner(Split split)
createSplitRecordScanner in interface RecordScannable<KeyValue<String,Long>>Copyright © 2016 Cask Data, Inc. Licensed under the Apache License, Version 2.0.