Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
 - Variables
 - func FloatToString(val float64) string
 - func IsEmptyRequestId(r RequestId) bool
 - type AbstractBackend
 - type AbstractBackendWithMetadata
 - type AbstractStrategy
 - type Context
 - type ContextBackend
 - type ContextRead
 - type ContextWrite
 - type CreateSeries
 - type CreateSeriesResult
 - type DeleteSeries
 - type DeleteSeriesResult
 - type IAbstractBackend
 - type IMetadata
 - type IReverseApi
 - type MemoryBackend
 - func (instance *MemoryBackend) Clear() error
 - func (instance *MemoryBackend) CreateOrUpdateSeries(create *CreateSeries) (result *CreateSeriesResult)
 - func (instance *MemoryBackend) DeleteSeries(ops *DeleteSeries) (result *DeleteSeriesResult)
 - func (instance *MemoryBackend) FlushPendingWrites(RequestId) error
 - func (instance *MemoryBackend) GetSeriesMeta(s Series) *SeriesMetadata
 - func (instance *MemoryBackend) Init() error
 - func (instance *MemoryBackend) Read(context ContextRead) (res ReadResult)
 - func (instance *MemoryBackend) SearchSeries(search *SearchSeries) (result *SearchSeriesResult)
 - func (instance *MemoryBackend) Type() TypeBackend
 - func (instance *MemoryBackend) Write(context ContextWrite, timestamps []uint64, values []float64) error
 
- type Metadata
 - type Namespace
 - type ReadResult
 - type RedisBackend
 - func (instance *RedisBackend) Clear() error
 - func (instance *RedisBackend) CreateOrUpdateSeries(create *CreateSeries) (result *CreateSeriesResult)
 - func (instance *RedisBackend) DeleteSeries(ops *DeleteSeries) (result *DeleteSeriesResult)
 - func (instance *RedisBackend) FlushPendingWrites(requestId RequestId) error
 - func (instance *RedisBackend) GetConnection(namespace Namespace) redis.UniversalClient
 - func (instance *RedisBackend) Init() error
 - func (instance *RedisBackend) Read(context ContextRead) (res ReadResult)
 - func (instance *RedisBackend) SearchSeries(search *SearchSeries) (result *SearchSeriesResult)
 - func (instance *RedisBackend) Type() TypeBackend
 - func (instance *RedisBackend) Write(context ContextWrite, timestamps []uint64, values []float64) error
 
- type RedisConnectionDetails
 - type RedisOpts
 - type RedisServerType
 - type RequestId
 - type SearchSeries
 - type SearchSeriesComparator
 - type SearchSeriesElement
 - type SearchSeriesResult
 - type Selector
 - type Series
 - type SeriesMetadata
 - type SimpleStrategy
 - type StrategyType
 - type Timestamp
 - type TypeBackend
 
Constants ¶
      View Source
      
  
    const DefaultIdentifier = "default"
    
      View Source
      
  
    const MemoryType = TypeBackend("memory")
    
      View Source
      
  
    const MetadataLocalCacheDuration = 1000 * time.Millisecond
    
      View Source
      
  
    const RedisCluster = "cluster"
    
      View Source
      
  
    const RedisDefaultConnectionNamespace = Namespace(0)
    
      View Source
      
  
    const RedisMemory = "memory" // miniredis client
    
      View Source
      
  
    const RedisOptsKey = "redis"
    
      View Source
      
  
    const RedisServer = "server"
    
      View Source
      
  
const RedisType = TypeBackend("redis")
    Variables ¶
      View Source
      
  
var SimpleStrategyType = StrategyType("simple")
    Functions ¶
func FloatToString ¶
func IsEmptyRequestId ¶
Types ¶
type AbstractBackend ¶
type AbstractBackend struct {
	// contains filtered or unexported fields
}
    func (*AbstractBackend) ReverseApi ¶
func (a *AbstractBackend) ReverseApi() IReverseApi
func (*AbstractBackend) SetReverseApi ¶
func (a *AbstractBackend) SetReverseApi(reverseApi IReverseApi)
type AbstractBackendWithMetadata ¶
type AbstractBackendWithMetadata interface {
	IAbstractBackend
	IMetadata
}
    backend that supports both metadata and storage
type AbstractStrategy ¶
type AbstractStrategy interface {
	GetBackend() IAbstractBackend
	SetBackends([]IAbstractBackend)
}
    func NewSimpleStrategy ¶
func NewSimpleStrategy() AbstractStrategy
func StrategyInstanceFactory ¶
func StrategyInstanceFactory(typeStr string, opts map[string]interface{}) AbstractStrategy
type ContextBackend ¶
type ContextBackend struct {
	Context
}
    type ContextRead ¶
type ContextWrite ¶
type ContextWrite struct {
	Context
}
    type CreateSeries ¶
type CreateSeries struct {
	Series map[types.SeriesCreateIdentifier]types.SeriesCreateMetadata
}
    type CreateSeriesResult ¶
type CreateSeriesResult struct {
	Results map[types.SeriesCreateIdentifier]types.SeriesMetadataResponse
	Error   error
}
    type DeleteSeries ¶
type DeleteSeries struct {
	Series []types.SeriesIdentifier
}
    type DeleteSeriesResult ¶
type DeleteSeriesResult struct {
	Error error
}
    type IAbstractBackend ¶
type IAbstractBackend interface {
	Type() TypeBackend
	Write(context ContextWrite, timestamps []uint64, values []float64) error
	FlushPendingWrites(requestId RequestId) error
	Read(context ContextRead) ReadResult
	Init() error // should be called before first usage
	SetReverseApi(IReverseApi)
}
    func InstanceFactory ¶
func InstanceFactory(typeStr string, opts map[string]interface{}) IAbstractBackend
type IMetadata ¶
type IMetadata interface {
	CreateOrUpdateSeries(*CreateSeries) *CreateSeriesResult // create/update new series (batch)
	SearchSeries(*SearchSeries) *SearchSeriesResult         // search one or multiple series by tags
	DeleteSeries(*DeleteSeries) *DeleteSeriesResult         // remove series (batch)
	Clear() error                                           // clear all data, mainly used for testing
}
    type IReverseApi ¶
type IReverseApi interface {
	DeleteSeries(delete *DeleteSeries) *DeleteSeriesResult
}
    the backend implementation can callback into a limited set of APIs to achieve things for example if TTL expiry is implemented on-read it will have to instruct removal of that series
type MemoryBackend ¶
type MemoryBackend struct {
	AbstractBackend
	// contains filtered or unexported fields
}
    func NewMemoryBackend ¶
func NewMemoryBackend() *MemoryBackend
func (*MemoryBackend) Clear ¶
func (instance *MemoryBackend) Clear() error
func (*MemoryBackend) CreateOrUpdateSeries ¶
func (instance *MemoryBackend) CreateOrUpdateSeries(create *CreateSeries) (result *CreateSeriesResult)
func (*MemoryBackend) DeleteSeries ¶
func (instance *MemoryBackend) DeleteSeries(ops *DeleteSeries) (result *DeleteSeriesResult)
func (*MemoryBackend) FlushPendingWrites ¶
func (instance *MemoryBackend) FlushPendingWrites(RequestId) error
func (*MemoryBackend) GetSeriesMeta ¶
func (instance *MemoryBackend) GetSeriesMeta(s Series) *SeriesMetadata
func (*MemoryBackend) Init ¶
func (instance *MemoryBackend) Init() error
func (*MemoryBackend) Read ¶
func (instance *MemoryBackend) Read(context ContextRead) (res ReadResult)
func (*MemoryBackend) SearchSeries ¶
func (instance *MemoryBackend) SearchSeries(search *SearchSeries) (result *SearchSeriesResult)
func (*MemoryBackend) Type ¶
func (instance *MemoryBackend) Type() TypeBackend
func (*MemoryBackend) Write ¶
func (instance *MemoryBackend) Write(context ContextWrite, timestamps []uint64, values []float64) error
type Metadata ¶
type Metadata struct {
	// contains filtered or unexported fields
}
    func NewMetadata ¶
func NewMetadata(backend AbstractBackendWithMetadata) *Metadata
func (*Metadata) CreateOrUpdateSeries ¶
func (meta *Metadata) CreateOrUpdateSeries(create *CreateSeries) *CreateSeriesResult
func (*Metadata) DeleteSeries ¶
func (meta *Metadata) DeleteSeries(delete *DeleteSeries) *DeleteSeriesResult
func (*Metadata) SearchSeries ¶
func (meta *Metadata) SearchSeries(search *SearchSeries) *SearchSeriesResult
type ReadResult ¶
type RedisBackend ¶
type RedisBackend struct {
	AbstractBackend
	// contains filtered or unexported fields
}
    func NewRedisBackend ¶
func NewRedisBackend(opts *RedisOpts) *RedisBackend
func (*RedisBackend) Clear ¶
func (instance *RedisBackend) Clear() error
func (*RedisBackend) CreateOrUpdateSeries ¶
func (instance *RedisBackend) CreateOrUpdateSeries(create *CreateSeries) (result *CreateSeriesResult)
func (*RedisBackend) DeleteSeries ¶
func (instance *RedisBackend) DeleteSeries(ops *DeleteSeries) (result *DeleteSeriesResult)
func (*RedisBackend) FlushPendingWrites ¶
func (instance *RedisBackend) FlushPendingWrites(requestId RequestId) error
func (*RedisBackend) GetConnection ¶
func (instance *RedisBackend) GetConnection(namespace Namespace) redis.UniversalClient
func (*RedisBackend) Init ¶
func (instance *RedisBackend) Init() error
func (*RedisBackend) Read ¶
func (instance *RedisBackend) Read(context ContextRead) (res ReadResult)
func (*RedisBackend) SearchSeries ¶
func (instance *RedisBackend) SearchSeries(search *SearchSeries) (result *SearchSeriesResult)
func (*RedisBackend) Type ¶
func (instance *RedisBackend) Type() TypeBackend
func (*RedisBackend) Write ¶
func (instance *RedisBackend) Write(context ContextWrite, timestamps []uint64, values []float64) error
type RedisConnectionDetails ¶
type RedisConnectionDetails struct {
	Type     RedisServerType //sentinel cluster server
	Addr     string
	Port     int
	Password string
	Database int
}
    type RedisOpts ¶
type RedisOpts struct {
	// connection per namespace supported, use RedisDefaultConnectionNamespace for default
	ConnectionDetails map[Namespace]RedisConnectionDetails
}
    func ExtractRedisOpts ¶
type RedisServerType ¶
type RedisServerType string
type SearchSeries ¶
type SearchSeries struct {
	SearchSeriesElement
}
    type SearchSeriesComparator ¶
type SearchSeriesComparator string
const SearchSeriesComparatorEquals SearchSeriesComparator = "EQUALS"
    const SearchSeriesComparatorNot SearchSeriesComparator = "NOT"
    type SearchSeriesElement ¶
type SearchSeriesElement struct {
	Namespace  int
	Name       string
	Tag        string
	Comparator SearchSeriesComparator
	And        []SearchSeriesElement
	Or         []SearchSeriesElement
}
    type SearchSeriesResult ¶
type SearchSeriesResult struct {
	Series []types.SeriesIdentifier
	Error  error
}
    type Selector ¶
type Selector struct {
	// contains filtered or unexported fields
}
    func NewSelector ¶
func NewSelector() *Selector
func (*Selector) AddStrategy ¶
func (selector *Selector) AddStrategy(strategy AbstractStrategy) error
func (*Selector) SelectStrategy ¶
func (selector *Selector) SelectStrategy(context ContextBackend) (AbstractStrategy, error)
type SeriesMetadata ¶
type SimpleStrategy ¶
type SimpleStrategy struct {
	// contains filtered or unexported fields
}
    func (*SimpleStrategy) GetBackend ¶
func (strategy *SimpleStrategy) GetBackend() IAbstractBackend
func (*SimpleStrategy) SetBackends ¶
func (strategy *SimpleStrategy) SetBackends(backend []IAbstractBackend)
type StrategyType ¶
type StrategyType string
func (StrategyType) String ¶
func (t StrategyType) String() string
type TypeBackend ¶
type TypeBackend string
func (TypeBackend) String ¶
func (t TypeBackend) String() string
 Click to show internal directories. 
   Click to hide internal directories.