Documentation
¶
Overview ¶
Package devologtable implements the tools to use data saved in Devo (under certain tag) like a Table.
This is based in the "LogTable" method that transform events like write create, update and delete saved in a stream to columns and values.
For example next events pushed to any stream that can be queired at any time, like Devo
SET a=1 SET b=2 SET a=3 set c=5 DEL b
Can be see as next key-value table when all stream was processed
+-----+-------+ | Key | Value | +-----+-------+ | a | 3 | +-----+------ + | c | 5 | +-----+-------+
Index ¶
- Constants
- func GetValueAsBool(lte LogTableEngine, name string) (*bool, error)
- func GetValueAsNumber(lte LogTableEngine, name string) (*float64, error)
- type LogTableEngine
- type LogTableOneStringColumn
- func (ltoc *LogTableOneStringColumn) AddControlPoint() error
- func (ltoc *LogTableOneStringColumn) DeleteBatchValues(names []string) error
- func (ltoc *LogTableOneStringColumn) DeleteValue(name string) error
- func (ltoc *LogTableOneStringColumn) DeleteValueAndCheck(name string, checkInterval time.Duration, maxRetries int) error
- func (ltoc *LogTableOneStringColumn) GetAll() (map[string]string, error)
- func (ltoc *LogTableOneStringColumn) GetNames(devoRegexp string) ([]string, error)
- func (ltoc *LogTableOneStringColumn) GetValue(name string) (*string, error)
- func (ltoc *LogTableOneStringColumn) RefreshDataHead() error
- func (ltoc *LogTableOneStringColumn) SetBatchValues(values map[string]string) error
- func (ltoc *LogTableOneStringColumn) SetValue(name string, value string) error
- func (ltoc *LogTableOneStringColumn) SetValueAndCheck(name string, value string, checkInterval time.Duration, maxRetries int) error
Constants ¶
const ( // MaxTimeToLookForBeginTable is the duration to move 'from' pointer when create engine MaxTimeToLookForBeginTable = time.Hour * 24 * (365 / 2) )
Variables ¶
This section is empty.
Functions ¶
func GetValueAsBool ¶
func GetValueAsBool(lte LogTableEngine, name string) (*bool, error)
GetValueAsBool is similar to lte.GetValue but parse returned value to boolean
func GetValueAsNumber ¶
func GetValueAsNumber(lte LogTableEngine, name string) (*float64, error)
GetValueAsNumber is similar to lte.GetValue but parse value to float64
Types ¶
type LogTableEngine ¶
type LogTableEngine interface { SetValue(name string, value string) error SetValueAndCheck(name string, value string, checkInterval time.Duration, maxRetries int) error SetBatchValues(values map[string]string) error DeleteValue(name string) error DeleteValueAndCheck(name string, checkInterval time.Duration, maxRetries int) error DeleteBatchValues(names []string) error GetValue(name string) (*string, error) GetAll() (map[string]string, error) GetNames(devoRegexp string) ([]string, error) AddControlPoint() error RefreshDataHead() error }
LogTableEngine define the required behaviour to work with LogTable
type LogTableOneStringColumn ¶
type LogTableOneStringColumn struct { Table string Column string BeginTable time.Time // contains filtered or unexported fields }
LogTableOneStringColumn is the LogTableEngine implementation based on a table with a column of text type Table is the Devo table used to save and load data Column is the column in Devo table of strint type where save/load data BeginTable is pointer used to set `from` value when make queries to Devo. This value should be updated with RefreshDataHead() and is affected by AddControlPoint
func NewLogTableOneStringColumn ¶
func NewLogTableOneStringColumn(qe devoquery.QueryEngine, ds devosender.DevoSender, table string, column string) (*LogTableOneStringColumn, error)
NewLogTableOneStringColumn create new LogTableOneStringColumn instance using: qe for read data, ds to save data to Devo, table is the Devo table where save/load data column is the Column where save/load data
func (*LogTableOneStringColumn) AddControlPoint ¶
func (ltoc *LogTableOneStringColumn) AddControlPoint() error
AddControlPoint Load and sava again all values and mark in low level data new point used to RefreshDataHead to update internal pointer.
func (*LogTableOneStringColumn) DeleteBatchValues ¶
func (ltoc *LogTableOneStringColumn) DeleteBatchValues(names []string) error
DeleteBatchValues deletes a slice of vaules in asynchronous mode, then wait for async calls end and report errors.
func (*LogTableOneStringColumn) DeleteValue ¶
func (ltoc *LogTableOneStringColumn) DeleteValue(name string) error
DeleteValue mark a value as deleted. This method only run save data withot any check about state name is the name of the value to be deleted: The key
func (*LogTableOneStringColumn) DeleteValueAndCheck ¶
func (ltoc *LogTableOneStringColumn) DeleteValueAndCheck(name string, checkInterval time.Duration, maxRetries int) error
DeleteValueAndCheck is similar to DeleteValue but check if data was updated. In consecunce this operation is more expensive that DeleteValue name is the name of the value to be deleted: The key checkInterval is the interval between check retries. maxRetries is the number of retries of checks. It is NOT related with any retray to save data again.
func (*LogTableOneStringColumn) GetAll ¶
func (ltoc *LogTableOneStringColumn) GetAll() (map[string]string, error)
GetAll returns all the values (key, value) saved until now. Be carefully because this operation can consume a lot of resources depending of amount of data saved
func (*LogTableOneStringColumn) GetNames ¶
func (ltoc *LogTableOneStringColumn) GetNames(devoRegexp string) ([]string, error)
GetNames return the list of nambes based on regeular expression. devoRegexp must be in Devo regular expression format (https://docs.devo.com/confluence/ndt/searching-data/building-a-query/operations-reference/string-group/matches-matches) The only requirement is that regeular expression must start with '^' and end with '$'
func (*LogTableOneStringColumn) GetValue ¶
func (ltoc *LogTableOneStringColumn) GetValue(name string) (*string, error)
GetValue return the value saved for located by name, or return nil if value does not exists or was removed
func (*LogTableOneStringColumn) RefreshDataHead ¶
func (ltoc *LogTableOneStringColumn) RefreshDataHead() error
RefreshDataHead runs query to Devo in order to move internal "from" pointer more close to Now if possible. This will improve performance because minimal time range intervals are better when make queries. RefreshDataHead works better if you make control points with AddControlPoint
func (*LogTableOneStringColumn) SetBatchValues ¶
func (ltoc *LogTableOneStringColumn) SetBatchValues(values map[string]string) error
SetBatchValues set all names values in async mode, then wait to all elements was sent and report errors.
func (*LogTableOneStringColumn) SetValue ¶
func (ltoc *LogTableOneStringColumn) SetValue(name string, value string) error
SetValue save new value or update one. This method only run save data withot any check about if data was saved name is the name of the value: The key value is the value used to update mentioned key.
func (*LogTableOneStringColumn) SetValueAndCheck ¶
func (ltoc *LogTableOneStringColumn) SetValueAndCheck(name string, value string, checkInterval time.Duration, maxRetries int) error
SetValueAndCheck is similar to SetValue, but check if data was saved. In consecunce this operation is more expensive that SetValue name is the name of the value: The key value is the value used to update mentioned key. checkInterval is the interval between check retries. maxRetries is the number of retries of checks. It is NOT related with any retray to save data again.