Class ConsistentHashing.Builder
java.lang.Object
com.google.protobuf.AbstractMessageLite.Builder
com.google.protobuf.AbstractMessage.Builder<BuilderT>
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 type
envoy.extensions.matching.input_matchers.consistent_hashing.v3.ConsistentHashing-
Method Summary
Modifier and TypeMethodDescriptionaddRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value) build()clear()clearField(com.google.protobuf.Descriptors.FieldDescriptor field) The value to use for the modulus in the calculation.clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) Optional seed passed through the hash function.The threshold the resulting hash must be over in order for this matcher to evaluate to true.clone()static final com.google.protobuf.Descriptors.Descriptorcom.google.protobuf.Descriptors.DescriptorintThe value to use for the modulus in the calculation.longgetSeed()Optional seed passed through the hash function.intThe threshold the resulting hash must be over in order for this matcher to evaluate to true.protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTablefinal booleanmergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) mergeFrom(com.google.protobuf.Message other) mergeFrom(ConsistentHashing other) mergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields) setModulo(int value) The value to use for the modulus in the calculation.setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value) setSeed(long value) Optional seed passed through the hash function.setThreshold(int value) The threshold the resulting hash must be over in order for this matcher to evaluate to true.setUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields) Methods inherited from class com.google.protobuf.GeneratedMessageV3.Builder
getAllFields, getField, getFieldBuilder, getOneofFieldDescriptor, getParentForChildren, getRepeatedField, getRepeatedFieldBuilder, getRepeatedFieldCount, getUnknownFields, getUnknownFieldSetBuilder, hasField, hasOneof, internalGetMapField, internalGetMapFieldReflection, internalGetMutableMapField, internalGetMutableMapFieldReflection, isClean, markClean, mergeUnknownLengthDelimitedField, mergeUnknownVarintField, newBuilderForField, onBuilt, onChanged, parseUnknownField, setUnknownFieldSetBuilder, setUnknownFieldsProto3Methods inherited from class com.google.protobuf.AbstractMessage.Builder
findInitializationErrors, getInitializationErrorString, internalMergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException, toStringMethods inherited from class com.google.protobuf.AbstractMessageLite.Builder
addAll, addAll, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, newUninitializedMessageExceptionMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.google.protobuf.Message.Builder
mergeDelimitedFrom, mergeDelimitedFromMethods inherited from interface com.google.protobuf.MessageLite.Builder
mergeFromMethods inherited from interface com.google.protobuf.MessageOrBuilder
findInitializationErrors, getAllFields, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof
-
Method Details
-
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
- 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
- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageLiteOrBuilder- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageOrBuilder
-
build
- Specified by:
buildin interfacecom.google.protobuf.Message.Builder- Specified by:
buildin interfacecom.google.protobuf.MessageLite.Builder
-
buildPartial
- Specified by:
buildPartialin interfacecom.google.protobuf.Message.Builder- Specified by:
buildPartialin interfacecom.google.protobuf.MessageLite.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
- Specified by:
clearFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
clearFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<ConsistentHashing.Builder>
-
clearOneof
- 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
- Specified by:
mergeFromin interfacecom.google.protobuf.Message.Builder- Overrides:
mergeFromin classcom.google.protobuf.AbstractMessage.Builder<ConsistentHashing.Builder>
-
mergeFrom
-
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
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
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
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
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
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
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>
-