@Deprecated public class KeyValueTable extends AbstractDataset implements BatchReadable<byte[],byte[]>, BatchWritable<byte[],byte[]>, RecordScannable<KeyValue<byte[],byte[]>>, RecordWritable<KeyValue<byte[],byte[]>>
Table
supporting read, write and delete
operations.Modifier and Type | Class and Description |
---|---|
class |
KeyValueTable.KeyValueRecordMaker
Deprecated.
|
class |
KeyValueTable.KeyValueScanner
Deprecated.
The split reader for KeyValueTable.
|
Modifier and Type | Field and Description |
---|---|
static String |
TYPE
Deprecated.
Type name
|
Constructor and Description |
---|
KeyValueTable(String instanceName,
Table table)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
boolean |
compareAndSwap(byte[] key,
byte[] oldValue,
byte[] newValue)
Deprecated.
Compares-and-swaps (atomically) the value of the specified row and column by looking for the
specified expected value and, if found, replacing with the specified new value.
|
SplitReader<byte[],byte[]> |
createSplitReader(Split split)
Deprecated.
Creates a reader for the split of a dataset.
|
RecordScanner<KeyValue<byte[],byte[]>> |
createSplitRecordScanner(Split split)
Deprecated.
Creates a reader for the split of a dataset.
|
void |
delete(byte[] key)
Deprecated.
Delete a key.
|
void |
delete(String key)
Deprecated.
Delete a key.
|
Type |
getRecordType()
Deprecated.
The type of records that the dataset exposes as a schema.
|
List<Split> |
getSplits()
Deprecated.
Returns all splits of the dataset.
|
List<Split> |
getSplits(int numSplits,
byte[] start,
byte[] stop)
Deprecated.
Returns splits for a range of keys in the table.
|
void |
increment(byte[] key,
long amount)
Deprecated.
Increment the value of a key by amount; the key must either not exist yet, or the current value
at the key must be 8 bytes long to be interpretable as a long.
|
long |
incrementAndGet(byte[] key,
long value)
Deprecated.
Increment the value for a given key and return the resulting value.
|
byte[] |
read(byte[] key)
Deprecated.
Read the value for a given key.
|
byte[] |
read(String key)
Deprecated.
Read the value for a given key.
|
Map<byte[],byte[]> |
readAll(byte[][] keys)
Deprecated.
Reads the values for an array of given keys.
|
CloseableIterator<KeyValue<byte[],byte[]>> |
scan(byte[] startRow,
byte[] stopRow)
Deprecated.
Scans table.
|
void |
write(byte[] key,
byte[] value)
Deprecated.
Write a value to a key.
|
void |
write(KeyValue<byte[],byte[]> keyValue)
Deprecated.
Writes the record into a dataset.
|
void |
write(String key,
byte[] value)
Deprecated.
Write a value to a key.
|
void |
write(String key,
String value)
Deprecated.
Write a value to a key.
|
close, commitTx, getName, getTransactionAwareName, getTxChanges, postTxCommit, rollbackTx, setMetricsCollector, startTx, toString, updateTx
public static final String TYPE
@Nullable public byte[] read(String key)
key
- the key to read for@Nullable public byte[] read(byte[] key)
key
- the key to read forpublic Map<byte[],byte[]> readAll(byte[][] keys)
keys
- the keys to be readpublic long incrementAndGet(byte[] key, long value)
key
- the key to incrementpublic void write(byte[] key, byte[] value)
write
in interface BatchWritable<byte[],byte[]>
key
- the keyvalue
- the new valuepublic void write(String key, String value)
key
- the keyvalue
- the new valuepublic void write(String key, byte[] value)
key
- the keyvalue
- the new valuepublic void increment(byte[] key, long amount)
key
- the keyamount
- the amount to increment bypublic void delete(String key)
key
- the key to deletepublic void delete(byte[] key)
key
- the key to deletepublic boolean compareAndSwap(byte[] key, byte[] oldValue, byte[] newValue)
key
- key to modifyoldValue
- expected value before changenewValue
- value to setpublic Type getRecordType()
RecordScannable
getRecordType
in interface RecordScannable<KeyValue<byte[],byte[]>>
getRecordType
in interface RecordWritable<KeyValue<byte[],byte[]>>
public List<Split> getSplits()
BatchReadable
For feeding the whole dataset into a batch job.
getSplits
in interface BatchReadable<byte[],byte[]>
getSplits
in interface RecordScannable<KeyValue<byte[],byte[]>>
Split
s.public RecordScanner<KeyValue<byte[],byte[]>> createSplitRecordScanner(Split split)
RecordScannable
createSplitRecordScanner
in interface RecordScannable<KeyValue<byte[],byte[]>>
split
- The split to create a reader for.RecordScanner
.public List<Split> getSplits(int numSplits, @Nullable byte[] start, @Nullable byte[] stop)
numSplits
- Desired number of splits. If greater than zero, at most this many splits
will be returned. If less than or equal to zero, any number of splits can be returned.start
- if non-null, the returned splits will only cover keys that are greater or
equalstop
- if non-null, the returned splits will only cover keys that are lessSplit
public SplitReader<byte[],byte[]> createSplitReader(Split split)
BatchReadable
createSplitReader
in interface BatchReadable<byte[],byte[]>
split
- The split to create a reader for.SplitReader
.public void write(KeyValue<byte[],byte[]> keyValue) throws IOException
RecordWritable
write
in interface RecordWritable<KeyValue<byte[],byte[]>>
keyValue
- record to write into the dataset.IOException
- when the RECORD
could not be written to the dataset.public CloseableIterator<KeyValue<byte[],byte[]>> scan(byte[] startRow, byte[] stopRow)
startRow
- start row inclusive. null
means start from first row of the tablestopRow
- stop row exclusive. null
means scan all rows to the end of the
tableCloseableIterator
of KeyValue<byte[], byte[]>
Copyright © 2023 Cask Data, Inc. Licensed under the Apache License, Version 2.0.