metrictank: Index | Files

package cassandra

import ""


Package Files

cassandra_session.go metrics.go util.go

func EnsureTableExists Uses

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

type ErrMetrics Uses

type ErrMetrics struct {
    // contains filtered or unexported fields

func NewErrMetrics Uses

func NewErrMetrics(component string) ErrMetrics

func (*ErrMetrics) Inc Uses

func (m *ErrMetrics) Inc(err error)

type Session Uses

type Session struct {
    // contains filtered or unexported fields

Session stores a connection to Cassandra along with associated configurations

func NewSession Uses

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 Uses

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 Uses

func (s *Session) Stop()

Package cassandra imports 7 packages (graph) and is imported by 8 packages. Updated 2020-03-28. Refresh now. Tools for package owners.