Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
    /**
     * Represents the default name for an entity, i.e. the entity that's matched
     * when an exact match isn't found.
     */
    public final static String QUOTA_ENTITY_DEFAULT = // implementation defined

    /**
     * Describes an entity type.
     */
    public enum QuotaEntityQuotaEntityType {
        USER,        // The user principal.
        CLIENT_ID,   // The client ID.

        // Note others may be added in the future.
    }

    //**
 EXPOSITION ONLY
   * The quota types. //
     *//
 Describes a fully-qualified publicentity. enumThe QuotaTypekey {
is a QuotaEntityType string, however there
   CONSUMER_BYTE_RATE,
        PRODUCER_BYTE_RATE, // may also exist keys that are not enumerated by QuotaEntityType that still apply, e.g. the
    // server may internally associate another entity type.
    public class QuotaEntity extends Map<String, String> {}

    /**
     * The quota types.
     */
    public enum QuotaType {
        CONSUMER_BYTE_RATE,
        PRODUCER_BYTE_RATE,
        REQUEST_PERCENTAGE,

        // Note others may be added in the future.
    }

    /**
     * The units for a quota value. Note there may be multiple units for a given quota type
     * that influences quota behavior.
     */
    public enum QuotaUnits {
        RATE_BPS,

        // Note others may be added in the future, e.g. RATE_BPS_PER_BROKER, SHARES.
    }

    public class QuotaFilter {
       public enum Rule {
         EXACT,    // exact name match
         NOT,      // matches all non-matching names
         PREFIX,   // matches all names with the given prefix

         // Note others may be added in the future.
       }

       /**
        * A filtering rule to be applied.
        *
        * @param entity the entity the rule applies to
        * @param rule the rule to apply
        * @param match the non-null string that's applied by the rule
        */
       public QuotaFilter(QuotaEntity entity, Rule rule, String match);

       public QuotaEntity entity();
       public Rule rule();
       public String match();
    }

    public class DescribeQuotasOptions {
        // Default.
    }

    public class DescribeQuotasResult {
        /**
         * Maps an entity to its configured quota value(s). Note if no value is defined for a quota
         * type for that entity's config, then it is not included in the resulting value map.
        REQUEST_PERCENTAGE,

 *
         * //@return Notethe otherscollection mayof beentities addedthat inmatched the future. filter
         */
    }

    public class QuotaFilter {KafkaFuture<Map<Map<String, String>, Map<QuotaType, Double>>> entities();
    }

    public interface Admin enumextends RuleAutoCloseable {
         EXACT, /**
    // exact name match
   * Describes all entities matching all NOT,provided filters (logical AND) that have //at matchesleast allone
 non-matching names
       * quota PREFIX,value defined.
  // matches all names with the given prefix*

         * //@param Notefilters othersfiltering mayrules beto addedapply into thematching future.entities
       }

  * @param options the options to /**use
         * A@return filteringresult rulecontaining toall bematching applied.entities
         */
        *DescribeQuotasResult @param entity the entity the rule applies to
describeQuotas(Collection<QuotaFilter> filters, DescribeQuotasOptions options);
    }


Code Block
    public class   * @param rule the rule to apply
DescribeEffectiveQuotasOptions {
        // Whether to include the *list @paramof matchoverridden thevalues non-nullfor stringevery that'squota appliedtype byin the ruleresult.
        *//
       public QuotaFilter(QuotaEntity entity, Rule rule, String match);
 // Default: false.
       public QuotaEntityDescribeQuotasOptions entitysetOmitOverriddenValues(boolean omitOverriddenValues);
    }

    public class Rule rule();DescribeEffectiveQuotasResult {
       public /**
 String match();
    }

   * publicDescribes classa DescribeQuotasOptionsquota {key.
         *// Default.
    }

     public class DescribeQuotasResultKey {
        /**
         * Maps an entity to its configured quota value(s). Note if no value is defined for a quota/**
             * @param type the quota type
         * type for that entity's config, then* it@param isunits notthe includedunits infor the resultingquota valuetype
 map.
         *
   */
      * @return the collection of entitiespublic that matched the filter
Key(QuotaType type, QuotaUnits units);

          */
 public QuotaType type();
     KafkaFuture<Map<Map<QuotaEntity, String>, Map<QuotaType, Double>>> entities();
  public  }
QuotaUnits units();
    public interface Admin extends AutoCloseable {}

        /**
         * Information about Describesa allspecific entitiesquota matchingconfiguration allentry.
 provided filters (logical AND) that have at least one*/
        public class Entry *{
 quota value defined.
         /**
             * @param filters filtering rules to apply to matching entities
source the entity source for the value
             * @param optionsvalue the options to use
 non-null value
             */
      @return result containing all matching entities
 public Entry(Map<String, String> source, Double value);

   */
        DescribeQuotasResult describeQuotas(Collection<QuotaFilter>public filtersMap<String, DescribeQuotasOptionsString> optionssource();
    }
Code Block
    public class DescribeEffectiveQuotasOptions {
     public Double value();
 // Whether to include the list of overridden}

 values for every quota type in the result./**
        //
 * Information about the value for a // Default: falsequota type.
        DescribeQuotasOptions setOmitOverriddenValues(boolean omitOverriddenValues); */
    }

    public class DescribeEffectiveQuotasResultValue {
            /**
         * Information about a specific quota configuration value.
    * @param entry the quota */entry
        public   class Value {
* @param overriddenEntries all values that are overridden due to being lower /**in
             *    @param source the entity source for the value
             * @param valuespecificity, theor non-null if valuenot requested
             */
            public Value(Map<QuotaEntity, String> sourceEntry entry, DoubleList<Entry> valueoverriddenEntries);

            public Map<QuotaEntity, String> sourceEntry entry();
            public DoubleList<Entry> valueoverriddenEntries();
        }

        /**
         * InformationMaps abouta thequota valuetype forto aits quota typeconfiguration.
         *//
        public KafkaFuture<Map<Key, Value>> config();
    }

    public interface Admin classextends EntryAutoCloseable {
            /**
         * Describes the effective *quotas @param valuefor the activeprovided quotaentities.
 value
        *
     * @param overriddenValues all values* that@param areentities overriddenthe dueentities to describe beingthe lowereffective inquotas specificity,for
         * @param options the options *to use
        or null* if@return notthe requested
effective quotas for the entities
         */
            public Entry(Value value, List<Value> overriddenValues);

     DescribeEffectiveQuotasResult describeEffectiveQuotas(Collection<Map<String, String>> entities,
       public Value value();
            public List<Value> overriddenValues();
        }

        /**
         * Maps a quota type to its configuration entry.
        DescribeEffectiveQuotasOptions */options);
    }


Code Block
    public KafkaFuture<Map<QuotaType,class Entry>> config();AlterQuotasEntry {
    }

    public interface Admin extends AutoCloseable {
 class Op {
            /**
             * @param Describestype the quota effective quotas for the provided entities.
type to alter
             *
      @param units the units for the quota type
    *    @param entities the entities to describe* the@param effectivevalue quotasif for
set then the existing value is updated,
   * @param options the options to use
    *     * @return the effective quotas for the entities
  otherwise if null, the existing value is */cleared
        DescribeEffectiveQuotasResult describeEffectiveQuotas(Collection<QuotaEntity> entities,
   */
            public Op(QuotaType type, QuotaUnits units, Double value);

            public QuotaType type();
            public QuotaUnits units();
            public DescribeEffectiveQuotasOptionsDouble optionsvalue();
    }
Code Block
    public class AlterQuotasEntry {}

        /**
         * @param entity the entity whose config will be modified
         * @param ops the alteration to perform - if value is set, then the existing value is updated,
         *            otherwise if null, the existing value is cleared
         */
        public AlterQuotasEntry(Map<QuotaEntityMap<String, String> entity, Map<QuotaType, Double>Collection<Op> ops);

        public Map<QuotaEntityMap<String, String> entity();
        public Map<QuotaType, Double>Collection<Ops> ops();
    }

    public class AlterQuotasOptions {
        // Default.
    }

    public class AlterQuotasResult {
        /**
         * @return map of a quota entity update to its future
         */
        public Map<Map<QuotaEntity, String>, KafkaFuture<Void>> futures();
    }

    public interface Admin extends AutoCloseable {
        /**
         * Alters the quotas as specified for the entries.
         *
         * @param alterations the alterations to perform
         * @return the result of the alterations
         */
        AlterQuotasResult alterQuotas(Collection<AlterQuotasEntry> entries, AlterQuotasOptions options);
    }


Proposed Changes

TODO: Wire protocol.

TODO: ConfigCommand changes.

Compatibility, Deprecation, and Migration Plan

...