Interface Constraint
-
- All Known Implementing Classes:
DefaultKeySizeConstraint,NoDeleteConstraint,VisibilityConstraint
public interface ConstraintConstraint objects are used to determine if mutations will be applied to a table.This interface expects implementers to return violation codes. The reason codes are returned instead of arbitrary strings to encourage conciseness. Conciseness is needed because violations are aggregated. If a user sends a batch of 10,000 mutations to Accumulo, only aggregated counts about which violations occurred are returned. If the constraint implementer were allowed to return arbitrary violation strings like the following:
Value "abc" is not a number
Value "vbg" is not a numberThis would not aggregate very well, because the same violation is represented with two different strings.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceConstraint.EnvironmentThe environment within which a constraint exists.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description List<Short>check(Constraint.Environment env, Mutation mutation)Checks a mutation for constraint violations.StringgetViolationDescription(short violationCode)Gets a short, one-sentence description of what a given violation code means.
-
-
-
Method Detail
-
getViolationDescription
String getViolationDescription(short violationCode)
Gets a short, one-sentence description of what a given violation code means.- Parameters:
violationCode- numeric violation code- Returns:
- matching violation description
-
check
List<Short> check(Constraint.Environment env, Mutation mutation)
Checks a mutation for constraint violations. If the mutation contains no violations, returns null. Otherwise, returns a list of violation codes. Violation codes must be non-negative. Negative violation codes are reserved for system use.- Parameters:
env- constraint environmentmutation- mutation to check- Returns:
- list of violation codes, or null if none
-
-