use of co.cask.cdap.data2.queue.ConsumerConfig in project cdap by caskdata.
the class DequeueFilter method filterRowCells.
@Override
public void filterRowCells(List<Cell> cells) {
byte[] dataBytes = null;
byte[] metaBytes = null;
byte[] stateBytes = null;
// list is very short so it is ok to loop thru to find columns
for (Cell cell : cells) {
if (CellUtil.matchingQualifier(cell, QueueEntryRow.DATA_COLUMN)) {
dataBytes = CellUtil.cloneValue(cell);
} else if (CellUtil.matchingQualifier(cell, QueueEntryRow.META_COLUMN)) {
metaBytes = CellUtil.cloneValue(cell);
} else if (CellUtil.matchingQualifier(cell, stateColumnName)) {
stateBytes = CellUtil.cloneValue(cell);
}
}
if (dataBytes == null || metaBytes == null) {
skipRow = true;
return;
}
QueueEntryRow.CanConsume canConsume = QueueEntryRow.canConsume(consumerConfig, transaction, writePointer, counter, metaBytes, stateBytes);
// Only skip the row when canConsumer == NO, so that in case of NO_INCLUDING_ALL_OLDER, the client
// can still see the row and move the scan start row.
skipRow = canConsume == QueueEntryRow.CanConsume.NO;
}
use of co.cask.cdap.data2.queue.ConsumerConfig in project cdap by caskdata.
the class DequeueScanObserver method preScannerOpen.
@Override
public RegionScanner preScannerOpen(ObserverContext<RegionCoprocessorEnvironment> e, Scan scan, RegionScanner s) throws IOException {
ConsumerConfig consumerConfig = DequeueScanAttributes.getConsumerConfig(scan);
Transaction tx = DequeueScanAttributes.getTx(scan);
if (consumerConfig == null || tx == null) {
return super.preScannerOpen(e, scan, s);
}
Filter dequeueFilter = new DequeueFilter(consumerConfig, tx);
Filter existing = scan.getFilter();
if (existing != null) {
Filter combined = new FilterList(FilterList.Operator.MUST_PASS_ALL, existing, dequeueFilter);
scan.setFilter(combined);
} else {
scan.setFilter(dequeueFilter);
}
return super.preScannerOpen(e, scan, s);
}
use of co.cask.cdap.data2.queue.ConsumerConfig in project cdap by caskdata.
the class DequeueFilter method filterRowCells.
@Override
public void filterRowCells(List<Cell> cells) {
byte[] dataBytes = null;
byte[] metaBytes = null;
byte[] stateBytes = null;
// list is very short so it is ok to loop thru to find columns
for (Cell cell : cells) {
if (CellUtil.matchingQualifier(cell, QueueEntryRow.DATA_COLUMN)) {
dataBytes = CellUtil.cloneValue(cell);
} else if (CellUtil.matchingQualifier(cell, QueueEntryRow.META_COLUMN)) {
metaBytes = CellUtil.cloneValue(cell);
} else if (CellUtil.matchingQualifier(cell, stateColumnName)) {
stateBytes = CellUtil.cloneValue(cell);
}
}
if (dataBytes == null || metaBytes == null) {
skipRow = true;
return;
}
QueueEntryRow.CanConsume canConsume = QueueEntryRow.canConsume(consumerConfig, transaction, writePointer, counter, metaBytes, stateBytes);
// Only skip the row when canConsumer == NO, so that in case of NO_INCLUDING_ALL_OLDER, the client
// can still see the row and move the scan start row.
skipRow = canConsume == QueueEntryRow.CanConsume.NO;
}
use of co.cask.cdap.data2.queue.ConsumerConfig in project cdap by caskdata.
the class DequeueScanObserver method preScannerOpen.
@Override
public RegionScanner preScannerOpen(ObserverContext<RegionCoprocessorEnvironment> e, Scan scan, RegionScanner s) throws IOException {
ConsumerConfig consumerConfig = DequeueScanAttributes.getConsumerConfig(scan);
Transaction tx = DequeueScanAttributes.getTx(scan);
if (consumerConfig == null || tx == null) {
return super.preScannerOpen(e, scan, s);
}
Filter dequeueFilter = new DequeueFilter(consumerConfig, tx);
Filter existing = scan.getFilter();
if (existing != null) {
Filter combined = new FilterList(FilterList.Operator.MUST_PASS_ALL, existing, dequeueFilter);
scan.setFilter(combined);
} else {
scan.setFilter(dequeueFilter);
}
return super.preScannerOpen(e, scan, s);
}
use of co.cask.cdap.data2.queue.ConsumerConfig in project cdap by caskdata.
the class DequeueFilter method filterRowCells.
@Override
public void filterRowCells(List<Cell> cells) {
byte[] dataBytes = null;
byte[] metaBytes = null;
byte[] stateBytes = null;
// list is very short so it is ok to loop thru to find columns
for (Cell cell : cells) {
if (CellUtil.matchingQualifier(cell, QueueEntryRow.DATA_COLUMN)) {
dataBytes = CellUtil.cloneValue(cell);
} else if (CellUtil.matchingQualifier(cell, QueueEntryRow.META_COLUMN)) {
metaBytes = CellUtil.cloneValue(cell);
} else if (CellUtil.matchingQualifier(cell, stateColumnName)) {
stateBytes = CellUtil.cloneValue(cell);
}
}
if (dataBytes == null || metaBytes == null) {
skipRow = true;
return;
}
QueueEntryRow.CanConsume canConsume = QueueEntryRow.canConsume(consumerConfig, transaction, writePointer, counter, metaBytes, stateBytes);
// Only skip the row when canConsumer == NO, so that in case of NO_INCLUDING_ALL_OLDER, the client
// can still see the row and move the scan start row.
skipRow = canConsume == QueueEntryRow.CanConsume.NO;
}
Aggregations