public class QueueEntryRow extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
QueueEntryRow.CanConsume
Defines if queue entry can be consumed
|
| Modifier and Type | Field and Description |
|---|---|
static byte[] |
COLUMN_FAMILY |
static byte[] |
DATA_COLUMN |
static byte[] |
META_COLUMN |
static byte[] |
STATE_COLUMN_PREFIX |
| Constructor and Description |
|---|
QueueEntryRow() |
| Modifier and Type | Method and Description |
|---|---|
static QueueEntryRow.CanConsume |
canConsume(ConsumerConfig consumerConfig,
co.cask.tephra.Transaction transaction,
long enqueueWritePointer,
int counter,
byte[] metaValue,
byte[] stateValue)
Looks at specific queue entry and determines if consumer with given consumer config and current transaction
can consume this entry.
|
static int |
getHashConsumerInstance(Map<String,Integer> hashes,
String key,
int groupSize) |
static byte[] |
getQueueEntryRowKey(QueueName queueName,
long writePoint,
int count)
Simple method to return a queue entry row key.
|
static QueueName |
getQueueName(String namespaceId,
String appName,
String flowName,
int prefixBytes,
byte[] rowBuffer,
int rowOffset,
int rowLength)
Extracts the queue name from the KeyValue row, which the row must be a queue entry.
|
static byte[] |
getQueueRowPrefix(QueueName queueName)
Returns a byte array representing prefix of a queue.
|
static int |
getRoundRobinConsumerInstance(long writePointer,
int counter,
int groupSize)
Returns the consumer instance id for consuming an entry enqueued with the given write pointer and counter.
|
static ConsumerEntryState |
getState(byte[] stateValue) |
static int |
getStateInstanceId(byte[] stateValue) |
static long |
getStateWritePointer(byte[] stateValue) |
static byte[] |
getStopRowForTransaction(byte[] queueRowPrefix,
co.cask.tephra.Transaction transaction)
Gets the stop row for scan up to the read pointer of a transaction.
|
static long |
getWritePointer(byte[] rowKey,
int queueRowPrefixLength)
Gets the write pointer for a row.
|
static boolean |
isCommittedProcessed(byte[] stateBytes,
co.cask.tephra.Transaction tx)
For a queue entry consumer state, serialized to byte array, return whether it is processed and committed.
|
static boolean |
isDataColumn(byte[] qualifierBuffer,
int qualifierOffset)
Returns
true if the given byte[] is a data column qualifier in queue entry row. |
static boolean |
isDataColumn(org.apache.hadoop.hbase.KeyValue keyValue)
Returns
true if the given KeyValue is a data column in queue entry row. |
static boolean |
isMetaColumn(byte[] qualifierBuffer,
int qualifierOffset)
Returns
true if the given byte[] is a meta column qualifier in queue entry row. |
static boolean |
isMetaColumn(org.apache.hadoop.hbase.KeyValue keyValue)
Returns
true if the given KeyValue is a meta column in queue entry row. |
static boolean |
isQueueEntry(byte[] queueRowPrefix,
int prefixBytes,
byte[] rowBuffer,
int rowOffset,
int rowLength)
Returns true if the given row is a queue entry of the given queue based on queue row prefix
|
static boolean |
isStateColumn(byte[] columnName)
Determine whether a column represent the state of a consumer.
|
static boolean |
isStateColumn(byte[] qualifierBuffer,
int qualifierOffset)
Returns
true if the given byte[] is a state column qualifier in queue entry row. |
static boolean |
isStateColumn(org.apache.hadoop.hbase.KeyValue keyValue)
Returns
true if the given KeyValue is a state column in queue entry row. |
public static final byte[] COLUMN_FAMILY
public static final byte[] DATA_COLUMN
public static final byte[] META_COLUMN
public static final byte[] STATE_COLUMN_PREFIX
public static byte[] getQueueRowPrefix(QueueName queueName)
public static byte[] getQueueEntryRowKey(QueueName queueName, long writePoint, int count)
public static boolean isStateColumn(byte[] columnName)
public static long getStateWritePointer(byte[] stateValue)
stateValue - value of the state columnpublic static int getStateInstanceId(byte[] stateValue)
stateValue - value of the state columnpublic static ConsumerEntryState getState(byte[] stateValue)
stateValue - value of the state columnpublic static QueueName getQueueName(String namespaceId, String appName, String flowName, int prefixBytes, byte[] rowBuffer, int rowOffset, int rowLength)
public static boolean isQueueEntry(byte[] queueRowPrefix,
int prefixBytes,
byte[] rowBuffer,
int rowOffset,
int rowLength)
public static boolean isStateColumn(org.apache.hadoop.hbase.KeyValue keyValue)
true if the given KeyValue is a state column in queue entry row.public static boolean isStateColumn(byte[] qualifierBuffer,
int qualifierOffset)
true if the given byte[] is a state column qualifier in queue entry row.public static boolean isMetaColumn(org.apache.hadoop.hbase.KeyValue keyValue)
true if the given KeyValue is a meta column in queue entry row.public static boolean isMetaColumn(byte[] qualifierBuffer,
int qualifierOffset)
true if the given byte[] is a meta column qualifier in queue entry row.public static boolean isDataColumn(org.apache.hadoop.hbase.KeyValue keyValue)
true if the given KeyValue is a data column in queue entry row.public static boolean isDataColumn(byte[] qualifierBuffer,
int qualifierOffset)
true if the given byte[] is a data column qualifier in queue entry row.public static QueueEntryRow.CanConsume canConsume(ConsumerConfig consumerConfig, co.cask.tephra.Transaction transaction, long enqueueWritePointer, int counter, byte[] metaValue, byte[] stateValue)
QueueEntryRow.CanConsume.YES,
"no" (QueueEntryRow.CanConsume.NO,
"no" with a hint that given consumer cannot consume any of the entries prior to this one
(QueueEntryRow.CanConsume.NO_INCLUDING_ALL_OLDER.
The latter one allows for some optimizations when doing scans of entries to be
consumed.consumerConfig - config of the consumertransaction - current txenqueueWritePointer - write pointer used by enqueue of this entrycounter - counter of this entrymetaValue - value of meta column of this entrystateValue - value of state column of this entryQueueEntryRow.CanConsume as per description above.public static int getRoundRobinConsumerInstance(long writePointer,
int counter,
int groupSize)
public static int getHashConsumerInstance(Map<String,Integer> hashes, String key, int groupSize)
public static byte[] getStopRowForTransaction(byte[] queueRowPrefix,
co.cask.tephra.Transaction transaction)
public static boolean isCommittedProcessed(byte[] stateBytes,
co.cask.tephra.Transaction tx)
public static long getWritePointer(byte[] rowKey,
int queueRowPrefixLength)
Copyright © 2016 Cask Data, Inc. Licensed under the Apache License, Version 2.0.