storage

package
v0.0.0-...-5c7ffcf Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggNumberDataNode

type AggNumberDataNode struct {
	Value float64
	Count int32
	Agg   agg.AggType
}

func (*AggNumberDataNode) AddCount

func (n *AggNumberDataNode) AddCount()

func (*AggNumberDataNode) MergeHll

func (n *AggNumberDataNode) MergeHll(str string)

func (*AggNumberDataNode) MergeNumber

func (n *AggNumberDataNode) MergeNumber(f float64)

func (*AggNumberDataNode) String

func (n *AggNumberDataNode) String() string

type DataNode

type DataNode interface {
	AddCount()
	MergeNumber(float64)
	MergeHll(string)
}

TODO 这里似乎将 agg 的落沉淀到底层的datanode上 这是我不太想的, 但如果不这么做, 底层就要存储 interface{}

func NewAggNumberDataNode

func NewAggNumberDataNode(aggType agg.AggType) DataNode

func NewHllDataNode

func NewHllDataNode() DataNode

type HllDataNode

type HllDataNode struct {
}

func (*HllDataNode) AddCount

func (h *HllDataNode) AddCount()

func (*HllDataNode) MergeHll

func (h *HllDataNode) MergeHll(str string)

func (*HllDataNode) MergeNumber

func (h *HllDataNode) MergeNumber(f float64)

type Point

type Point struct {
	// 时间戳
	Timestamp int64
	KeyNames  []string
	// 维度值, 维度名这里是不关心的
	Keys       []string
	ValueNames []string
	Values     []interface{}
	// LogSamples is the log samples for this point.
	LogSamples [][]string
}

type Shard

type Shard struct {
	TS int64

	// 如果为true说明该shard已经冻结, 比如已经emit过, 然后又收到旧数据,可以用于发现延迟日志
	Frozen bool
	// 有一些数据是shard粒度的, 并不需要做到 points 粒度
	Data interface{}
	// Data2 field is for extension
	Data2 interface{}
	// contains filtered or unexported fields
}

一条时间线在某一个时间点的所有值的集合

func (*Shard) Freeze

func (s *Shard) Freeze()

func (*Shard) GetPoint

func (s *Shard) GetPoint(key string) *Point

func (*Shard) InternalGetAllPoints

func (s *Shard) InternalGetAllPoints() map[string]*Point

func (*Shard) PointCount

func (s *Shard) PointCount() int

func (*Shard) SetPoint

func (s *Shard) SetPoint(key string, p *Point)

type Storage

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

存储

func NewStorage

func NewStorage() *Storage

func (*Storage) Clean

func (s *Storage) Clean(expireTime int64)

func (*Storage) DeleteTimeline

func (s *Storage) DeleteTimeline(key string)

func (*Storage) GetTimeline

func (s *Storage) GetTimeline(key string) *Timeline

func (*Storage) InternalGetTimeline

func (s *Storage) InternalGetTimeline() map[string]*Timeline

func (*Storage) SetTimeline

func (s *Storage) SetTimeline(key string, t *Timeline)

func (*Storage) Start

func (s *Storage) Start()

func (*Storage) Stop

func (s *Storage) Stop()

func (*Storage) Update

func (s *Storage) Update(f func(*Storage))

func (*Storage) View

func (s *Storage) View(f func(*Storage))

type Timeline

type Timeline struct {
	// 时间线的key或者name
	Key string
	// contains filtered or unexported fields
}

func NewTimeline

func NewTimeline(key string, interval, capacity int64) *Timeline

func (*Timeline) AddRef

func (t *Timeline) AddRef(c int) int

func (*Timeline) CreateShard

func (t *Timeline) CreateShard(ts int64) *Shard

func (*Timeline) GetOrCreateShard

func (t *Timeline) GetOrCreateShard(ts int64) *Shard

func (*Timeline) GetShard

func (t *Timeline) GetShard(ts int64) *Shard

func (*Timeline) InternalGetShard

func (t *Timeline) InternalGetShard() []*Shard

func (*Timeline) Lock

func (t *Timeline) Lock()

func (*Timeline) RefCount

func (t *Timeline) RefCount() int

func (*Timeline) Unlock

func (t *Timeline) Unlock()

func (*Timeline) Update

func (t *Timeline) Update(f func(*Timeline))

func (*Timeline) View

func (t *Timeline) View(f func(*Timeline))

Jump to

Keyboard shortcuts

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