Chapter 6. Server-Side Functionality and External Clients
Beyond reading and writing data, configuring tables, and securing data, Accumulo has a few additional concepts that can be used to add functionality to tables, and for performing some computation on the server side. These mechanisms are optional but can have a drastic impact on application performance, depending on the access patterns and updates that an application requires.
Constraints
Tables can apply logic to data that is about to be written to determine if a given mutation should be allowed. This logic is implemented by creating a constraint. Constraints are classes that implement a simple filtering function that is applied to every mutation before writing it to a table.
Constraints can be used to ensure that all data in a table conforms to some specification. This helps simplify applications, because they can then assume that the data read from this table has already been checked for conformity.
For example, we can choose to constrain the values inserted into a table to be of a certain type, such as a number. This allows applications to avoid having to check the type of values returned.
If a mutation fails a constraint’s criteria, the mutation will be rejected and a code returned, indicating which criterion was violated. For example:
try
{
writer
.
addMutation
(
m
);
}
catch
(
MutationsRejectedException
e
)
{
List
<
ConstraintViolationSummary
>
violations
=
e
.
getConstraintViolationSummaries
();
for
(
ConstraintViolationSummary ...
Get Accumulo now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.