aggregate

package
v1.4.8 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Aggregate      = "aggregate"
	AggregateModes = "k8s,servicecenter"
)

Variables

This section is empty.

Functions

func InitConfigs

func InitConfigs()

func NewRepository

func NewRepository() mgr.Instance

Types

type AdaptorsIndexer

type AdaptorsIndexer struct {
	Adaptors []discovery.Adaptor
}

AdaptorsIndexer implements discovery.Indexer. AdaptorsIndexer is an aggregator of multi Indexers, and it aggregates all the Indexers' data as it's result.

func NewAdaptorsIndexer

func NewAdaptorsIndexer(as []discovery.Adaptor) *AdaptorsIndexer

func (*AdaptorsIndexer) Creditable

func (i *AdaptorsIndexer) Creditable() bool

Creditable implements discovery.Indexer.Creditable. AdaptorsIndexer's search result's are not creditable as it ignores the errors. In other words, AdaptorsIndexer makes the best efforts to search data, but it does not ensure the correctness.

func (*AdaptorsIndexer) Search

Search implements discovery.Indexer.Search. AdaptorsIndexer ignores the errors during search to ensure availability, so it always searches successfully, no matter how many Adaptors are abnormal. But at the cost of that, AdaptorsIndexer doesn't guarantee the correctness of the search results.

type Aggregator

type Aggregator struct {
	// Indexer searches data from all the adapters
	discovery.Indexer
	Type     discovery.Type
	Adaptors []discovery.Adaptor
}

Aggregator implements discovery.Adaptor. Aggregator is an aggregator of multi Adaptors, and it aggregates all the Adaptors' data as it's result.

func NewAggregator

func NewAggregator(t discovery.Type, cfg *discovery.Config) *Aggregator

func (*Aggregator) Cache

func (as *Aggregator) Cache() discovery.CacheReader

Cache gets all the adapters' cache

func (*Aggregator) Ready

func (as *Aggregator) Ready() <-chan struct{}

func (*Aggregator) Run

func (as *Aggregator) Run()

func (*Aggregator) Stop

func (as *Aggregator) Stop()

type AggregatorIndexer

type AggregatorIndexer struct {
	// CacheIndexer searches data from all the adaptors's cache.
	*discovery.CacheIndexer
	// AdaptorsIndexer searches data from all the adaptors.
	AdaptorsIndexer discovery.Indexer
	// LocalIndexer data from registry indexer.
	LocalIndexer discovery.Indexer
}

AggregatorIndexer implements discovery.Indexer. AggregatorIndexer consists of multi Indexers and it decides which Indexer to use based on it's mechanism.

func NewAggregatorIndexer

func NewAggregatorIndexer(as *Aggregator) *AggregatorIndexer

func (*AggregatorIndexer) Creditable

func (i *AggregatorIndexer) Creditable() bool

Creditable implements discovery.Indexer.Creditable.

func (*AggregatorIndexer) Search

func (i *AggregatorIndexer) Search(ctx context.Context, opts ...registry.PluginOpOption) (resp *discovery.Response, err error)

Search implements discovery.Indexer.Search.

type Cache

type Cache []discovery.CacheReader

Cache implements CacheReader. Cache is a multi-CacheReader, it reads cache from all CacheReaders.

func (Cache) ForEach

func (c Cache) ForEach(iter func(k string, v *discovery.KeyValue) (next bool))

func (Cache) Get

func (c Cache) Get(k string) (kv *discovery.KeyValue)

func (Cache) GetAll

func (c Cache) GetAll(arr *[]*discovery.KeyValue) (s int)

func (Cache) GetPrefix

func (c Cache) GetPrefix(prefix string, arr *[]*discovery.KeyValue) (s int)

func (Cache) Name

func (c Cache) Name() string

func (Cache) Size

func (c Cache) Size() (s int)

type ConflictChecker

type ConflictChecker struct {
	Cache              discovery.CacheReader
	ConflictHandleFunc func(origin, conflict *discovery.KeyValue)
}

func NewConflictChecker

func NewConflictChecker(cache discovery.CacheReader, f func(origin, conflict *discovery.KeyValue)) *ConflictChecker

func (*ConflictChecker) Check

func (c *ConflictChecker) Check()

func (*ConflictChecker) Run

func (c *ConflictChecker) Run(ctx context.Context)

type Repository

type Repository struct {
}

func (*Repository) New

Jump to

Keyboard shortcuts

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