Class 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 Detail

      • getDescriptor

        public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
      • internalGetFieldAccessorTable

        protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
        Specified by:
        internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3.Builder<ConsistentHashing.Builder>
      • clear

        public ConsistentHashing.Builder clear()
        Specified by:
        clear in interface com.google.protobuf.Message.Builder
        Specified by:
        clear in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        clear in class com.google.protobuf.GeneratedMessageV3.Builder<ConsistentHashing.Builder>
      • getDescriptorForType

        public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()
        Specified by:
        getDescriptorForType in interface com.google.protobuf.Message.Builder
        Specified by:
        getDescriptorForType in interface com.google.protobuf.MessageOrBuilder
        Overrides:
        getDescriptorForType in class com.google.protobuf.GeneratedMessageV3.Builder<ConsistentHashing.Builder>
      • getDefaultInstanceForType

        public ConsistentHashing getDefaultInstanceForType()
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder
      • build

        public ConsistentHashing build()
        Specified by:
        build in interface com.google.protobuf.Message.Builder
        Specified by:
        build in interface com.google.protobuf.MessageLite.Builder
      • buildPartial

        public ConsistentHashing buildPartial()
        Specified by:
        buildPartial in interface com.google.protobuf.Message.Builder
        Specified by:
        buildPartial in interface com.google.protobuf.MessageLite.Builder
      • clone

        public ConsistentHashing.Builder clone()
        Specified by:
        clone in interface com.google.protobuf.Message.Builder
        Specified by:
        clone in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        clone in class com.google.protobuf.GeneratedMessageV3.Builder<ConsistentHashing.Builder>
      • setField

        public ConsistentHashing.Builder setField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                                  Object value)
        Specified by:
        setField in interface com.google.protobuf.Message.Builder
        Overrides:
        setField in class com.google.protobuf.GeneratedMessageV3.Builder<ConsistentHashing.Builder>
      • clearField

        public ConsistentHashing.Builder clearField​(com.google.protobuf.Descriptors.FieldDescriptor field)
        Specified by:
        clearField in interface com.google.protobuf.Message.Builder
        Overrides:
        clearField in class com.google.protobuf.GeneratedMessageV3.Builder<ConsistentHashing.Builder>
      • clearOneof

        public ConsistentHashing.Builder clearOneof​(com.google.protobuf.Descriptors.OneofDescriptor oneof)
        Specified by:
        clearOneof in interface com.google.protobuf.Message.Builder
        Overrides:
        clearOneof in class com.google.protobuf.GeneratedMessageV3.Builder<ConsistentHashing.Builder>
      • setRepeatedField

        public ConsistentHashing.Builder setRepeatedField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                                          int index,
                                                          Object value)
        Specified by:
        setRepeatedField in interface com.google.protobuf.Message.Builder
        Overrides:
        setRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<ConsistentHashing.Builder>
      • addRepeatedField

        public ConsistentHashing.Builder addRepeatedField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                                          Object value)
        Specified by:
        addRepeatedField in interface com.google.protobuf.Message.Builder
        Overrides:
        addRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<ConsistentHashing.Builder>
      • mergeFrom

        public ConsistentHashing.Builder mergeFrom​(com.google.protobuf.Message other)
        Specified by:
        mergeFrom in interface com.google.protobuf.Message.Builder
        Overrides:
        mergeFrom in class com.google.protobuf.AbstractMessage.Builder<ConsistentHashing.Builder>
      • isInitialized

        public final boolean isInitialized()
        Specified by:
        isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
        Overrides:
        isInitialized in class com.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:
        mergeFrom in interface com.google.protobuf.Message.Builder
        Specified by:
        mergeFrom in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        mergeFrom in class com.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:
        getThreshold in interface ConsistentHashingOrBuilder
        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:
        getModulo in interface ConsistentHashingOrBuilder
        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:
        getSeed in interface ConsistentHashingOrBuilder
        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:
        setUnknownFields in interface com.google.protobuf.Message.Builder
        Overrides:
        setUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<ConsistentHashing.Builder>
      • mergeUnknownFields

        public final ConsistentHashing.Builder mergeUnknownFields​(com.google.protobuf.UnknownFieldSet unknownFields)
        Specified by:
        mergeUnknownFields in interface com.google.protobuf.Message.Builder
        Overrides:
        mergeUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<ConsistentHashing.Builder>