@InterfaceAudience.Private public interface Constraint extends org.apache.hadoop.conf.Configurable
Constraint(in traditional database terminology) to a HTable. Any number of
Constraintscan be added to the table, in any order.
Constraint must be added to a table before the table is loaded via
Constraints.add(org.apache.hadoop.hbase.HTableDescriptor, Class) or
(if you want to add a configuration with the
Constraint). Constraints will be run in the
order that they are added. Further, a Constraint will be configured before it is run (on load).
Constraints.enableConstraint(org.apache.hadoop.hbase.HTableDescriptor, Class) and
Constraints.disableConstraint(org.apache.hadoop.hbase.HTableDescriptor, Class) for
enabling/disabling of a given
Constraint after it has been added.
Put is invalid, the Constraint should throw some sort of
ConstraintException, indicating that the
has failed. When this exception is thrown, not further retries of the
Put are attempted
nor are any other
Constraints attempted (the
Put is clearly not
valid). Therefore, there are performance implications in the order in which
Constraints are specified.
Constraint fails to fail the
Put via a
ConstraintException, but instead throws a
RuntimeException, the entire constraint processing mechanism
ConstraintProcessor) will be unloaded from the table. This ensures that the region
server is still functional, but no more
Puts will be checked via
Constraints should probably not be used to enforce cross-table
references as it will cause tremendous write slowdowns, but it is possible.
NOTE: Implementing classes must have a nullary (no-args) constructor
void check(Put p) throws ConstraintException
Putto ensure it is valid for the table. If the
Putis valid, then just return from the method. Otherwise, throw an
Exceptionspecifying what happened. This
Exceptionis propagated back to the client so you can see what caused the
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.