indexmanager

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2021 License: AGPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Index

type Index interface {
	WaitIndicesLoad()

	GetReadIndices(metrics []string, namespace []string, start, end int64) []string

	GetWriteIndex(m *metric.Metric) (string, bool)
	GetWriteFixedIndex(m *metric.Metric) string
	CreateIndex(m *metric.Metric) error

	CleanIndices(filter IndexMatcher) error                                                               // 清理匹配且过期的索引数据
	RolloverIndices(filter IndexMatcher) error                                                            // 滚动匹配的索引
	MergeIndices(filter IndexMatcher, min string, merge, delete bool) ([]*MergeGroup, interface{}, error) // 合并匹配的索引

	MetricNames() []string
	EmptyIndex() string
	IndexPrefix() string
	IndexType() string
	RequestTimeout() time.Duration
	Client() *elastic.Client
	URLs() string
	EnableRollover() bool
}

Index .

type IndexEntry

type IndexEntry struct {
	Index       string
	Metric      string
	Namespace   string
	Key         string
	Fixed       bool
	Num         int64
	MinT        time.Time
	MaxT        time.Time
	DocsCount   int
	DocsDeleted int
	StoreSize   int64
	Active      bool
}

IndexEntry .

type IndexEntrys

type IndexEntrys []*IndexEntry

IndexEntrys .

func (IndexEntrys) Len

func (entrys IndexEntrys) Len() int

func (IndexEntrys) Less

func (entrys IndexEntrys) Less(i, j int) bool

func (IndexEntrys) Swap

func (entrys IndexEntrys) Swap(i, j int)

type IndexManager

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

IndexManager loading indexes, managing index creation, scrolling, etc

func NewIndexManager

func NewIndexManager(cfg *config, es *elastic.Client, urls string, db *gorm.DB, log logs.Logger) *IndexManager

NewIndexManager .

func (*IndexManager) CleanIndices

func (m *IndexManager) CleanIndices(filter IndexMatcher) error

CleanIndices .

func (*IndexManager) Client

func (m *IndexManager) Client() *elastic.Client

Client .

func (*IndexManager) Close

func (m *IndexManager) Close() error

Close .

func (*IndexManager) CreateIndex

func (m *IndexManager) CreateIndex(metric *metric.Metric) error

CreateIndex .

func (*IndexManager) EmptyIndex

func (m *IndexManager) EmptyIndex() string

EmptyIndex .

func (*IndexManager) EnableRollover

func (m *IndexManager) EnableRollover() bool

EnableRollover .

func (*IndexManager) GetReadIndices

func (m *IndexManager) GetReadIndices(metrics []string, namespaces []string, start, end int64) (list []string)

GetReadIndices clusters as namespaces, start、end is ms

func (*IndexManager) GetWriteFixedIndex

func (m *IndexManager) GetWriteFixedIndex(metric *metric.Metric) string

GetWriteFixedIndex spot-<metric>-<namespace> Gets a time-free index, which represents permanent storage of data

func (*IndexManager) GetWriteIndex

func (m *IndexManager) GetWriteIndex(metric *metric.Metric) (string, bool)

GetWriteIndex . enable rollover: spot-<metric>-<namespace>-r-000001 spot-<metric>-<namespace>.<key>-r-000001 unable rollover: spot-<metric>-<namespace>-<timestamp> spot-<metric>-<namespace>.<key>-<timestamp>

func (*IndexManager) IndexPrefix

func (m *IndexManager) IndexPrefix() string

IndexPrefix .

func (*IndexManager) IndexType

func (m *IndexManager) IndexType() string

IndexType .

func (*IndexManager) MergeIndices

func (m *IndexManager) MergeIndices(filter IndexMatcher, min string, merge, delete bool) ([]*MergeGroup, interface{}, error)

MergeIndices .

func (*IndexManager) MetricNames

func (m *IndexManager) MetricNames() (names []string)

MetricNames .

func (*IndexManager) RequestTimeout

func (m *IndexManager) RequestTimeout() time.Duration

RequestTimeout .

func (*IndexManager) RolloverIndices

func (m *IndexManager) RolloverIndices(filter IndexMatcher) error

RolloverIndices .

func (*IndexManager) Start

func (m *IndexManager) Start(lock mutex.Mutex) error

Start .

func (*IndexManager) URLs

func (m *IndexManager) URLs() string

URLs .

func (*IndexManager) WaitIndicesLoad

func (m *IndexManager) WaitIndicesLoad()

WaitIndicesLoad .

type IndexMatcher

type IndexMatcher func(index *IndexEntry) bool

IndexMatcher .

type MergeGroup

type MergeGroup struct {
	List []*IndexEntry

	Indices     string
	MergedSize  string
	MergedDocs  int
	MergedIndex string
	// contains filtered or unexported fields
}

MergeGroup .

type NodeDiskUsage

type NodeDiskUsage struct {
	ID    string
	Total int64 // Total disk capacity of the node
	Used  int64 // The node is already using disk capacity
	Store int64 // Index storage

	UsedPercent  float64 // The node is already using a percentage
	StorePercent float64 // Index storage percentage

	ExpectDelete int64 // Storage expected to be cleared
	Deleted      int64 // The amount of memory currently cleared
}

NodeDiskUsage .

Jump to

Keyboard shortcuts

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