Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoPastLease = fmt.Errorf("no past leases found")
Functions ¶
This section is empty.
Types ¶
type LeaseClient ¶
type LeaseClient interface {
// updateLease confirms permissions for a given leader wanting to insert
// data in a given time range.
// returns:
// *haLockState current state of the lock
// error - either a generic error that signifies
// the check couldn't be performed
// or a leaderHasChanged error signifying the leader has changed and HAState
// needs to be updated
UpdateLease(ctx context.Context, cluster, replica string, minTime, maxTime time.Time) (LeaseDBState, error)
// tryChangeLeader tries to set a new leader for a cluster
// returns:
// *haLockState current state of the lock (if try was successful state.leader == newLeader)
// error signifying the call couldn't be made
TryChangeLeader(ctx context.Context, cluster, newLeader string, maxTime time.Time) (LeaseDBState, error)
GetPastLeaseInfo(ctx context.Context, cluster, replica string, start, end time.Time) (LeaseDBState, error)
}
LeaseClient defines an interface for checking and changing leader status
func NewLeaseClient ¶
func NewLeaseClient(dbConn pgxconn.PgxConn) LeaseClient
Click to show internal directories.
Click to hide internal directories.