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: 21 Imported by: 40

Documentation

Index

Constants

View Source
const Month_sec = 60 * 60 * 24 * 28
View Source
const QueryFmtRead = "SELECT ts, data FROM %s WHERE key IN ? AND ts >= ? AND ts < ?"
View Source
const QueryFmtWrite = "INSERT INTO %s (key, ts, data) values(?,?,?) USING TTL ?"
View Source
const Table_name_format = `metric_%d`

Variables

View Source
var CliConfig = NewStoreConfig()

Functions

func ConfigSetup

func ConfigSetup() *flag.FlagSet

func ConvertTimeout

func ConvertTimeout(timeout string, defaultUnit time.Duration) time.Duration

ConvertTimeout provides backwards compatibility for values that used to be specified as integers, while also allowing them to be specified as durations.

func IsStoreTable added in v0.13.0

func IsStoreTable(name string) bool

Types

type CassandraStore

type CassandraStore struct {
	Session *cassandra.Session

	TTLTables TTLTables
	// contains filtered or unexported fields
}

func NewCassandraStore

func NewCassandraStore(config *StoreConfig, ttls []uint32, schemaMaxChunkSpan uint32) (*CassandraStore, error)

NewCassandraStore creates a new cassandra store, using the provided retention ttl's in seconds

func (*CassandraStore) Add

func (c *CassandraStore) Add(cwr *mdata.ChunkWriteRequest)

func (*CassandraStore) FindExistingTables

func (c *CassandraStore) FindExistingTables(keyspace string) error

FindExistingTables set's the store's table definitions to what it can find in the database. WARNING:

  • does not set the windowSize property, because we don't know what the windowFactor was we could actually figure it based on the table definition, assuming the schema isn't tampered with, but there is no use case for this so we haven't implemented this.
  • each table covers a range of TTL's. we set the TTL to the lower limit so remember the TTL might have been up to twice as much

func (*CassandraStore) Search

func (c *CassandraStore) Search(ctx context.Context, key schema.AMKey, ttl, start, end uint32) ([]chunk.IterGen, error)

Basic search of cassandra in the table for given ttl start inclusive, end exclusive

func (*CassandraStore) SearchTable

func (c *CassandraStore) SearchTable(ctx context.Context, key schema.AMKey, table Table, start, end uint32) ([]chunk.IterGen, error)

Basic search of cassandra in given table start inclusive, end exclusive

func (*CassandraStore) SetTracer

func (c *CassandraStore) SetTracer(t opentracing.Tracer)

func (*CassandraStore) Stop

func (c *CassandraStore) Stop()

type ChunkReadRequest

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

type StoreConfig

type StoreConfig struct {
	Enabled                  bool
	Addrs                    string
	Keyspace                 string
	Consistency              string
	HostSelectionPolicy      string
	Timeout                  string
	ReadConcurrency          int
	WriteConcurrency         int
	ReadQueueSize            int
	WriteQueueSize           int
	Retries                  int
	WindowFactor             int
	OmitReadTimeout          string
	CqlProtocolVersion       int
	CreateKeyspace           bool
	DisableInitialHostLookup bool
	SSL                      bool
	CaPath                   string
	HostVerification         bool
	Auth                     bool
	Username                 string
	Password                 string
	SchemaFile               string
	ConnectionCheckInterval  time.Duration
	ConnectionCheckTimeout   time.Duration
	MaxChunkSpan             time.Duration
}

func NewStoreConfig

func NewStoreConfig() *StoreConfig

return StoreConfig with default values set.

func (*StoreConfig) Validate added in v1.0.0

func (cfg *StoreConfig) Validate(schemaMaxChunkSpan uint32) error

Validate makes sure the StoreConfig settings are valid

type TTLTables

type TTLTables map[uint32]Table

TTLTables stores table definitions keyed by their TTL

func GetTTLTables

func GetTTLTables(ttls []uint32, windowFactor int, nameFormat string) TTLTables

GetTTLTables returns table definitions for the given specifications (ttls is in seconds)

type Table

type Table struct {
	Name       string
	QueryRead  string
	QueryWrite string
	WindowSize uint32
	TTL        uint32
}

func GetTable

func GetTable(ttl uint32, windowFactor int, nameFormat string) Table

Jump to

Keyboard shortcuts

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