redis

package
v0.8.3-beta.7 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClusterType = "cluster"
	NodeType    = "node"
)

Variables

This section is empty.

Functions

func NewCommands

func NewCommands() engines.ClusterCommands

func NewManager

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

Types

type Commands

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

func (Commands) ConnectCommand

func (r Commands) ConnectCommand(connectInfo *engines.AuthInfo) []string

func (Commands) ConnectExample

func (r Commands) ConnectExample(info *engines.ConnectionInfo, client string) string

func (Commands) Container

func (r Commands) Container() string

func (Commands) ExecuteCommand

func (r Commands) ExecuteCommand(scripts []string) ([]string, []corev1.EnvVar, error)

type Duration

type Duration time.Duration

func (*Duration) DecodeString

func (r *Duration) DecodeString(value string) error

type Manager

type Manager struct {
	engines.DBManagerBase
	// contains filtered or unexported fields
}

func (*Manager) CreateUser

func (mgr *Manager) CreateUser(ctx context.Context, userName, password string) error

func (*Manager) DeleteUser

func (mgr *Manager) DeleteUser(ctx context.Context, userName string) error

func (*Manager) DescribeUser

func (mgr *Manager) DescribeUser(ctx context.Context, userName string) (*models.UserInfo, error)

func (*Manager) Exec

func (mgr *Manager) Exec(ctx context.Context, cmd string) (int64, error)

func (*Manager) GetReplicaRole

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

func (*Manager) GrantUserRole

func (mgr *Manager) GrantUserRole(ctx context.Context, userName, roleName string) error

func (*Manager) IsDBStartupReady

func (mgr *Manager) IsDBStartupReady() bool

func (*Manager) ListSystemAccounts

func (mgr *Manager) ListSystemAccounts(ctx context.Context) ([]models.UserInfo, error)

func (*Manager) ListUsers

func (mgr *Manager) ListUsers(ctx context.Context) ([]models.UserInfo, error)

func (*Manager) Query

func (mgr *Manager) Query(ctx context.Context, cmd string) ([]byte, error)

func (*Manager) RevokeUserRole

func (mgr *Manager) RevokeUserRole(ctx context.Context, userName, roleName string) error

type Metadata

type Metadata struct {
	MaxRetries      int
	MaxRetryBackoff time.Duration
	TTLInSeconds    *int
	QueryIndexes    string
}

func ParseRedisMetadata

func ParseRedisMetadata(properties map[string]string) (Metadata, error)

type Settings

type Settings struct {
	// The Redis host
	Host string `mapstructure:"redisHost"`
	// The Redis password
	Password string `mapstructure:"redisPassword"`
	// The Redis username
	Username string `mapstructure:"redisUsername"`
	// Database to be selected after connecting to the server.
	DB int `mapstructure:"redisDB"`
	// The redis type node or cluster
	RedisType string `mapstructure:"redisType"`
	// Maximum number of retries before giving up.
	// A value of -1 (not 0) disables retries
	// Default is 3 retries
	RedisMaxRetries int `mapstructure:"redisMaxRetries"`
	// Minimum backoff between each retry.
	// Default is 8 milliseconds; -1 disables backoff.
	RedisMinRetryInterval Duration `mapstructure:"redisMinRetryInterval"`
	// Maximum backoff between each retry.
	// Default is 512 milliseconds; -1 disables backoff.
	RedisMaxRetryInterval Duration `mapstructure:"redisMaxRetryInterval"`
	// Dial timeout for establishing new connections.
	DialTimeout Duration `mapstructure:"dialTimeout"`
	// Timeout for socket reads. If reached, commands will fail
	// with a timeout instead of blocking. Use value -1 for no timeout and 0 for default.
	ReadTimeout Duration `mapstructure:"readTimeout"`
	// Timeout for socket writes. If reached, commands will fail
	WriteTimeout Duration `mapstructure:"writeTimeout"`
	// Maximum number of socket connections.
	PoolSize int `mapstructure:"poolSize"`
	// Minimum number of idle connections which is useful when establishing
	// new connection is slow.
	MinIdleConns int `mapstructure:"minIdleConns"`
	// Connection age at which client retires (closes) the connection.
	// Default is to not close aged connections.
	MaxConnAge Duration `mapstructure:"maxConnAge"`
	// Amount of time client waits for connection if all connections
	// are busy before returning an error.
	// Default is ReadTimeout + 1 second.
	PoolTimeout Duration `mapstructure:"poolTimeout"`
	// Amount of time after which client closes idle connections.
	// Should be less than server's timeout.
	// Default is 5 minutes. -1 disables idle timeout check.
	IdleTimeout Duration `mapstructure:"idleTimeout"`
	// Frequency of idle checks made by idle connections reaper.
	// Default is 1 minute. -1 disables idle connections reaper,
	// but idle connections are still discarded by the client
	// if IdleTimeout is set.
	IdleCheckFrequency Duration `mapstructure:"idleCheckFrequency"`
	// The master name
	SentinelMasterName string `mapstructure:"sentinelMasterName"`
	// Use Redis Sentinel for automatic failover.
	Failover bool `mapstructure:"failover"`

	// A flag to enables TLS by setting InsecureSkipVerify to true
	EnableTLS bool `mapstructure:"enableTLS"`
}

func ParseClientFromProperties

func ParseClientFromProperties(properties map[string]string, defaultSettings *Settings) (client redis.UniversalClient, settings *Settings, err error)

func (*Settings) Decode

func (s *Settings) Decode(in interface{}) error

Jump to

Keyboard shortcuts

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