metadata

package
v2.28.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2020 License: GPL-3.0 Imports: 19 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

	// CheckKeyset - verifies if a keyset exists
	CheckKeyset(keyset string) bool

	// 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
	// Returns: results, total and gobol.Error
	FilterMetadata(collection string, query *Query, from, maxResults int) ([]Metadata, int, gobol.Error)

	// AddDocument - add/update a document
	AddDocument(collection string, metadata *Metadata) gobol.Error

	// CheckMetadata - verifies if a metadata exists
	CheckMetadata(collection, tsType, tsid string, tsidBytes []byte) (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                    int
	QueryCacheTTL                 int
	MaxReturnedMetadata           int
	ZookeeperConfig               string
	BlacklistedKeysets            []string
	CacheKeyHashSize              int
	KeysetCacheAutoUpdateInterval string
}

Settings for the metadata package

type SolrBackend

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

SolrBackend - struct

func NewSolrBackend

func NewSolrBackend(settings *Settings, mc *tlmanager.Instance, memcached *memcached.Memcached) (*SolrBackend, error)

NewSolrBackend - creates a new instance

func (*SolrBackend) AddDocument

func (sb *SolrBackend) AddDocument(collection string, m *Metadata) gobol.Error

AddDocument - add/update a document

func (*SolrBackend) CheckKeyset

func (sb *SolrBackend) CheckKeyset(keyset string) bool

CheckKeyset - verifies if an index exists

func (*SolrBackend) CheckMetadata

func (sb *SolrBackend) CheckMetadata(collection, tsType, tsid string, tsidBytes []byte) (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

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, mc *tlmanager.Instance, 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