Enum AtomicMutation.Standard
- java.lang.Object
-
- java.lang.Enum<AtomicMutation.Standard>
-
- com.apple.foundationdb.record.provider.foundationdb.indexes.AtomicMutation.Standard
-
- All Implemented Interfaces:
AtomicMutation
,Serializable
,Comparable<AtomicMutation.Standard>
- Enclosing interface:
- AtomicMutation
@API(MAINTAINED) public static enum AtomicMutation.Standard extends Enum<AtomicMutation.Standard> implements AtomicMutation
The atomic mutations implemented straightforwardly by the FDB API.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.apple.foundationdb.record.provider.foundationdb.indexes.AtomicMutation
AtomicMutation.Standard
-
-
Enum Constant Summary
Enum Constants Enum Constant Description COUNT
COUNT_NOT_NULL
COUNT_UPDATES
MAX_EVER_LONG
MAX_EVER_TUPLE
MAX_EVER_VERSION
MIN_EVER_LONG
MIN_EVER_TUPLE
SUM_LONG
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
allowsNegative()
Determine whether this type allows negative values.static long
decodeSignedLong(byte[] bytes)
static long
decodeUnsignedLong(byte[] bytes)
static byte[]
encodeSignedLong(long value)
static byte[]
encodeUnsignedLong(long value)
BiFunction<Tuple,Tuple,Tuple>
getAggregator()
Get a function to aggregate multiple index entries.Tuple
getIdentity()
Get the initial value for aggregating multiple index entries.byte[]
getMutationParam(IndexEntry entry, boolean remove)
Get the underlying argument to the FDB API.MutationType
getMutationType()
Get the underlying mutation performed by the FDB API.boolean
hasLongValue()
Determine whether this type aggregates long (integer) values.boolean
hasSingleValue()
Determine whether this type aggregates exactly one value.boolean
hasValues()
Determine whether this type aggregates values (as opposed to something like counting records).boolean
isIdempotent()
Determine whether this type is idempotent.static AtomicMutation.Standard
valueOf(String name)
Returns the enum constant of this type with the specified name.static AtomicMutation.Standard[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
COUNT
public static final AtomicMutation.Standard COUNT
-
COUNT_UPDATES
public static final AtomicMutation.Standard COUNT_UPDATES
-
COUNT_NOT_NULL
public static final AtomicMutation.Standard COUNT_NOT_NULL
-
SUM_LONG
public static final AtomicMutation.Standard SUM_LONG
-
MAX_EVER_TUPLE
public static final AtomicMutation.Standard MAX_EVER_TUPLE
-
MIN_EVER_TUPLE
public static final AtomicMutation.Standard MIN_EVER_TUPLE
-
MAX_EVER_LONG
public static final AtomicMutation.Standard MAX_EVER_LONG
-
MIN_EVER_LONG
public static final AtomicMutation.Standard MIN_EVER_LONG
-
MAX_EVER_VERSION
public static final AtomicMutation.Standard MAX_EVER_VERSION
-
-
Method Detail
-
values
public static AtomicMutation.Standard[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (AtomicMutation.Standard c : AtomicMutation.Standard.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static AtomicMutation.Standard valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
getMutationType
@Nonnull public MutationType getMutationType()
Description copied from interface:AtomicMutation
Get the underlying mutation performed by the FDB API.- Specified by:
getMutationType
in interfaceAtomicMutation
- Returns:
- the underlying mutation type
-
getMutationParam
@Nullable public byte[] getMutationParam(IndexEntry entry, boolean remove)
Description copied from interface:AtomicMutation
Get the underlying argument to the FDB API.- Specified by:
getMutationParam
in interfaceAtomicMutation
- Parameters:
entry
- theTuple
form of the value being stored into the indexremove
-true
if the entry is being removed from the index- Returns:
- a byte array to pass to the FDB API or
null
to do nothing for this mutation
-
encodeUnsignedLong
@Nonnull public static byte[] encodeUnsignedLong(long value)
-
decodeUnsignedLong
public static long decodeUnsignedLong(byte[] bytes)
-
encodeSignedLong
@Nonnull public static byte[] encodeSignedLong(long value)
-
decodeSignedLong
public static long decodeSignedLong(byte[] bytes)
-
getAggregator
@Nonnull public BiFunction<Tuple,Tuple,Tuple> getAggregator()
Description copied from interface:AtomicMutation
Get a function to aggregate multiple index entries. For example, summing subtotals or maxing individual maxima.- Specified by:
getAggregator
in interfaceAtomicMutation
- Returns:
- a function that combines a running aggregate with a single entry to produce a new aggregate
- See Also:
RecordCursor.reduce(U, java.util.function.BiFunction<U, ? super T, U>)
-
getIdentity
@Nullable public Tuple getIdentity()
Description copied from interface:AtomicMutation
Get the initial value for aggregating multiple index entries.- Specified by:
getIdentity
in interfaceAtomicMutation
- Returns:
- the initial value of a running aggregate for this type
- See Also:
RecordCursor.reduce(U, java.util.function.BiFunction<U, ? super T, U>)
-
isIdempotent
public boolean isIdempotent()
Description copied from interface:AtomicMutation
Determine whether this type is idempotent. Max and min type operations are idempotent; sum and count type operations are not.- Specified by:
isIdempotent
in interfaceAtomicMutation
- Returns:
true
if updating the index multiple times with the same value yields the same result
-
hasValues
public boolean hasValues()
Description copied from interface:AtomicMutation
Determine whether this type aggregates values (as opposed to something like counting records). The values are specified in the grouped part of theGroupingKeyExpression
.- Specified by:
hasValues
in interfaceAtomicMutation
- Returns:
true
if values are allowed
-
hasSingleValue
public boolean hasSingleValue()
Description copied from interface:AtomicMutation
Determine whether this type aggregates exactly one value.- Specified by:
hasSingleValue
in interfaceAtomicMutation
- Returns:
true
if only a single value is allowed
-
hasLongValue
public boolean hasLongValue()
Description copied from interface:AtomicMutation
Determine whether this type aggregates long (integer) values.- Specified by:
hasLongValue
in interfaceAtomicMutation
- Returns:
true
if only a long value is allowed
-
allowsNegative
public boolean allowsNegative()
Description copied from interface:AtomicMutation
Determine whether this type allows negative values. If negative values are not allowed, an exception is thrown when a record is saved that contains a negative value in the indexed field.- Specified by:
allowsNegative
in interfaceAtomicMutation
- Returns:
true
if negative values are allowed
-
-