postgres

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

Initialize leader election with postgres DB parameters and lock id

func NewWithConn

Initialize leader election with postgres DB connection and lock id. Caller must have connected to postgres and gives us a connection to work with. DB parameters can be skipped in this case. Please note, this DB connection will dedicated for leader election only.

Types

type PostgresLeaderElection

type PostgresLeaderElection struct {
	leaderelection.LeaderElection
	// contains filtered or unexported fields
}

func (*PostgresLeaderElection) AcquireLeadership added in v0.1.5

func (ple *PostgresLeaderElection) AcquireLeadership(ctx context.Context) (bool, error)

func (*PostgresLeaderElection) CheckLeadership added in v0.1.5

func (ple *PostgresLeaderElection) CheckLeadership(ctx context.Context) (bool, error)

func (*PostgresLeaderElection) Close added in v0.1.6

func (ple *PostgresLeaderElection) Close()

Close the election

func (*PostgresLeaderElection) RelinquishLeadership

func (ple *PostgresLeaderElection) RelinquishLeadership(ctx context.Context) (bool, error)

Relinquish leadership. An error will be returned if caller is not the leader.

func (*PostgresLeaderElection) Run

Run the election

type PostgresLeaderElectionConfig

type PostgresLeaderElectionConfig struct {
	Host     string
	Port     uint16
	Secure   string
	User     string
	Password string
	Database string

	leaderelection.LeaderElectionConfig
}

Postgres connection parameters and lock id

Jump to

Keyboard shortcuts

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