wesql

package
v0.9.1-beta.2 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Role          = "ROLE"
	CurrentLeader = "CURRENT_LEADER"
	Leader        = "Leader"
)

Variables

This section is empty.

Functions

func NewManager

func NewManager(properties engines.Properties) (engines.DBManager, error)

Types

type Config

type Config struct {
	*mysql.Config
}

func NewConfig

func NewConfig(properties map[string]string) (*Config, error)

type Manager

type Manager struct {
	mysql.Manager
}

func (*Manager) Demote

func (mgr *Manager) Demote(context.Context) error

func (*Manager) Follow

func (mgr *Manager) Follow(_ context.Context, cluster *dcs.Cluster) error

func (*Manager) GetAddrWithMemberName

func (mgr *Manager) GetAddrWithMemberName(ctx context.Context, cluster *dcs.Cluster, memberName string) string

func (*Manager) GetClusterInfo

func (mgr *Manager) GetClusterInfo(ctx context.Context, cluster *dcs.Cluster) string

func (*Manager) GetClusterLocalInfo

func (mgr *Manager) GetClusterLocalInfo() (mysql.RowMap, error)

func (*Manager) GetDBConnWithMember

func (mgr *Manager) GetDBConnWithMember(cluster *dcs.Cluster, member *dcs.Member) (db *sql.DB, err error)

GetDBConnWithMember retrieves a database connection for a specific member of a cluster.

func (*Manager) GetHealthiestMember

func (mgr *Manager) GetHealthiestMember(*dcs.Cluster, string) *dcs.Member

func (*Manager) GetLeaderConn

func (mgr *Manager) GetLeaderConn(cluster *dcs.Cluster) (*sql.DB, error)

GetLeaderConn retrieves a database connection to the leader member of a cluster.

func (*Manager) GetLeaderMember

func (mgr *Manager) GetLeaderMember(cluster *dcs.Cluster) *dcs.Member

GetLeaderMember retrieves the leader member of a cluster

func (*Manager) GetMemberAddrs

func (mgr *Manager) GetMemberAddrs(ctx context.Context, cluster *dcs.Cluster) []string

func (*Manager) GetReplicaRole

func (mgr *Manager) GetReplicaRole(ctx context.Context, _ *dcs.Cluster) (string, error)

func (*Manager) HasOtherHealthyLeader

func (mgr *Manager) HasOtherHealthyLeader(_ context.Context, cluster *dcs.Cluster) *dcs.Member

func (*Manager) HasOtherHealthyMembers

func (mgr *Manager) HasOtherHealthyMembers(ctx context.Context, cluster *dcs.Cluster, leader string) []*dcs.Member

HasOtherHealthyMembers checks if there are any healthy members, excluding the leader

func (*Manager) InitializeCluster

func (mgr *Manager) InitializeCluster(context.Context, *dcs.Cluster) error

func (*Manager) InitiateCluster

func (mgr *Manager) InitiateCluster(_ *dcs.Cluster) error

func (*Manager) IsClusterHealthy

func (mgr *Manager) IsClusterHealthy(_ context.Context, cluster *dcs.Cluster) bool

func (*Manager) IsClusterInitialized

func (mgr *Manager) IsClusterInitialized(ctx context.Context, _ *dcs.Cluster) (bool, error)

IsClusterInitialized is a method to check if cluster is initialized or not

func (*Manager) IsCurrentMemberInCluster

func (mgr *Manager) IsCurrentMemberInCluster(ctx context.Context, cluster *dcs.Cluster) bool

func (*Manager) IsLeader

func (mgr *Manager) IsLeader(ctx context.Context, cluster *dcs.Cluster) (bool, error)

func (*Manager) IsLeaderMember

func (mgr *Manager) IsLeaderMember(_ context.Context, cluster *dcs.Cluster, member *dcs.Member) (bool, error)

func (*Manager) IsMemberLagging

func (mgr *Manager) IsMemberLagging(context.Context, *dcs.Cluster, *dcs.Member) (bool, int64)

func (*Manager) IsPromoted

func (mgr *Manager) IsPromoted(ctx context.Context) bool

func (*Manager) JoinCurrentMemberToCluster

func (mgr *Manager) JoinCurrentMemberToCluster(context.Context, *dcs.Cluster) error

func (*Manager) LeaveMemberFromCluster

func (mgr *Manager) LeaveMemberFromCluster(ctx context.Context, cluster *dcs.Cluster, memberName string) error

func (*Manager) Promote

func (mgr *Manager) Promote(ctx context.Context, cluster *dcs.Cluster) error

func (*Manager) Recover

func (mgr *Manager) Recover(context.Context, *dcs.Cluster) error

Jump to

Keyboard shortcuts

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