Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckTSA ¶
CheckTSA checks if the given shard is in a read-only state. It sends a query to the shard to retrieve the value of the "transaction_read_only" setting. If the query is successful and the value is "off", it means the shard is in a read-write state. If the value is not "off", it means the shard is in a read-only state. The function returns a boolean indicating whether the shard is in a read-write state, a string describing the reason for the state, and an error if any occurred during the process.
Parameters:
- sh: The shard to check the TSA for.
Returns:
- bool: A boolean indicating whether the shard is in a read-write state.
- string: A string describing the reason for the state.
- error: An error if any occurred during the process.
Types ¶
type CacheEntry ¶
type CacheEntry struct {
// contains filtered or unexported fields
}
type CachedTSAChecker ¶
type CachedTSAChecker struct {
// contains filtered or unexported fields
}
func (*CachedTSAChecker) CheckTSA ¶
CheckTSA checks the TSA for a given shard and returns the result, comment, and error. If the TSA check result is already cached and not expired, it returns the cached result. Otherwise, it performs the TSA check and updates the cache with the new result. The function returns a boolean indicating whether the shard is in a read-write state, a string describing the reason for the state, and an error if any occurred during the process.
Parameters:
- sh: The shard to check the TSA for.
Returns:
- bool: A boolean indicating whether the shard is in a read-write state.
- string: A string describing the reason for the state.
- error: An error if any occurred during the process.
type TSAChecker ¶
func NewTSAChecker ¶
func NewTSAChecker() TSAChecker
NewTSAChecker creates a new instance of TSAChecker. It returns a TSAChecker interface that can be used to perform TSA checks.
Returns:
- TSAChecker: A new instance of TSAChecker.
func NewTSACheckerWithDuration ¶
func NewTSACheckerWithDuration(tsaRecheckDuration time.Duration) TSAChecker