Class 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 the mask_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.
    • 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 class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • appendCqlTo

        public void appendCqlTo​(CqlBuilder builder)