Class ColumnMask
- java.lang.Object
-
- org.apache.cassandra.cql3.functions.masking.ColumnMask
-
public class ColumnMask extends java.lang.Object
Dynamic data mask that can be applied to a schema column.It consists on a partial application of a certain
MaskingFunction
to the values of a column, with the precondition that the type of any masked column is compatible with the type of the first argument of the function.This partial application is meant to be associated to specific columns in the schema, acting as a mask for the values of those columns. It's associated to queries such as:
CREATE TABLE t (k int PRIMARY KEY, v int MASKED WITH mask_inner(1, 1)); ALTER TABLE t ALTER v MASKED WITH mask_inner(2, 1); ALTER TABLE t ALTER v DROP MASKED;
Note that in the example above we are referencing themask_inner
function with two arguments. However, that CQL function actually has three arguments. The first argument is always ommitted when attaching the function to a schema column. The value of that first argument is always the value of the masked column, in this case an int.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ColumnMask.Masker
static class
ColumnMask.Raw
A parsed but not prepared column mask.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DISABLED_ERROR_MESSAGE
ScalarFunction
function
The CQL function used for masking.protected java.nio.ByteBuffer[]
partialArgumentValues
The values of the arguments of the partially applied masking function.
-
Constructor Summary
Constructors Constructor Description ColumnMask(ScalarFunction function, java.nio.ByteBuffer... partialArgumentValues)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
appendCqlTo(CqlBuilder builder)
static void
ensureEnabled()
boolean
equals(java.lang.Object o)
int
hashCode()
ColumnMask.Masker
masker(ProtocolVersion version)
java.util.List<AbstractType<?>>
partialArgumentTypes()
java.util.List<java.nio.ByteBuffer>
partialArgumentValues()
java.lang.String
toString()
ColumnMask
withReversedType()
-
-
-
Field Detail
-
DISABLED_ERROR_MESSAGE
public static final java.lang.String DISABLED_ERROR_MESSAGE
- See Also:
- Constant Field Values
-
function
public final ScalarFunction function
The CQL function used for masking.
-
partialArgumentValues
protected final java.nio.ByteBuffer[] partialArgumentValues
The values of the arguments of the partially applied masking function.
-
-
Constructor Detail
-
ColumnMask
public ColumnMask(ScalarFunction function, java.nio.ByteBuffer... partialArgumentValues)
-
-
Method Detail
-
partialArgumentTypes
public java.util.List<AbstractType<?>> partialArgumentTypes()
- Returns:
- The types of the arguments of the partially applied masking function, as an unmodifiable list.
-
partialArgumentValues
public java.util.List<java.nio.ByteBuffer> partialArgumentValues()
- Returns:
- The values of the arguments of the partially applied masking function, as an unmodifiable list that can contain nulls.
-
withReversedType
public ColumnMask withReversedType()
- Returns:
- A copy of this mask for a version of its masked column that has its type reversed.
-
masker
public ColumnMask.Masker masker(ProtocolVersion version)
- Parameters:
version
- the used version of the transport protocol- Returns:
- a masker instance that caches the terminal masking function arguments
-
ensureEnabled
public static void ensureEnabled()
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
appendCqlTo
public void appendCqlTo(CqlBuilder builder)
-
-