provider

package
v1.5.5 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ID

func ID(host, username string) string

ID generates a unique identifier for a provider based on host and username

Types

type Config

type Config interface {
	ID() string
	GetHost() string
	GetUsername() string
	GetPassword() string
	GetPort() int
	GetMaxConnections() int
	GetMaxConnectionIdleTimeInSeconds() int
	GetMaxConnectionTTLInSeconds() int
	GetTLS() bool
	GetInsecureSSL() bool
	GetIsBackupProvider() bool
}

Config represents the configuration for a single provider

type ConnectionPoolInterface

type ConnectionPoolInterface interface {
	Acquire(ctx interface{}) (interface{}, error)
	AcquireAllIdle() []interface{}
	Close()
	Stat() PoolStats
}

ConnectionPoolInterface represents the underlying connection pool

type Pool

type Pool struct {
	// contains filtered or unexported fields
}

Pool manages a connection pool for a single provider

func NewPool

func NewPool(connectionPool ConnectionPoolInterface, provider Config) *Pool

NewPool creates a new provider pool

func (*Pool) Close

func (pp *Pool) Close()

Close closes the provider pool

func (*Pool) GetConnectionPool

func (pp *Pool) GetConnectionPool() ConnectionPoolInterface

GetConnectionPool returns the underlying connection pool

func (*Pool) GetDrainDuration

func (pp *Pool) GetDrainDuration() time.Duration

GetDrainDuration returns how long the provider has been draining

func (*Pool) GetMigrationID

func (pp *Pool) GetMigrationID() string

GetMigrationID returns the current migration ID

func (*Pool) GetProvider

func (pp *Pool) GetProvider() Config

GetProvider returns the provider configuration

func (*Pool) GetState

func (pp *Pool) GetState() State

GetState returns the current state of the provider pool

func (*Pool) GetStats

func (pp *Pool) GetStats() PoolStats

GetStats returns pool statistics

func (*Pool) IsAcceptingConnections

func (pp *Pool) IsAcceptingConnections() bool

IsAcceptingConnections returns whether the pool is accepting new connections

func (*Pool) SetMigrationID

func (pp *Pool) SetMigrationID(id string)

SetMigrationID sets the migration ID for tracking purposes

func (*Pool) SetState

func (pp *Pool) SetState(state State)

SetState sets the provider pool state

type PoolStats

type PoolStats struct {
	TotalResources    int
	AcquiredResources int
}

PoolStats represents connection pool statistics

type State

type State int

State represents the lifecycle state of a provider during configuration changes

const (
	StateActive    State = iota // Normal operation
	StateDraining               // Accepting no new connections, existing connections finishing
	StateMigrating              // In process of updating configuration
	StateRemoving               // Being removed from pool
)

func (State) String

func (ps State) String() string

Jump to

Keyboard shortcuts

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