cassandra

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2020 License: AGPL-3.0 Imports: 7 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureTableExists added in v1.0.0

func EnsureTableExists(session *gocql.Session, createKeyspace bool, keyspace, schema, table string) error

EnsureTableExists checks if the specified table exists or not. If it does not exist and the create-keyspace flag is true, then it will create it, if it doesn't exist and the create-keyspace flag is false then it will retry 5 times with a 5s sleep before each retry. If at the end of the 5 retries the table still doesn't exist it returns an error. If the table already exists it returns nil. session: cassandra session createKeyspace: whether non-existent tables shall be created keyspace: name of the keyspace schema: table schema as a string table: name of the table in cassandra

Types

type ErrMetrics

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

func NewErrMetrics

func NewErrMetrics(component string) ErrMetrics

func (*ErrMetrics) Inc

func (m *ErrMetrics) Inc(err error)

type Session added in v1.0.0

type Session struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Session stores a connection to Cassandra along with associated configurations

func NewSession added in v1.0.0

func NewSession(clusterConfig *gocql.ClusterConfig,
	timeout time.Duration,
	interval time.Duration,
	addrs string,
	logPrefix string) (*Session, error)

NewSession creates and returns a Session. Upon failure it will return nil and an error.

func (*Session) CurrentSession added in v1.0.0

func (s *Session) CurrentSession() *gocql.Session

CurrentSession retrieves the current active Cassandra session

If the connection to Cassandra is down, this will block until it can be restored

func (*Session) Stop added in v1.0.0

func (s *Session) Stop()

Jump to

Keyboard shortcuts

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