client

package module
v0.0.0-...-7d9391d Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

View Source
const DefaultPoolTtl = 1 * time.Hour
View Source
const DefaultRpcBaseSleep = 100 * time.Millisecond
View Source
const EagerSeriesInitTimeout = time.Second * 10
View Source
const ErrorState = 4
View Source
const InitialState = 0
View Source
const PanicState = 2
View Source
const QueryBuilderFromInf uint64 = 1
View Source
const QueryBuilderToInf uint64 = math.MaxUint64
View Source
const SuccessState = 3
View Source
const TimeoutState = 1

Variables

This section is empty.

Functions

This section is empty.

Types

type AutoBatchOpt

type AutoBatchOpt interface {
	Apply(*AutoBatchWriter) error
}

type AutoBatchOptAsyncFlush

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

func NewAutoBatchOptAsyncFlush

func NewAutoBatchOptAsyncFlush(val bool) *AutoBatchOptAsyncFlush

func (*AutoBatchOptAsyncFlush) Apply

type AutoBatchWriter

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

func (*AutoBatchWriter) AddToBatch

func (instance *AutoBatchWriter) AddToBatch(series *Series, ts uint64, v float64) error

func (*AutoBatchWriter) AsyncFlush

func (instance *AutoBatchWriter) AsyncFlush() bool

func (*AutoBatchWriter) Close

func (instance *AutoBatchWriter) Close() error

func (*AutoBatchWriter) Errors

func (instance *AutoBatchWriter) Errors(intOpts ...int) chan error

subscribe to this channel to prevent panics in the ticker

func (*AutoBatchWriter) Flush

func (instance *AutoBatchWriter) Flush() error

func (*AutoBatchWriter) FlushCount

func (instance *AutoBatchWriter) FlushCount() uint64

func (*AutoBatchWriter) SetPostFlushFn

func (instance *AutoBatchWriter) SetPostFlushFn(postFlushFn func())

type BatchItem

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

type BatchWriter

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

func (*BatchWriter) AddToBatch

func (batch *BatchWriter) AddToBatch(series *Series, ts uint64, v float64) error

func (*BatchWriter) Execute

func (batch *BatchWriter) Execute() (res WriteResult)

func (*BatchWriter) Size

func (batch *BatchWriter) Size() int

func (*BatchWriter) ToWriteRequest

func (batch *BatchWriter) ToWriteRequest(conn *ManagedConnection) (request types.WriteRequest, err error)

type ConnectionPool

type ConnectionPool struct {
	GenericPool
}

type EagerInitSeriesHelper

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

func (*EagerInitSeriesHelper) SetPreEagerInitFn

func (helper *EagerInitSeriesHelper) SetPreEagerInitFn(f func(series *Series))

type GenericPool

type GenericPool struct {
	New func() interface{}
	// contains filtered or unexported fields
}

func NewGenericPool

func NewGenericPool(opts PoolOpts) GenericPool

func (*GenericPool) Capacity

func (p *GenericPool) Capacity() int

func (*GenericPool) Discard

func (p *GenericPool) Discard(_ interface{})

func (*GenericPool) Get

func (p *GenericPool) Get() interface{}

func (*GenericPool) Put

func (p *GenericPool) Put(v interface{})

func (*GenericPool) Size

func (p *GenericPool) Size() int

type IClosablePoolValue

type IClosablePoolValue interface {
	DiscardPool()
}

type IPool

type IPool interface {
	Get() interface{}
	Put(interface{})
	Capacity() int
	Size() int
}

type InitState

type InitState int64

type Instance

type Instance struct {
	*EagerInitSeriesHelper
	// contains filtered or unexported fields
}

func DefaultClient

func DefaultClient() *Instance

func New

func New(opts *Opts) *Instance

func (*Instance) Close

func (client *Instance) Close()

func (*Instance) EagerInitSeries

func (client *Instance) EagerInitSeries(series *Series)

func (*Instance) GetConnection

func (client *Instance) GetConnection() (managedConnection *ManagedConnection, err error)

func (*Instance) MultiQueryBuilder

func (client *Instance) MultiQueryBuilder() *MultiQueryBuilder

func (*Instance) NewAutoBatchWriter

func (client *Instance) NewAutoBatchWriter(batchSize uint64, timeout time.Duration, opts ...AutoBatchOpt) *AutoBatchWriter

func (*Instance) NewBatchWriter

func (client *Instance) NewBatchWriter() *BatchWriter

func (*Instance) NewClient

func (client *Instance) NewClient() (*ManagedConnection, error)

func (*Instance) NewConnectionPool

func (client *Instance) NewConnectionPool() *ConnectionPool

func (*Instance) Now

func (client *Instance) Now() uint64

timestamp

func (*Instance) Series

func (client *Instance) Series(name string, opts ...SeriesOpt) *Series

func (*Instance) SeriesPool deprecated

func (client *Instance) SeriesPool() *SeriesPool

Deprecated: only use for testing

type ManagedConnection

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

func (*ManagedConnection) Close

func (conn *ManagedConnection) Close() error

func (*ManagedConnection) Discard

func (conn *ManagedConnection) Discard()

Discard call this to make sure connection is not reused

func (*ManagedConnection) DiscardPool

func (conn *ManagedConnection) DiscardPool()

type MultiQueryBuilder

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

func (*MultiQueryBuilder) AddQuery

func (multi *MultiQueryBuilder) AddQuery(queryBuilder *QueryBuilder) error

func (*MultiQueryBuilder) Execute

func (multi *MultiQueryBuilder) Execute() (res MultiQueryResult)

will return queries in the order as they are added via AddQuery

type MultiQueryResult

type MultiQueryResult struct {
	Error   error
	Results []QueryResult // indexed by the queries provided
}

type Opts

type Opts struct {
	rpc.OptsConnection
	SeriesCacheSize int64
	EagerInitSeries bool // will load metadata on creation (async, instead of during flush, more equally spreading out load)
}

func NewOpts

func NewOpts() *Opts

type PoolOpts

type PoolOpts struct {
	Size        int
	MaxSize     int // if > 0, will limit the amount that can be created
	PreWarmSize int
	New         func() interface{}
}

type Query

type Query struct {
	Series *Series
	From   uint64
	To     uint64
}

type QueryBuilder

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

func (*QueryBuilder) Execute

func (builder *QueryBuilder) Execute() (res QueryResult)

func (*QueryBuilder) From

func (builder *QueryBuilder) From(from uint64) *QueryBuilder

func (*QueryBuilder) IsValid

func (builder *QueryBuilder) IsValid() error

func (*QueryBuilder) To

func (builder *QueryBuilder) To(to uint64) *QueryBuilder

func (*QueryBuilder) ToQuery

func (builder *QueryBuilder) ToQuery() (*Query, error)

type QueryResult

type QueryResult struct {
	Series  *Series
	Error   error
	Results map[uint64]float64 // in random order due to Go map implementation, if you need sorted results call QueryResult.Iterator()
}

func (QueryResult) Iterator

func (res QueryResult) Iterator() *QueryResultIterator

type QueryResultIterator

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

func (*QueryResultIterator) Next

func (iter *QueryResultIterator) Next() bool

func (*QueryResultIterator) Reset

func (iter *QueryResultIterator) Reset()

func (*QueryResultIterator) Value

func (iter *QueryResultIterator) Value() (uint64, float64)

type Series

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

func NewSeries deprecated

func NewSeries(name string, client *Instance) *Series

Deprecated: use *Instance.Series() instead

func (*Series) Create

func (series *Series) Create() (id uint64, err error)

func (*Series) Id

func (series *Series) Id() uint64

func (*Series) Init

func (series *Series) Init(conn *ManagedConnection) (id uint64, err error)

func (*Series) InitState

func (series *Series) InitState() InitState

func (*Series) Name

func (series *Series) Name() string

func (*Series) Namespace

func (series *Series) Namespace() int

func (*Series) NoOp

func (series *Series) NoOp() (err error)

func (*Series) QueryBuilder

func (series *Series) QueryBuilder() *QueryBuilder

func (*Series) ResetInit

func (series *Series) ResetInit()

func (*Series) SetInitState

func (series *Series) SetInitState(state InitState)

func (*Series) TTL

func (series *Series) TTL() uint

func (*Series) Tags

func (series *Series) Tags() []string

func (*Series) Write

func (series *Series) Write(ts uint64, v float64) (res WriteResult)

type SeriesNamespace

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

func NewSeriesNamespace

func NewSeriesNamespace(namespace int) *SeriesNamespace

func (SeriesNamespace) Apply

func (opt SeriesNamespace) Apply(series *Series) error

type SeriesOpt

type SeriesOpt interface {
	Apply(*Series) error
}

type SeriesPool

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

func NewSeriesPool

func NewSeriesPool(clientOpts *Opts) *SeriesPool

func (*SeriesPool) Count

func (pool *SeriesPool) Count() int

func (*SeriesPool) EvictCache deprecated

func (pool *SeriesPool) EvictCache() int

Deprecated: only use for testing

func (*SeriesPool) Get

func (pool *SeriesPool) Get(name string) *Series

func (*SeriesPool) Hits

func (pool *SeriesPool) Hits() uint64

func (*SeriesPool) Set

func (pool *SeriesPool) Set(name string, value *Series)

type SeriesTTL

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

func NewSeriesTTL

func NewSeriesTTL(ttl uint) *SeriesTTL

expires the whole series after creation. e.g. setting this to 86400 the whole series will be removed after 1 day, regardless of additional timeseries values being added

func (SeriesTTL) Apply

func (opt SeriesTTL) Apply(series *Series) error

type SeriesTags

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

func NewSeriesTags

func NewSeriesTags(tags ...string) *SeriesTags

func (SeriesTags) Apply

func (opt SeriesTags) Apply(series *Series) error

type WriteResult

type WriteResult struct {
	Error        error
	NumPersisted int
}

Jump to

Keyboard shortcuts

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