@InterfaceAudience.Private public class ConstraintProcessor extends Object implements RegionCoprocessor, RegionObserver
Constraints
on a given table.
This is an ease of use mechanism - all the functionality here could be implemented on any given system by a coprocessor.
Coprocessor.State
RegionObserver.MutationType
Modifier and Type | Field and Description |
---|---|
private ClassLoader |
classloader |
private List<? extends Constraint> |
constraints |
private static org.slf4j.Logger |
LOG |
PRIORITY_HIGHEST, PRIORITY_LOWEST, PRIORITY_SYSTEM, PRIORITY_USER, VERSION
Constructor and Description |
---|
ConstraintProcessor()
Create the constraint processor.
|
Modifier and Type | Method and Description |
---|---|
Optional<RegionObserver> |
getRegionObserver() |
boolean |
postScannerFilterRow(ObserverContext<RegionCoprocessorEnvironment> e,
InternalScanner s,
Cell curRowCell,
boolean hasMore)
This will be called by the scan flow when the current scanned row is being filtered out by the
filter.
|
void |
prePut(ObserverContext<RegionCoprocessorEnvironment> e,
Put put,
WALEdit edit,
Durability durability)
Called before the client stores a value.
|
void |
start(CoprocessorEnvironment environment)
Called by the
CoprocessorEnvironment during it's own startup to initialize the
coprocessor. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getBulkLoadObserver, getEndpointObserver
getServices, stop
postAppend, postAppendBeforeWAL, postBatchMutate, postBatchMutateIndispensably, postBulkLoadHFile, postCheckAndDelete, postCheckAndPut, postClose, postCloseRegionOperation, postCommitStoreFile, postCompact, postCompactSelection, postDelete, postExists, postFlush, postFlush, postGetOp, postIncrement, postIncrementBeforeWAL, postInstantiateDeleteTracker, postMemStoreCompaction, postMutationBeforeWAL, postOpen, postPut, postReplayWALs, postScannerClose, postScannerNext, postScannerOpen, postStartRegionOperation, postStoreFileReaderOpen, postWALRestore, preAppend, preAppendAfterRowLock, preBatchMutate, preBulkLoadHFile, preCheckAndDelete, preCheckAndDeleteAfterRowLock, preCheckAndPut, preCheckAndPutAfterRowLock, preClose, preCommitStoreFile, preCompact, preCompactScannerOpen, preCompactSelection, preDelete, preExists, preFlush, preFlush, preFlushScannerOpen, preGetOp, preIncrement, preIncrementAfterRowLock, preMemStoreCompaction, preMemStoreCompactionCompact, preMemStoreCompactionCompactScannerOpen, preOpen, prePrepareTimeStampForDeleteVersion, preReplayWALs, preScannerClose, preScannerNext, preScannerOpen, preStoreFileReaderOpen, preStoreScannerOpen, preWALRestore
private static final org.slf4j.Logger LOG
private final ClassLoader classloader
private List<? extends Constraint> constraints
public ConstraintProcessor()
Stores the current classloader.
public Optional<RegionObserver> getRegionObserver()
getRegionObserver
in interface RegionCoprocessor
public void start(CoprocessorEnvironment environment)
Coprocessor
CoprocessorEnvironment
during it's own startup to initialize the
coprocessor.start
in interface Coprocessor
public void prePut(ObserverContext<RegionCoprocessorEnvironment> e, Put put, WALEdit edit, Durability durability) throws IOException
RegionObserver
Call CoprocessorEnvironment#bypass to skip default actions. If 'bypass' is set, we skip out on calling any subsequent chained coprocessors.
Note: Do not retain references to any Cells in 'put' beyond the life of this invocation. If need a Cell reference for later use, copy the cell and use that.
prePut
in interface RegionObserver
e
- the environment provided by the region serverput
- The Put objectedit
- The WALEdit object that will be written to the waldurability
- Persistence guarantee for this PutIOException
public boolean postScannerFilterRow(ObserverContext<RegionCoprocessorEnvironment> e, InternalScanner s, Cell curRowCell, boolean hasMore) throws IOException
RegionObserver
boolean filterRowKey(byte [] buffer, int offset, int length)
returning trueboolean filterRow()
returning truedefault void filterRow(List<KeyValue> kvs)
removing all the kvs from
the passed ListNote: Do not retain references to any Cells returned by scanner, beyond the life of this invocation. If need a Cell reference for later use, copy the cell and use that.
postScannerFilterRow
in interface RegionObserver
e
- the environment provided by the region servers
- the scannercurRowCell
- The cell in the current row which got filtered outhasMore
- the 'has more' indicationIOException
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.