Package com.codebarrel.tenant.api.store
Interface TenantStatusStore
public interface TenantStatusStore
-
Method Summary
Modifier and TypeMethodDescriptionbooleanclaimForUpgrade(TenantContext context, String upgradeUUID) Will try to claim the tenant for upgrade.voidThis method clears any upgrades that got stuck.voidfinishTenantUpgrade(TenantContext context, String upgradeUUID) This will clear the upgrade claimant so future upgrades can go ahead.getTenantStatus(TenantContext context) Try to retrieve status for a tenant.saveTenantStatus(TenantContext context, Instant lastRuleExecution, TenantStatusType previousStatus, TenantStatusType newStatus, String connectVersion) Updates the tenant status with the latest status provided.voidsetBuildNumber(TenantContext context, long targetBuildNumber) Update the build number to the latest upgrade task that ran.voidsetTenantStatus(TenantContext context, TenantStatusType status, boolean resetTimesInStatus) Sets the status of a tenant
-
Method Details
-
getTenantStatus
Try to retrieve status for a tenant. May be empty if this is the first status check.- Parameters:
context- the tenant to fetch- Returns:
- tenant status or empty
-
setTenantStatus
Sets the status of a tenant- Parameters:
context- the tenant to savestatus- new status to setresetTimesInStatus- true if the number of times we've been in this status should go back to 1
-
saveTenantStatus
Optional<TenantStatusBean> saveTenantStatus(TenantContext context, Instant lastRuleExecution, TenantStatusType previousStatus, TenantStatusType newStatus, String connectVersion) Updates the tenant status with the latest status provided.- Parameters:
context- the tenant to savelastRuleExecution- last time a rule executedpreviousStatus- old tenant statusnewStatus- current tenant status- Returns:
- the latest status from the DB
-
claimForUpgrade
Will try to claim the tenant for upgrade. If the tenant is already being upgraded/claimed, this will return false.- Parameters:
context- the tenant to upgradeupgradeUUID- unique id for this upgrade- Returns:
- true if the tenant could be claimed for upgrade. False otherwise (no upgrade should be performed).
-
finishTenantUpgrade
This will clear the upgrade claimant so future upgrades can go ahead.- Parameters:
context- the tenant to upgradeupgradeUUID- unique id for this upgrade
-
setBuildNumber
Update the build number to the latest upgrade task that ran. -
clearClaimedUpgrades
This method clears any upgrades that got stuck.
-