config

package
v1.46.0-tgt.2 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authenticator

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

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

type BasicAuthenticator

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       `validate:"nonzero" mapstructure:"servers"`
	Keyspace             string         `validate:"nonzero" mapstructure:"keyspace"`
	LocalDC              string         `yaml:"local_dc" mapstructure:"local_dc"`
	ConnectionsPerHost   int            `validate:"min=1" yaml:"connections_per_host" mapstructure:"connections_per_host"`
	Timeout              time.Duration  `validate:"min=500" mapstructure:"-"`
	ConnectTimeout       time.Duration  `yaml:"connect_timeout" mapstructure:"connection_timeout"`
	ReconnectInterval    time.Duration  `validate:"min=500" yaml:"reconnect_interval" mapstructure:"reconnect_interval"`
	SocketKeepAlive      time.Duration  `validate:"min=0" yaml:"socket_keep_alive" mapstructure:"socket_keep_alive"`
	MaxRetryAttempts     int            `validate:"min=0" yaml:"max_retry_attempt" mapstructure:"max_retry_attempts"`
	ProtoVersion         int            `yaml:"proto_version" mapstructure:"proto_version"`
	Consistency          string         `yaml:"consistency" mapstructure:"consistency"`
	DisableCompression   bool           `yaml:"disable-compression" mapstructure:"disable_compression"`
	Port                 int            `yaml:"port" mapstructure:"port"`
	Authenticator        Authenticator  `yaml:"authenticator" mapstructure:",squash"`
	DisableAutoDiscovery bool           `yaml:"disable_auto_discovery" 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) 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

type SessionBuilder

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