Apache Accumulo Documentation : Constraints

Accumulo supports constraints. Constraints are applied to mutations at ingest time.

Implementing a new constraint is a snap. Simply write some Java code that implements org.apache.accumulo.core.constraints.Constraint.

To deploy a new constraint, jar it up and put the jar in accumulo/lib/ext.

After creating a constraint, set a table specific property to use it. The following example adds two constraints to table foo. In the example com.test.ExampleConstraint and com.test.AnotherConstraint are class names.

user@instance:9999 perDayCounts> createtable foo
user@instance:9999 foo> config -t foo -s table.constraint.1=com.test.ExampleConstraint
user@instance:9999 foo> config -t foo -s table.constraint.2=com.test.AnotherConstraint
user@instance:9999 foo> config -t foo -f constraint
---------+------------------------------------------+-----------------------------------------
SCOPE    | NAME                                     | VALUE
---------+------------------------------------------+-----------------------------------------
table    | table.constraint.1...................... | com.test.ExampleConstraint
table    | table.constraint.2...................... | com.test.AnotherConstraint
---------+------------------------------------------+-----------------------------------------
user@instance:9999 foo>