Documentation ¶
Index ¶
Constants ¶
const (
// BlockDataSeparator sets a separator for block datavalue
BlockDataSeparator = "|"
)
Variables ¶
This section is empty.
Functions ¶
func GetNormalizedTimeCalc ¶
func GetNormalizedTimeCalc() int64
GetNormalizedTime returns the UnixNano time as normalized time.
Types ¶
type BRQuerier ¶
type BRQuerier struct { // As of now, ServiceName can be one of these: ping, food-ping, jitter, req-res-delay ServiceName string // Route contains a unique identifier and it's method for uniquely // identifying the particular time-series Route BQRoute // Suffix is used for cases involving additional information for identifying the // db. Example: req-res-delay-monitoring contains `_delay`, `_length`, `_status`. Hence, // the suffix is the respective word excluding `_` Suffix string // Connection helps the querier to respond to the requests directly without // worrying about the goroutines. Connection *websocket.Conn // Complete address of the persistent blocks. Address string // contains filtered or unexported fields }
BRQuerier is a querier for querying over the time-series stored in the tsdb
func (*BRQuerier) FetchAllSeriesStringified ¶
FetchAllSeriesStringified returns all the series from the particular chunk. It does not do any processing, rather just a plain simple fetch and return the fetched samples. It is go-routine safe and respond to multiple same series requests.
func (*BRQuerier) GetAddress ¶
GetAddress returns the address of the persistent blocks in the db.
type Block ¶
type Block struct { Datapoint string `json:"datapoint"` // complex data would be decoded by using a blockSeparator NormalizedTime int64 `json:"normalized-time"` // based on time.Unixnano() Type string `json:"type"` // would be used to decide the marshalling struct Timestamp string `json:"timestamp"` }
Block use case block for the TSDB chain
func GetNewBlock ¶
GetNewBlock creates and returns a new block with the specified type.
func (Block) GetDatapointEnc ¶
GetDatapointEnc returns the datapoint to the caller. The encoded refers to the combined _(containing *|*)_ values in stringified form.
func (Block) GetNormalizedTime ¶
GetNormalizedTime returns the normalized time of the block.
func (Block) GetNormalizedTimeStringified ¶
GetNormalizedTimeStringified returns the normalized time of the block.
func (Block) GetTimeStamp ¶
GetTimeStamp returns thetimestamp of the block.
type Chain ¶
type Chain struct { Path string Chain []Block LengthElements int Size uintptr // contains filtered or unexported fields }
Chain contains Blocks arranged as a chain
func (*Chain) Commit ¶
Commit saves or commits the existing chain in the secondary memory. Returns the success status
func (*Chain) GetPositionalIndexNormalized ¶
GetPositionalIndexNormalized Returns block by searching the chain for the NormalizedTime
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader is used to read persistent time-series samples from the storage as required by the user. This is go-routine safe and hence can handle multiple read request on the same samples as well.
type TSDB ¶
type TSDB interface { // Init helps to initialize the tsdb chain for the respective component. This function // should be capable to detect existing wals(write ahead log) of the required type and // build from the local storage at the init of main thread and return the chain address // in order to have a minimal effect on the performance. // Takes *path* as path to the existing chain or for creating a new one. // Returns address of the chain in RAM. Init() (*[]Block, Chain) // Append appends a new tsdb block passed as params to the most recent location (or // the last location) of the chain. Returns success status. Append(b Block) bool // GetPositionalIndexNormalized accepts the normalized time, searches for the block with that time // using jump search, and returns the address of the block having the specified normalized // time. GetPositionalIndexNormalized(n int64) (int, error) // PopPreviousNBlocks pops or removes **n** previous blocks from the chain and returns // success status. PopPreviousNBlocks(n uint64) (Chain, error) // GetChain returns the positional pointer address of the first element of the chain. GetChain() *[]Block // Commit saves or commits the chain in storage and returns success status. Commit() bool }
TSDB implements the idea of tsdb