类 CapacityService
- java.lang.Object
-
- com.alibaba.nacos.config.server.service.capacity.CapacityService
-
@Service public class CapacityService extends java.lang.ObjectCapacity service.- 作者:
- hexu.hxy
-
-
字段概要
字段 修饰符和类型 字段 说明 private ConfigInfoPersistServiceconfigInfoPersistServiceprivate GroupCapacityPersistServicegroupCapacityPersistServiceprivate static intINIT_PAGE_SIZEprivate static org.slf4j.LoggerLOGGERprivate TenantCapacityPersistServicetenantCapacityPersistServiceprivate static java.lang.IntegerZERO
-
构造器概要
构造器 构造器 说明 CapacityService()
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 private voidautoExpansion(java.lang.String group, java.lang.String tenant)Expand capacity automatically.private voidcorrectGroupUsage()Correct the usage of group capacity.voidcorrectGroupUsage(java.lang.String group)private voidcorrectTenantUsage()Correct the usage of group capacity.voidcorrectTenantUsage(java.lang.String tenant)voidcorrectUsage()CapacitygetCapacity(java.lang.String group, java.lang.String tenant)CapacitygetCapacityWithDefault(java.lang.String group, java.lang.String tenant)private intgetDefaultQuota(boolean isTenant)GroupCapacitygetGroupCapacity(java.lang.String group)TenantCapacitygetTenantCapacity(java.lang.String tenant)voidinit()Init.voidinitAllCapacity()private voidinitAllCapacity(boolean isTenant)booleaninitCapacity(java.lang.String group, java.lang.String tenant)Init capacity.booleaninitGroupCapacity(java.lang.String group)Initialize the capacity information of the group.private booleaninitGroupCapacity(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.booleaninitTenantCapacity(java.lang.String tenant)Initialize the capacity information of the tenant.booleaninitTenantCapacity(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.booleaninsertAndUpdateClusterUsage(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.booleaninsertAndUpdateGroupUsage(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.booleaninsertAndUpdateTenantUsage(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.private booleaninsertGroupCapacity(java.lang.String group)private booleaninsertGroupCapacity(java.lang.String group, java.lang.Integer quota, java.lang.Integer maxSize, java.lang.Integer maxAggrCount, java.lang.Integer maxAggrSize)booleaninsertOrUpdateCapacity(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.private booleaninsertTenantCapacity(java.lang.String tenant)private booleaninsertTenantCapacity(java.lang.String tenant, java.lang.Integer quota, java.lang.Integer maxSize, java.lang.Integer maxAggrCount, java.lang.Integer maxAggrSize)booleanupdateClusterUsage(CounterMode counterMode)booleanupdateGroupUsage(CounterMode counterMode, java.lang.String group)private booleanupdateGroupUsage(CounterMode counterMode, java.lang.String group, int defaultQuota, boolean ignoreQuotaLimit)booleanupdateTenantUsage(CounterMode counterMode, java.lang.String tenant)private booleanupdateTenantUsage(CounterMode counterMode, java.lang.String tenant, boolean ignoreQuotaLimit)
-
-
-
字段详细资料
-
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
- 另请参阅:
- 常量字段值
-
groupCapacityPersistService
@Autowired private GroupCapacityPersistService groupCapacityPersistService
-
tenantCapacityPersistService
@Autowired private TenantCapacityPersistService tenantCapacityPersistService
-
configInfoPersistService
@Autowired private ConfigInfoPersistService configInfoPersistService
-
-
方法详细资料
-
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.
-
-