tsa

package
v0.0.0-...-2989f55 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2024 License: PostgreSQL Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckTSA

func CheckTSA(sh shard.Shard) (bool, string, error)

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

func (ctsa *CachedTSAChecker) CheckTSA(sh shard.Shard) (bool, string, error)

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

type TSAChecker interface {
	CheckTSA(sh shard.Shard) (bool, string, error)
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL