file

package
v0.0.0-...-99d84d4 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func False

func False(_ record.Record) bool

func GenKey

func GenKey(metric string, t time.Time) string

GenKey returns the file name for a metric at a specific time.Time Note the file name returned will be that in UTC not the timezone for the passed time

func GetAllRecords

func GetAllRecords(q Query) []record.Record

func True

func True(_ record.Record) bool

Types

type File

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

func (*File) Append

func (f *File) Append(rec record.Record) error

func (*File) AppendBulk

func (f *File) AppendBulk(rec record.Record) error

func (*File) Close

func (f *File) Close() error

func (*File) EntryCount

func (f *File) EntryCount() (int, error)

EntryCount returns the number of metrics in the file

func (*File) Expired

func (f *File) Expired(t time.Time) bool

func (*File) GetLatestRecord

func (f *File) GetLatestRecord() (record.Record, error)

func (*File) GetRecord

func (f *File) GetRecord(i int) (record.Record, error)

func (*File) IsOpen

func (f *File) IsOpen() bool

func (*File) Size

func (f *File) Size() (int, error)

Size returns the total file size in bytes

func (*File) Sync

func (f *File) Sync() error

type Filter

type Filter func(record.Record) bool

func After

func After(t time.Time) Filter

func Before

func Before(t time.Time) Filter

func Between

func Between(s, e time.Time) Filter

func Of

func Of(filters ...Filter) Filter

func (Filter) And

func (a Filter) And(b Filter) Filter

func (Filter) Or

func (a Filter) Or(b Filter) Filter

type Query

type Query interface {
	HasNext() bool
	Next() record.Record
}

type QueryBuilder

type QueryBuilder interface {
	// Today sets the search range to span from Local Midnight for 24 hours
	Today() QueryBuilder
	// TodayUTC sets the search range to span from Midnight UTC for 24 hours
	TodayUTC() QueryBuilder
	// Yesterday sets the search range to span yesterday in local time
	Yesterday() QueryBuilder
	// YesterdayUTC sets the search range to span yesterday in UTC
	YesterdayUTC() QueryBuilder
	// DayFrom sets the search range to span for 24 hours from the specified time
	DayFrom(from time.Time) QueryBuilder
	// DayTo sets the search range to span for 24 hours up until the specified time
	DayTo(to time.Time) QueryBuilder
	// Between sets the time range of the query
	Between(from, to time.Time) QueryBuilder
	// Filter sets the filter to use. If one already exists then this will be or'ed with it.
	Filter(Filter) QueryBuilder
	// Build the final Query
	Build() Query
}

type Store

type Store interface {
	// Append a record to a metric
	Append(metric string, rec record.Record) error
	AppendBulk(metric string, rec record.Record) error
	Sync(metric string) error
	// GetRecord returns the numbered record for a metric on a specific date
	GetRecord(metric string, date time.Time, num int) (record.Record, error)
	// NumRecords returns the number of metrics for a metric on a specific date
	NumRecords(metric string, date time.Time) (int, error)
	// Query returns a builder to build a query against a metric
	Query(metric string) QueryBuilder
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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