Class LoadBalancingPolicy.Builder

  • All Implemented Interfaces:
    com.google.protobuf.Message.Builder, com.google.protobuf.MessageLite.Builder, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, LoadBalancingPolicyOrBuilder, java.lang.Cloneable
    Enclosing class:
    LoadBalancingPolicy

    public static final class LoadBalancingPolicy.Builder
    extends com.google.protobuf.GeneratedMessage.Builder<LoadBalancingPolicy.Builder>
    implements LoadBalancingPolicyOrBuilder
     Extensible load balancing policy configuration.
    
     Every LB policy defined via this mechanism will be identified via a unique name using reverse
     DNS notation. If the policy needs configuration parameters, it must define a message for its
     own configuration, which will be stored in the config field. The name of the policy will tell
     clients which type of message they should expect to see in the config field.
    
     Note that there are cases where it is useful to be able to independently select LB policies
     for choosing a locality and for choosing an endpoint within that locality. For example, a
     given deployment may always use the same policy to choose the locality, but for choosing the
     endpoint within the locality, some clusters may use weighted-round-robin, while others may
     use some sort of session-based balancing.
    
     This can be accomplished via hierarchical LB policies, where the parent LB policy creates a
     child LB policy for each locality. For each request, the parent chooses the locality and then
     delegates to the child policy for that locality to choose the endpoint within the locality.
    
     To facilitate this, the config message for the top-level LB policy may include a field of
     type LoadBalancingPolicy that specifies the child policy.
     
    Protobuf type envoy.config.cluster.v3.LoadBalancingPolicy
    • Constructor Detail

      • Builder

        private Builder()
      • Builder

        private Builder​(com.google.protobuf.AbstractMessage.BuilderParent parent)
    • Method Detail

      • getDescriptor

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

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

        public LoadBalancingPolicy.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.GeneratedMessage.Builder<LoadBalancingPolicy.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.GeneratedMessage.Builder<LoadBalancingPolicy.Builder>
      • getDefaultInstanceForType

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

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

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

        private void buildPartialRepeatedFields​(LoadBalancingPolicy result)
      • mergeFrom

        public LoadBalancingPolicy.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<LoadBalancingPolicy.Builder>
      • isInitialized

        public final boolean isInitialized()
        Specified by:
        isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
        Overrides:
        isInitialized in class com.google.protobuf.GeneratedMessage.Builder<LoadBalancingPolicy.Builder>
      • mergeFrom

        public LoadBalancingPolicy.Builder mergeFrom​(com.google.protobuf.CodedInputStream input,
                                                     com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                              throws java.io.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<LoadBalancingPolicy.Builder>
        Throws:
        java.io.IOException
      • ensurePoliciesIsMutable

        private void ensurePoliciesIsMutable()
      • getPoliciesList

        public java.util.List<LoadBalancingPolicy.Policy> getPoliciesList()
         Each client will iterate over the list in order and stop at the first policy that it
         supports. This provides a mechanism for starting to use new LB policies that are not yet
         supported by all clients.
         
        repeated .envoy.config.cluster.v3.LoadBalancingPolicy.Policy policies = 1;
        Specified by:
        getPoliciesList in interface LoadBalancingPolicyOrBuilder
      • getPoliciesCount

        public int getPoliciesCount()
         Each client will iterate over the list in order and stop at the first policy that it
         supports. This provides a mechanism for starting to use new LB policies that are not yet
         supported by all clients.
         
        repeated .envoy.config.cluster.v3.LoadBalancingPolicy.Policy policies = 1;
        Specified by:
        getPoliciesCount in interface LoadBalancingPolicyOrBuilder
      • getPolicies

        public LoadBalancingPolicy.Policy getPolicies​(int index)
         Each client will iterate over the list in order and stop at the first policy that it
         supports. This provides a mechanism for starting to use new LB policies that are not yet
         supported by all clients.
         
        repeated .envoy.config.cluster.v3.LoadBalancingPolicy.Policy policies = 1;
        Specified by:
        getPolicies in interface LoadBalancingPolicyOrBuilder
      • setPolicies

        public LoadBalancingPolicy.Builder setPolicies​(int index,
                                                       LoadBalancingPolicy.Policy value)
         Each client will iterate over the list in order and stop at the first policy that it
         supports. This provides a mechanism for starting to use new LB policies that are not yet
         supported by all clients.
         
        repeated .envoy.config.cluster.v3.LoadBalancingPolicy.Policy policies = 1;
      • setPolicies

        public LoadBalancingPolicy.Builder setPolicies​(int index,
                                                       LoadBalancingPolicy.Policy.Builder builderForValue)
         Each client will iterate over the list in order and stop at the first policy that it
         supports. This provides a mechanism for starting to use new LB policies that are not yet
         supported by all clients.
         
        repeated .envoy.config.cluster.v3.LoadBalancingPolicy.Policy policies = 1;
      • addPolicies

        public LoadBalancingPolicy.Builder addPolicies​(LoadBalancingPolicy.Policy value)
         Each client will iterate over the list in order and stop at the first policy that it
         supports. This provides a mechanism for starting to use new LB policies that are not yet
         supported by all clients.
         
        repeated .envoy.config.cluster.v3.LoadBalancingPolicy.Policy policies = 1;
      • addPolicies

        public LoadBalancingPolicy.Builder addPolicies​(int index,
                                                       LoadBalancingPolicy.Policy value)
         Each client will iterate over the list in order and stop at the first policy that it
         supports. This provides a mechanism for starting to use new LB policies that are not yet
         supported by all clients.
         
        repeated .envoy.config.cluster.v3.LoadBalancingPolicy.Policy policies = 1;
      • addPolicies

        public LoadBalancingPolicy.Builder addPolicies​(LoadBalancingPolicy.Policy.Builder builderForValue)
         Each client will iterate over the list in order and stop at the first policy that it
         supports. This provides a mechanism for starting to use new LB policies that are not yet
         supported by all clients.
         
        repeated .envoy.config.cluster.v3.LoadBalancingPolicy.Policy policies = 1;
      • addPolicies

        public LoadBalancingPolicy.Builder addPolicies​(int index,
                                                       LoadBalancingPolicy.Policy.Builder builderForValue)
         Each client will iterate over the list in order and stop at the first policy that it
         supports. This provides a mechanism for starting to use new LB policies that are not yet
         supported by all clients.
         
        repeated .envoy.config.cluster.v3.LoadBalancingPolicy.Policy policies = 1;
      • addAllPolicies

        public LoadBalancingPolicy.Builder addAllPolicies​(java.lang.Iterable<? extends LoadBalancingPolicy.Policy> values)
         Each client will iterate over the list in order and stop at the first policy that it
         supports. This provides a mechanism for starting to use new LB policies that are not yet
         supported by all clients.
         
        repeated .envoy.config.cluster.v3.LoadBalancingPolicy.Policy policies = 1;
      • clearPolicies

        public LoadBalancingPolicy.Builder clearPolicies()
         Each client will iterate over the list in order and stop at the first policy that it
         supports. This provides a mechanism for starting to use new LB policies that are not yet
         supported by all clients.
         
        repeated .envoy.config.cluster.v3.LoadBalancingPolicy.Policy policies = 1;
      • removePolicies

        public LoadBalancingPolicy.Builder removePolicies​(int index)
         Each client will iterate over the list in order and stop at the first policy that it
         supports. This provides a mechanism for starting to use new LB policies that are not yet
         supported by all clients.
         
        repeated .envoy.config.cluster.v3.LoadBalancingPolicy.Policy policies = 1;
      • getPoliciesBuilder

        public LoadBalancingPolicy.Policy.Builder getPoliciesBuilder​(int index)
         Each client will iterate over the list in order and stop at the first policy that it
         supports. This provides a mechanism for starting to use new LB policies that are not yet
         supported by all clients.
         
        repeated .envoy.config.cluster.v3.LoadBalancingPolicy.Policy policies = 1;
      • getPoliciesOrBuilder

        public LoadBalancingPolicy.PolicyOrBuilder getPoliciesOrBuilder​(int index)
         Each client will iterate over the list in order and stop at the first policy that it
         supports. This provides a mechanism for starting to use new LB policies that are not yet
         supported by all clients.
         
        repeated .envoy.config.cluster.v3.LoadBalancingPolicy.Policy policies = 1;
        Specified by:
        getPoliciesOrBuilder in interface LoadBalancingPolicyOrBuilder
      • getPoliciesOrBuilderList

        public java.util.List<? extends LoadBalancingPolicy.PolicyOrBuilder> getPoliciesOrBuilderList()
         Each client will iterate over the list in order and stop at the first policy that it
         supports. This provides a mechanism for starting to use new LB policies that are not yet
         supported by all clients.
         
        repeated .envoy.config.cluster.v3.LoadBalancingPolicy.Policy policies = 1;
        Specified by:
        getPoliciesOrBuilderList in interface LoadBalancingPolicyOrBuilder
      • addPoliciesBuilder

        public LoadBalancingPolicy.Policy.Builder addPoliciesBuilder()
         Each client will iterate over the list in order and stop at the first policy that it
         supports. This provides a mechanism for starting to use new LB policies that are not yet
         supported by all clients.
         
        repeated .envoy.config.cluster.v3.LoadBalancingPolicy.Policy policies = 1;
      • addPoliciesBuilder

        public LoadBalancingPolicy.Policy.Builder addPoliciesBuilder​(int index)
         Each client will iterate over the list in order and stop at the first policy that it
         supports. This provides a mechanism for starting to use new LB policies that are not yet
         supported by all clients.
         
        repeated .envoy.config.cluster.v3.LoadBalancingPolicy.Policy policies = 1;
      • getPoliciesBuilderList

        public java.util.List<LoadBalancingPolicy.Policy.Builder> getPoliciesBuilderList()
         Each client will iterate over the list in order and stop at the first policy that it
         supports. This provides a mechanism for starting to use new LB policies that are not yet
         supported by all clients.
         
        repeated .envoy.config.cluster.v3.LoadBalancingPolicy.Policy policies = 1;