类 CapacityService


  • @Service
    public class CapacityService
    extends java.lang.Object
    Capacity service.
    作者:
    hexu.hxy
    • 字段详细资料

      • LOGGER

        private static final org.slf4j.Logger LOGGER
      • ZERO

        private static final java.lang.Integer ZERO
      • INIT_PAGE_SIZE

        private static final int INIT_PAGE_SIZE
        另请参阅:
        常量字段值
    • 构造器详细资料

      • CapacityService

        public CapacityService()
    • 方法详细资料

      • init

        @PostConstruct
        public void init()
        Init.
      • correctUsage

        public void correctUsage()
      • correctGroupUsage

        private void correctGroupUsage()
        Correct the usage of group capacity.
      • correctGroupUsage

        public void correctGroupUsage​(java.lang.String group)
      • correctTenantUsage

        public void correctTenantUsage​(java.lang.String tenant)
      • correctTenantUsage

        private void correctTenantUsage()
        Correct the usage of group capacity.
      • initAllCapacity

        public void initAllCapacity()
      • initAllCapacity

        private void initAllCapacity​(boolean isTenant)
      • insertAndUpdateClusterUsage

        public boolean insertAndUpdateClusterUsage​(CounterMode counterMode,
                                                   boolean ignoreQuotaLimit)
        To Cluster. 1.If the capacity information does not exist, initialize the capacity information. 2.Update capacity usage, plus or minus one.
        参数:
        counterMode - increase or decrease mode.
        ignoreQuotaLimit - ignoreQuotaLimit flag.
        返回:
        the result of update cluster usage.
      • updateClusterUsage

        public boolean updateClusterUsage​(CounterMode counterMode)
      • insertAndUpdateGroupUsage

        public boolean insertAndUpdateGroupUsage​(CounterMode counterMode,
                                                 java.lang.String group,
                                                 boolean ignoreQuotaLimit)
        It is used for counting when the limit check function of capacity management is turned off. 1.If the capacity information does not exist, initialize the capacity information. 2.Update capacity usage, plus or minus one.
        参数:
        counterMode - increase or decrease mode.
        group - tenant string value.
        ignoreQuotaLimit - ignoreQuotaLimit flag.
        返回:
        operate successfully or not.
      • updateGroupUsage

        public boolean updateGroupUsage​(CounterMode counterMode,
                                        java.lang.String group)
      • updateGroupUsage

        private boolean updateGroupUsage​(CounterMode counterMode,
                                         java.lang.String group,
                                         int defaultQuota,
                                         boolean ignoreQuotaLimit)
      • getGroupCapacity

        public GroupCapacity getGroupCapacity​(java.lang.String group)
      • initGroupCapacity

        public boolean initGroupCapacity​(java.lang.String group)
        Initialize the capacity information of the group. If the quota is reached, the capacity will be automatically expanded to reduce the operation and maintenance cost.
        参数:
        group - group string value.
        返回:
        init result.
      • initGroupCapacity

        private boolean initGroupCapacity​(java.lang.String group,
                                          java.lang.Integer quota,
                                          java.lang.Integer maxSize,
                                          java.lang.Integer maxAggrCount,
                                          java.lang.Integer maxAggrSize)
        Initialize the capacity information of the group. If the quota is reached, the capacity will be automatically expanded to reduce the operation and maintenance cost.
        参数:
        group - group string value.
        quota - quota int value.
        maxSize - maxSize int value.
        maxAggrCount - maxAggrCount int value.
        maxAggrSize - maxAggrSize int value.
        返回:
        init result.
      • autoExpansion

        private void autoExpansion​(java.lang.String group,
                                   java.lang.String tenant)
        Expand capacity automatically.
        参数:
        group - group string value.
        tenant - tenant string value.
      • getDefaultQuota

        private int getDefaultQuota​(boolean isTenant)
      • getCapacity

        public Capacity getCapacity​(java.lang.String group,
                                    java.lang.String tenant)
      • getCapacityWithDefault

        public Capacity getCapacityWithDefault​(java.lang.String group,
                                               java.lang.String tenant)
      • initCapacity

        public boolean initCapacity​(java.lang.String group,
                                    java.lang.String tenant)
        Init capacity.
        参数:
        group - group string value.
        tenant - tenant string value.
        返回:
        init result.
      • insertGroupCapacity

        private boolean insertGroupCapacity​(java.lang.String group)
      • insertGroupCapacity

        private boolean insertGroupCapacity​(java.lang.String group,
                                            java.lang.Integer quota,
                                            java.lang.Integer maxSize,
                                            java.lang.Integer maxAggrCount,
                                            java.lang.Integer maxAggrSize)
      • insertAndUpdateTenantUsage

        public boolean insertAndUpdateTenantUsage​(CounterMode counterMode,
                                                  java.lang.String tenant,
                                                  boolean ignoreQuotaLimit)
        It is used for counting when the limit check function of capacity management is turned off. 1.If the capacity information does not exist, initialize the capacity information. 2.Update capacity usage, plus or minus one.
        参数:
        counterMode - increase or decrease mode.
        tenant - tenant string value.
        ignoreQuotaLimit - ignoreQuotaLimit flag.
        返回:
        operate successfully or not.
      • updateTenantUsage

        private boolean updateTenantUsage​(CounterMode counterMode,
                                          java.lang.String tenant,
                                          boolean ignoreQuotaLimit)
      • updateTenantUsage

        public boolean updateTenantUsage​(CounterMode counterMode,
                                         java.lang.String tenant)
      • initTenantCapacity

        public boolean initTenantCapacity​(java.lang.String tenant)
        Initialize the capacity information of the tenant. If the quota is reached, the capacity will be automatically expanded to reduce the operation and maintenance cos.
        参数:
        tenant - tenant string value.
        返回:
        init result.
      • initTenantCapacity

        public boolean initTenantCapacity​(java.lang.String tenant,
                                          java.lang.Integer quota,
                                          java.lang.Integer maxSize,
                                          java.lang.Integer maxAggrCount,
                                          java.lang.Integer maxAggrSize)
        Initialize the capacity information of the tenant. If the quota is reached, the capacity will be automatically expanded to reduce the operation and maintenance cost
        参数:
        tenant - tenant string value.
        quota - quota int value.
        maxSize - maxSize int value.
        maxAggrCount - maxAggrCount int value.
        maxAggrSize - maxAggrSize int value.
        返回:
      • insertTenantCapacity

        private boolean insertTenantCapacity​(java.lang.String tenant)
      • insertTenantCapacity

        private boolean insertTenantCapacity​(java.lang.String tenant,
                                             java.lang.Integer quota,
                                             java.lang.Integer maxSize,
                                             java.lang.Integer maxAggrCount,
                                             java.lang.Integer maxAggrSize)
      • getTenantCapacity

        public TenantCapacity getTenantCapacity​(java.lang.String tenant)
      • insertOrUpdateCapacity

        public boolean insertOrUpdateCapacity​(java.lang.String group,
                                              java.lang.String tenant,
                                              java.lang.Integer quota,
                                              java.lang.Integer maxSize,
                                              java.lang.Integer maxAggrCount,
                                              java.lang.Integer maxAggrSize)
        Support for API interface, Tenant: initialize if the record does not exist, and update the capacity quota or content size directly if it exists.
        参数:
        group - group string value.
        tenant - tenant string value.
        quota - quota int value.
        maxSize - maxSize int value.
        maxAggrCount - maxAggrCount int value.
        maxAggrSize - maxAggrSize int value.
        返回:
        operate successfully or not.