cassandra

package
v4.3.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2016 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package dal is the Data Access Layer between the Application and PostgreSQL database.

Index

Constants

This section is empty.

Variables

View Source
var PROJECT_EPOCH = 1451606400

Functions

This section is empty.

Types

type Base

type Base struct {
	AppContext context.Context
	// contains filtered or unexported fields
}

func (*Base) NewExplicitID

func (b *Base) NewExplicitID() int64

NewExplicitID uses UNIX timestamp in microseconds as ID.

type TSEvent

type TSEvent struct {
	Base
}

func NewTSEvent

func NewTSEvent(ctx context.Context) *TSEvent

func (*TSEvent) AllBandsByClusterIDAndCreatedFromRangeForHighchart

func (ts *TSEvent) AllBandsByClusterIDAndCreatedFromRangeForHighchart(clusterID, from, to int64) ([]shared.TSEventHighchartLinePayload, error)

AllBandsByClusterIDAndCreatedFromRangeForHighchart returns all rows with time stretch between created_from and created_to.

func (*TSEvent) AllLinesByClusterIDAndCreatedFromRangeForHighchart

func (ts *TSEvent) AllLinesByClusterIDAndCreatedFromRangeForHighchart(clusterID, from, to int64) ([]shared.TSEventHighchartLinePayload, error)

AllLinesByClusterIDAndCreatedFromRangeForHighchart returns all rows given created_from range.

func (*TSEvent) CreateFromJSON

func (ts *TSEvent) CreateFromJSON(id, clusterID int64, jsonData []byte, ttl time.Duration) (*TSEventRow, error)

func (*TSEvent) DeleteByClusterIDAndID

func (ts *TSEvent) DeleteByClusterIDAndID(clusterID, id int64) (err error)

func (*TSEvent) GetByClusterIDAndID

func (ts *TSEvent) GetByClusterIDAndID(clusterID, id int64) (*TSEventRow, error)

GetByClusterIDAndID returns record by cluster_id and id.

func (*TSEvent) GetByID

func (ts *TSEvent) GetByID(id int64) (*TSEventRow, error)

GetByID returns record by id.

func (*TSEvent) GetCassandraSession

func (ts *TSEvent) GetCassandraSession() (*gocql.Session, error)

type TSEventRow

type TSEventRow struct {
	ID          int64  `db:"id"`
	ClusterID   int64  `db:"cluster_id"`
	CreatedFrom int64  `db:"created_from"`
	CreatedTo   int64  `db:"created_to"`
	Description string `db:"description"`
}

type TSLog

type TSLog struct {
	Base
}

func NewTSLog

func NewTSLog(ctx context.Context) *TSLog

func (*TSLog) AllByClusterIDAndRange

func (ts *TSLog) AllByClusterIDAndRange(clusterID int64, from, to int64) ([]*TSLogRow, error)

AllByClusterIDAndRange returns all logs within time range.

func (*TSLog) AllByClusterIDRangeAndQuery

func (ts *TSLog) AllByClusterIDRangeAndQuery(clusterID int64, from, to int64, resourcedQuery string) ([]*TSLogRow, error)

AllByClusterIDRangeAndQuery returns all rows by cluster id, unix timestamp range, and resourced query.

func (*TSLog) CountByClusterIDFromTimestampHostAndQuery

func (ts *TSLog) CountByClusterIDFromTimestampHostAndQuery(clusterID int64, from int64, hostname, resourcedQuery string) (int64, error)

CountByClusterIDFromTimestampHostAndQuery returns count by cluster id, from unix timestamp, host, and resourced query.

func (*TSLog) Create

func (ts *TSLog) Create(clusterID int64, hostname string, tags map[string]string, loglines []shared.AgentLoglinePayload, filename string, ttl time.Duration) (err error)

Create a new record.

func (*TSLog) CreateFromJSON

func (ts *TSLog) CreateFromJSON(clusterID int64, jsonData []byte, ttl time.Duration) error

func (*TSLog) GetCassandraSession

func (ts *TSLog) GetCassandraSession() (*gocql.Session, error)

func (*TSLog) LastByClusterID

func (ts *TSLog) LastByClusterID(clusterID int64) (*TSLogRow, error)

LastByClusterID returns the last row by cluster id.

type TSLogRow

type TSLogRow struct {
	ClusterID int64             `db:"cluster_id"`
	Created   int64             `db:"created"`
	Hostname  string            `db:"hostname"`
	Tags      map[string]string `db:"tags"`
	Filename  string            `db:"filename"`
	Logline   string            `db:"logline"`
}

func (*TSLogRow) CreatedUnix

func (tsr *TSLogRow) CreatedUnix() int64

func (*TSLogRow) GetTags

func (tsr *TSLogRow) GetTags() map[string]string

type TSLogRowsWithError

type TSLogRowsWithError struct {
	TSLogRows []*TSLogRow
	Error     error
}

type TSMetric

type TSMetric struct {
	Base
}

func NewTSMetric

func NewTSMetric(ctx context.Context) *TSMetric

func (*TSMetric) AllByMetricIDAndRange

func (ts *TSMetric) AllByMetricIDAndRange(clusterID, metricID int64, from, to int64) ([]*shared.TSMetricRow, error)

func (*TSMetric) AllByMetricIDAndRangeForHighchart

func (ts *TSMetric) AllByMetricIDAndRangeForHighchart(clusterID, metricID, from, to int64) ([]*shared.TSMetricHighchartPayload, error)

func (*TSMetric) AllByMetricIDHostAndRange

func (ts *TSMetric) AllByMetricIDHostAndRange(clusterID, metricID int64, host string, from, to int64) ([]*shared.TSMetricRow, error)

func (*TSMetric) AllByMetricIDHostAndRangeForHighchart

func (ts *TSMetric) AllByMetricIDHostAndRangeForHighchart(clusterID, metricID int64, host string, from, to int64) (*shared.TSMetricHighchartPayload, error)

func (*TSMetric) CreateByHostRow

func (ts *TSMetric) CreateByHostRow(hostRow shared.IHostRow, metricsMap map[string]int64, ttl time.Duration) error

func (*TSMetric) GetAggregateXMinutesByMetricIDAndHostname

func (ts *TSMetric) GetAggregateXMinutesByMetricIDAndHostname(clusterID, metricID int64, minutes int, hostname string) (*shared.TSMetricAggregateRow, error)

func (*TSMetric) GetCassandraSession

func (ts *TSMetric) GetCassandraSession() (*gocql.Session, error)

Directories

Path Synopsis
Package querybuilder parses ResourceD query and turn it into Cassandra + Lucene query.
Package querybuilder parses ResourceD query and turn it into Cassandra + Lucene query.

Jump to

Keyboard shortcuts

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