cassandra

package
v4.2.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchObserver

type BatchObserver struct {
	MetricsReporter middleware.MetricsReporter
	// contains filtered or unexported fields
}

BatchObserver implements gocql.BatchObserver

func (*BatchObserver) ObserveBatch

func (o *BatchObserver) ObserveBatch(ctx context.Context, b gocql.ObservedBatch)

ObserveBatch sends timing metrics to dogstatsd on every batch query

type DataStore

type DataStore interface {
	SelectMessagesInBucket(
		ctx context.Context,
		topic string,
		bucket, limit int,
	) []*models.Message

	InsertWithTTL(
		ctx context.Context,
		topic, payload string,
		bucket int,
		ttl ...time.Duration,
	) error
}

DataStore is the interface with data access methods

func GetCassandra

func GetCassandra(
	logger *logging.Logger,
	config *viper.Viper,
	mr middleware.MetricsReporter,
) (DataStore, error)

GetCassandra connects on Cassandra and returns the client with a session

type QueryObserver

type QueryObserver struct {
	MetricsReporter middleware.MetricsReporter
	// contains filtered or unexported fields
}

QueryObserver implements gocql.QueryObserver

func (*QueryObserver) ObserveQuery

func (o *QueryObserver) ObserveQuery(ctx context.Context, q gocql.ObservedQuery)

ObserveQuery sends timing metrics to dogstatsd on every query

type Store

type Store struct {
	DBSession cassandrainterfaces.Session
	// contains filtered or unexported fields
}

Store is the access layer and contains the cassandra session. Implements DataStore

func (*Store) InsertWithTTL

func (s *Store) InsertWithTTL(
	ctx context.Context,
	topic, payload string,
	bucket int,
	ttl ...time.Duration,
) error

InsertWithTTL inserts a message on cassandra. Currently used only on tests.

func (*Store) SelectMessagesInBucket

func (s *Store) SelectMessagesInBucket(
	ctx context.Context,
	topic string,
	bucket, limit int,
) []*models.Message

SelectMessagesInBucket gets at most limit messages on topic and bucket from Cassandra.

Jump to

Keyboard shortcuts

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