metadata

package
v2.11.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2018 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	// CreateKeySet creates a keyset in the metadata storage
	CreateKeySet(name string) gobol.Error

	// DeleteKeySet deletes a keyset in the metadata storage
	DeleteKeySet(name string) gobol.Error

	// ListKeySet - list all keyset
	ListKeySets() ([]string, gobol.Error)

	// CheckKeySet - verifies if a keyset exists
	CheckKeySet(keyset string) (bool, gobol.Error)

	// FilterTagValues - filter tag values from a collection
	FilterTagValues(collection, prefix string, maxResults int) ([]string, int, gobol.Error)

	// FilterTagKeys - filter tag keys from a collection
	FilterTagKeys(collection, prefix string, maxResults int) ([]string, int, gobol.Error)

	// FilterMetrics - filter metrics from a collection
	FilterMetrics(collection, prefix string, maxResults int) ([]string, int, gobol.Error)

	// FilterMetadata - list all metas from a collection
	FilterMetadata(collection string, query *Query, from, maxResults int) ([]Metadata, int, gobol.Error)

	// AddDocuments - add/update a document or a series of documents
	AddDocuments(collection string, metadatas []Metadata) gobol.Error

	// CheckMetadata - verifies if a metadata exists
	CheckMetadata(collection, tsType, tsid string) (bool, gobol.Error)

	// SetRegexValue - add slashes to the value
	SetRegexValue(value string) string

	// HasRegexPattern - check if the value has a regular expression
	HasRegexPattern(value string) bool

	// DeleteDocumentByID - delete a document by ID and its child documents
	DeleteDocumentByID(collection, tsType, id string) gobol.Error

	// FilterTagKeysByMetric - filter tag values from a collection given its metric
	FilterTagKeysByMetric(collection, tsType, metric, prefix string, maxResults int) ([]string, int, gobol.Error)

	// FilterTagValuesByMetricAndTag - filter tag values from a collection given its metric and tag
	FilterTagValuesByMetricAndTag(collection, tsType, metric, tag, prefix string, maxResults int) ([]string, int, gobol.Error)
}

Backend hides the underlying implementation of the metadata storage

type Metadata

type Metadata struct {
	ID       string   `json:"id"`
	Metric   string   `json:"metric"`
	TagKey   []string `json:"tagKey"`
	TagValue []string `json:"tagValue"`
	MetaType string   `json:"type"`
	Keyset   string   `json:"keyset"`
}

Metadata document

type Query

type Query struct {
	Metric   string     `json:"metric"`
	MetaType string     `json:"type"`
	Regexp   bool       `json:regexp`
	Tags     []QueryTag `json:"tags"`
}

Query - query

type QueryTag

type QueryTag struct {
	Key    string   `json:"key"`
	Values []string `json:value`
	Negate bool     `json:negate`
	Regexp bool     `json:regexp`
}

QueryTag - tags for query

type Settings

type Settings struct {
	NumShards           int
	ReplicationFactor   int
	URL                 string
	IDCacheTTL          int32
	QueryCacheTTL       int32
	KeysetCacheTTL      int32
	MaxReturnedMetadata int
	ZookeeperConfig     string
	BlacklistedKeysets  []string
}

Settings for the metadata package

type SolrBackend

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

SolrBackend - struct

func NewSolrBackend

func NewSolrBackend(settings *Settings, stats *tsstats.StatsTS, logger *zap.Logger, memcached *memcached.Memcached) (*SolrBackend, error)

NewSolrBackend - creates a new instance

func (*SolrBackend) AddDocuments

func (sb *SolrBackend) AddDocuments(collection string, metadatas []Metadata) gobol.Error

AddDocuments - add/update a document or a series of documents

func (*SolrBackend) CheckKeySet

func (sb *SolrBackend) CheckKeySet(keyset string) (bool, gobol.Error)

CheckKeySet - verifies if an index exists

func (*SolrBackend) CheckMetadata

func (sb *SolrBackend) CheckMetadata(collection, tsType, tsid string) (bool, gobol.Error)

CheckMetadata - verifies if a metadata exists

func (*SolrBackend) CreateKeySet

func (sb *SolrBackend) CreateKeySet(collection string) gobol.Error

CreateKeySet - creates a new collection

func (*SolrBackend) DeleteCachedIDifExist

func (sb *SolrBackend) DeleteCachedIDifExist(collection, tsType, id string) gobol.Error

DeleteCachedIDifExist - check if ID is cached and delete it

func (*SolrBackend) DeleteDocumentByID

func (sb *SolrBackend) DeleteDocumentByID(collection, tsType, id string) gobol.Error

DeleteDocumentByID - delete a document by ID and its child documents

func (*SolrBackend) DeleteKeySet

func (sb *SolrBackend) DeleteKeySet(collection string) gobol.Error

DeleteKeySet - deletes a collection

func (*SolrBackend) FilterMetadata

func (sb *SolrBackend) FilterMetadata(collection string, query *Query, from, maxResults int) ([]Metadata, int, gobol.Error)

FilterMetadata - list all metas from a collection

func (*SolrBackend) FilterMetrics

func (sb *SolrBackend) FilterMetrics(collection, prefix string, maxResults int) ([]string, int, gobol.Error)

FilterMetrics - list all metrics from a collection

func (*SolrBackend) FilterTagKeys

func (sb *SolrBackend) FilterTagKeys(collection, prefix string, maxResults int) ([]string, int, gobol.Error)

FilterTagKeys - list all tag keys from a collection

func (*SolrBackend) FilterTagKeysByMetric

func (sb *SolrBackend) FilterTagKeysByMetric(collection, tsType, metric, prefix string, maxResults int) ([]string, int, gobol.Error)

FilterTagKeysByMetric - returns all tag keys related to the specified metric

func (*SolrBackend) FilterTagValues

func (sb *SolrBackend) FilterTagValues(collection, prefix string, maxResults int) ([]string, int, gobol.Error)

FilterTagValues - list all tag values from a collection

func (*SolrBackend) FilterTagValuesByMetricAndTag

func (sb *SolrBackend) FilterTagValuesByMetricAndTag(collection, tsType, metric, tag, prefix string, maxResults int) ([]string, int, gobol.Error)

FilterTagValuesByMetricAndTag - returns all tag values related to the specified metric and tag

func (*SolrBackend) HasRegexPattern

func (sb *SolrBackend) HasRegexPattern(value string) bool

HasRegexPattern - check if the value has a regular expression

func (*SolrBackend) ListKeySets

func (sb *SolrBackend) ListKeySets() ([]string, gobol.Error)

ListKeySets - list all keysets

func (*SolrBackend) SetRegexValue

func (sb *SolrBackend) SetRegexValue(value string) string

SetRegexValue - add slashes to the value

type Storage

type Storage struct {

	// Backend is the thing that actually does the specific work in the storage
	Backend
	// contains filtered or unexported fields
}

Storage is a storage for metadata

func Create

func Create(settings *Settings, logger *zap.Logger, stats *tsstats.StatsTS, memcached *memcached.Memcached) (*Storage, error)

Create creates a metadata handler

Jump to

Keyboard shortcuts

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