config

package
v1.56.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 8 Imported by: 68

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authenticator added in v0.6.0

type Authenticator struct {
	Basic BasicAuthenticator `yaml:"basic" mapstructure:",squash"`
}

Authenticator holds the authentication properties needed to connect to a Cassandra cluster

type BasicAuthenticator added in v0.6.0

type BasicAuthenticator struct {
	Username string `yaml:"username" mapstructure:"username"`
	Password string `yaml:"password" mapstructure:"password" json:"-"`
}

BasicAuthenticator holds the username and password for a password authenticator for a Cassandra cluster

type Configuration

type Configuration struct {
	Servers              []string       `valid:"required,url" mapstructure:"servers"`
	Keyspace             string         `valid:"nonzero" mapstructure:"keyspace"`
	LocalDC              string         `mapstructure:"local_dc"`
	ConnectionsPerHost   int            `valid:"min=1" mapstructure:"connections_per_host"`
	Timeout              time.Duration  `valid:"min=500" mapstructure:"-"`
	ConnectTimeout       time.Duration  `mapstructure:"connection_timeout"`
	ReconnectInterval    time.Duration  `valid:"min=500" mapstructure:"reconnect_interval"`
	SocketKeepAlive      time.Duration  `valid:"min=0" mapstructure:"socket_keep_alive"`
	MaxRetryAttempts     int            `valid:"min=0" mapstructure:"max_retry_attempts"`
	ProtoVersion         int            `mapstructure:"proto_version"`
	Consistency          string         `mapstructure:"consistency"`
	DisableCompression   bool           `mapstructure:"disable_compression"`
	Port                 int            `mapstructure:"port"`
	Authenticator        Authenticator  `mapstructure:",squash"`
	DisableAutoDiscovery bool           `mapstructure:"-"`
	TLS                  tlscfg.Options `mapstructure:"tls"`
}

Configuration describes the configuration properties needed to connect to a Cassandra cluster

func (*Configuration) ApplyDefaults

func (c *Configuration) ApplyDefaults(source *Configuration)

ApplyDefaults copies settings from source unless its own value is non-zero.

func (*Configuration) Close added in v1.47.0

func (c *Configuration) Close() error

func (*Configuration) NewCluster

func (c *Configuration) NewCluster(logger *zap.Logger) (*gocql.ClusterConfig, error)

NewCluster creates a new gocql cluster from the configuration

func (*Configuration) NewSession

func (c *Configuration) NewSession(logger *zap.Logger) (cassandra.Session, error)

NewSession creates a new Cassandra session

func (*Configuration) String

func (c *Configuration) String() string

func (*Configuration) Validate added in v1.56.0

func (c *Configuration) Validate() error

type SessionBuilder added in v0.6.0

type SessionBuilder interface {
	NewSession(logger *zap.Logger) (cassandra.Session, error)
}

SessionBuilder creates new cassandra.Session

Jump to

Keyboard shortcuts

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