Class ConsistentHashing.Builder
- java.lang.Object
-
- com.google.protobuf.AbstractMessageLite.Builder
-
- com.google.protobuf.AbstractMessage.Builder<BuilderType>
-
- com.google.protobuf.GeneratedMessageV3.Builder<ConsistentHashing.Builder>
-
- io.envoyproxy.envoy.extensions.matching.input_matchers.consistent_hashing.v3.ConsistentHashing.Builder
-
- All Implemented Interfaces:
com.google.protobuf.Message.Builder,com.google.protobuf.MessageLite.Builder,com.google.protobuf.MessageLiteOrBuilder,com.google.protobuf.MessageOrBuilder,ConsistentHashingOrBuilder,Cloneable
- Enclosing class:
- ConsistentHashing
public static final class ConsistentHashing.Builder extends com.google.protobuf.GeneratedMessageV3.Builder<ConsistentHashing.Builder> implements ConsistentHashingOrBuilder
The consistent hashing matchers computes a consistent hash from the input and matches if the resulting hash is within the configured threshold. More specifically, this matcher evaluates to true if hash(input, seed) % modulo >= threshold. Note that the consistency of the match result relies on the internal hash function (xxhash) remaining unchanged. While this is unlikely to happen intentionally, this could cause inconsistent match results between deployments.
Protobuf typeenvoy.extensions.matching.input_matchers.consistent_hashing.v3.ConsistentHashing
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ConsistentHashing.BuilderaddRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)ConsistentHashingbuild()ConsistentHashingbuildPartial()ConsistentHashing.Builderclear()ConsistentHashing.BuilderclearField(com.google.protobuf.Descriptors.FieldDescriptor field)ConsistentHashing.BuilderclearModulo()The value to use for the modulus in the calculation.ConsistentHashing.BuilderclearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)ConsistentHashing.BuilderclearSeed()Optional seed passed through the hash function.ConsistentHashing.BuilderclearThreshold()The threshold the resulting hash must be over in order for this matcher to evaluate to true.ConsistentHashing.Builderclone()ConsistentHashinggetDefaultInstanceForType()static com.google.protobuf.Descriptors.DescriptorgetDescriptor()com.google.protobuf.Descriptors.DescriptorgetDescriptorForType()intgetModulo()The value to use for the modulus in the calculation.longgetSeed()Optional seed passed through the hash function.intgetThreshold()The threshold the resulting hash must be over in order for this matcher to evaluate to true.protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTableinternalGetFieldAccessorTable()booleanisInitialized()ConsistentHashing.BuildermergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)ConsistentHashing.BuildermergeFrom(com.google.protobuf.Message other)ConsistentHashing.BuildermergeFrom(ConsistentHashing other)ConsistentHashing.BuildermergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)ConsistentHashing.BuildersetField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)ConsistentHashing.BuildersetModulo(int value)The value to use for the modulus in the calculation.ConsistentHashing.BuildersetRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value)ConsistentHashing.BuildersetSeed(long value)Optional seed passed through the hash function.ConsistentHashing.BuildersetThreshold(int value)The threshold the resulting hash must be over in order for this matcher to evaluate to true.ConsistentHashing.BuildersetUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)-
Methods inherited from class com.google.protobuf.GeneratedMessageV3.Builder
getAllFields, getField, getFieldBuilder, getOneofFieldDescriptor, getParentForChildren, getRepeatedField, getRepeatedFieldBuilder, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof, internalGetMapField, internalGetMutableMapField, isClean, markClean, newBuilderForField, onBuilt, onChanged, setUnknownFieldsProto3
-
Methods inherited from class com.google.protobuf.AbstractMessage.Builder
findInitializationErrors, getInitializationErrorString, internalMergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException, toString
-
Methods inherited from class com.google.protobuf.AbstractMessageLite.Builder
addAll, addAll, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, newUninitializedMessageException
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Method Detail
-
getDescriptor
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
-
internalGetFieldAccessorTable
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
- Specified by:
internalGetFieldAccessorTablein classcom.google.protobuf.GeneratedMessageV3.Builder<ConsistentHashing.Builder>
-
clear
public ConsistentHashing.Builder clear()
- Specified by:
clearin interfacecom.google.protobuf.Message.Builder- Specified by:
clearin interfacecom.google.protobuf.MessageLite.Builder- Overrides:
clearin classcom.google.protobuf.GeneratedMessageV3.Builder<ConsistentHashing.Builder>
-
getDescriptorForType
public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()
- Specified by:
getDescriptorForTypein interfacecom.google.protobuf.Message.Builder- Specified by:
getDescriptorForTypein interfacecom.google.protobuf.MessageOrBuilder- Overrides:
getDescriptorForTypein classcom.google.protobuf.GeneratedMessageV3.Builder<ConsistentHashing.Builder>
-
getDefaultInstanceForType
public ConsistentHashing getDefaultInstanceForType()
- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageLiteOrBuilder- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageOrBuilder
-
build
public ConsistentHashing build()
- Specified by:
buildin interfacecom.google.protobuf.Message.Builder- Specified by:
buildin interfacecom.google.protobuf.MessageLite.Builder
-
buildPartial
public ConsistentHashing buildPartial()
- Specified by:
buildPartialin interfacecom.google.protobuf.Message.Builder- Specified by:
buildPartialin interfacecom.google.protobuf.MessageLite.Builder
-
clone
public ConsistentHashing.Builder clone()
- Specified by:
clonein interfacecom.google.protobuf.Message.Builder- Specified by:
clonein interfacecom.google.protobuf.MessageLite.Builder- Overrides:
clonein classcom.google.protobuf.GeneratedMessageV3.Builder<ConsistentHashing.Builder>
-
setField
public ConsistentHashing.Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)
- Specified by:
setFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
setFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<ConsistentHashing.Builder>
-
clearField
public ConsistentHashing.Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field)
- Specified by:
clearFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
clearFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<ConsistentHashing.Builder>
-
clearOneof
public ConsistentHashing.Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)
- Specified by:
clearOneofin interfacecom.google.protobuf.Message.Builder- Overrides:
clearOneofin classcom.google.protobuf.GeneratedMessageV3.Builder<ConsistentHashing.Builder>
-
setRepeatedField
public ConsistentHashing.Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value)
- Specified by:
setRepeatedFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
setRepeatedFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<ConsistentHashing.Builder>
-
addRepeatedField
public ConsistentHashing.Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)
- Specified by:
addRepeatedFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
addRepeatedFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<ConsistentHashing.Builder>
-
mergeFrom
public ConsistentHashing.Builder mergeFrom(com.google.protobuf.Message other)
- Specified by:
mergeFromin interfacecom.google.protobuf.Message.Builder- Overrides:
mergeFromin classcom.google.protobuf.AbstractMessage.Builder<ConsistentHashing.Builder>
-
mergeFrom
public ConsistentHashing.Builder mergeFrom(ConsistentHashing other)
-
isInitialized
public final boolean isInitialized()
- Specified by:
isInitializedin interfacecom.google.protobuf.MessageLiteOrBuilder- Overrides:
isInitializedin classcom.google.protobuf.GeneratedMessageV3.Builder<ConsistentHashing.Builder>
-
mergeFrom
public ConsistentHashing.Builder mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
- Specified by:
mergeFromin interfacecom.google.protobuf.Message.Builder- Specified by:
mergeFromin interfacecom.google.protobuf.MessageLite.Builder- Overrides:
mergeFromin classcom.google.protobuf.AbstractMessage.Builder<ConsistentHashing.Builder>- Throws:
IOException
-
getThreshold
public int getThreshold()
The threshold the resulting hash must be over in order for this matcher to evaluate to true. This value must be below the configured modulo value. Setting this to 0 is equivalent to this matcher always matching.
uint32 threshold = 1;- Specified by:
getThresholdin interfaceConsistentHashingOrBuilder- Returns:
- The threshold.
-
setThreshold
public ConsistentHashing.Builder setThreshold(int value)
The threshold the resulting hash must be over in order for this matcher to evaluate to true. This value must be below the configured modulo value. Setting this to 0 is equivalent to this matcher always matching.
uint32 threshold = 1;- Parameters:
value- The threshold to set.- Returns:
- This builder for chaining.
-
clearThreshold
public ConsistentHashing.Builder clearThreshold()
The threshold the resulting hash must be over in order for this matcher to evaluate to true. This value must be below the configured modulo value. Setting this to 0 is equivalent to this matcher always matching.
uint32 threshold = 1;- Returns:
- This builder for chaining.
-
getModulo
public int getModulo()
The value to use for the modulus in the calculation. This effectively bounds the hash output, specifying the range of possible values. This value must be above the configured threshold.
uint32 modulo = 2 [(.validate.rules) = { ... }- Specified by:
getModuloin interfaceConsistentHashingOrBuilder- Returns:
- The modulo.
-
setModulo
public ConsistentHashing.Builder setModulo(int value)
The value to use for the modulus in the calculation. This effectively bounds the hash output, specifying the range of possible values. This value must be above the configured threshold.
uint32 modulo = 2 [(.validate.rules) = { ... }- Parameters:
value- The modulo to set.- Returns:
- This builder for chaining.
-
clearModulo
public ConsistentHashing.Builder clearModulo()
The value to use for the modulus in the calculation. This effectively bounds the hash output, specifying the range of possible values. This value must be above the configured threshold.
uint32 modulo = 2 [(.validate.rules) = { ... }- Returns:
- This builder for chaining.
-
getSeed
public long getSeed()
Optional seed passed through the hash function. This allows using additional information when computing the hash value: by changing the seed value, a different partition of matching and non-matching inputs will be created that remains consistent for that seed value.
uint64 seed = 3;- Specified by:
getSeedin interfaceConsistentHashingOrBuilder- Returns:
- The seed.
-
setSeed
public ConsistentHashing.Builder setSeed(long value)
Optional seed passed through the hash function. This allows using additional information when computing the hash value: by changing the seed value, a different partition of matching and non-matching inputs will be created that remains consistent for that seed value.
uint64 seed = 3;- Parameters:
value- The seed to set.- Returns:
- This builder for chaining.
-
clearSeed
public ConsistentHashing.Builder clearSeed()
Optional seed passed through the hash function. This allows using additional information when computing the hash value: by changing the seed value, a different partition of matching and non-matching inputs will be created that remains consistent for that seed value.
uint64 seed = 3;- Returns:
- This builder for chaining.
-
setUnknownFields
public final ConsistentHashing.Builder setUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)
- Specified by:
setUnknownFieldsin interfacecom.google.protobuf.Message.Builder- Overrides:
setUnknownFieldsin classcom.google.protobuf.GeneratedMessageV3.Builder<ConsistentHashing.Builder>
-
mergeUnknownFields
public final ConsistentHashing.Builder mergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)
- Specified by:
mergeUnknownFieldsin interfacecom.google.protobuf.Message.Builder- Overrides:
mergeUnknownFieldsin classcom.google.protobuf.GeneratedMessageV3.Builder<ConsistentHashing.Builder>
-
-