routing

package
v2.1.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2019 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchedIngressClient

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

BatchedIngressClient batches envelopes before sending it. Each invocation to Send is async.

func NewBatchedIngressClient

func NewBatchedIngressClient(
	size int,
	interval time.Duration,
	c rpc.IngressClient,
	m Metrics,
	log *log.Logger,
) *BatchedIngressClient

NewBatchedIngressClient returns a new BatchedIngressClient.

func (*BatchedIngressClient) Send

Send batches envelopes before shipping them to the client.

type EgressReverseProxy

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

EgressReverseProxy is a reverse proxy for Egress requests.

func NewEgressReverseProxy

func NewEgressReverseProxy(
	l Lookup,
	clients []rpc.EgressClient,
	localIdx int,
	log *log.Logger,
	opts ...EgressReverseProxyOption,
) *EgressReverseProxy

NewEgressReverseProxy returns a new EgressReverseProxy. LocalIdx is required to know where to find the local node for meta lookups.

func (*EgressReverseProxy) Meta

Meta will gather meta from the local store and remote nodes.

func (*EgressReverseProxy) Read

Read will either read from the local node or remote nodes.

type EgressReverseProxyOption

type EgressReverseProxyOption func(e *EgressReverseProxy)

func WithMetaCacheDuration

func WithMetaCacheDuration(d time.Duration) EgressReverseProxyOption

WithMetaCacheDuration is a EgressReverseProxyOption to configure how long to cache results from the Meta endpoint.

type IngressClientFunc

type IngressClientFunc func(ctx context.Context, r *rpc.SendRequest, opts ...grpc.CallOption) (*rpc.SendResponse, error)

IngressClientFunc transforms a function into an IngressClient.

func (IngressClientFunc) Send

Send implements an IngressClient.

type IngressReverseProxy

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

IngressReverseProxy is a reverse proxy for Ingress requests.

func NewIngressReverseProxy

func NewIngressReverseProxy(
	l Lookup,
	clients []rpc.IngressClient,
	localIdx int,
	log *log.Logger,
) *IngressReverseProxy

NewIngressReverseProxy returns a new IngressReverseProxy.

func (*IngressReverseProxy) Send

Send will send to either the local node or the correct remote node according to its source ID.

type LocalStoreReader

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

LocalStoreReader accesses a store via gRPC calls. It handles converting the requests into a form that the store understands for reading.

func NewLocalStoreReader

func NewLocalStoreReader(s StoreReader) *LocalStoreReader

NewLocalStoreReader creates and returns a new LocalStoreReader.

func (*LocalStoreReader) Meta

func (*LocalStoreReader) Read

Read returns data from the store.

type Lookup

type Lookup func(sourceID string) []int

Lookup is used to find which Clients a source ID should be routed to.

type Metrics

type Metrics interface {
	// NewCounter returns a func that can be used to increment a counter
	// metric.
	NewCounter(name string) func(delta uint64)
}

Metrics registers new Counter metrics.

type OrchestratorAgent

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

OrchestratorAgent manages the Log Cache node's routes.

func NewOrchestratorAgent

func NewOrchestratorAgent(s RangeSetter) *OrchestratorAgent

NewOrchestratorAgent returns a new OrchestratorAgent.

func (*OrchestratorAgent) AddRange

AddRange adds a range (from the scheduler) for data to be routed to.

func (*OrchestratorAgent) ListRanges

ListRanges returns all the ranges that are currently active.

func (*OrchestratorAgent) RemoveRange

RemoveRange removes a range (form the scheduler) for the data to be routed to.

func (*OrchestratorAgent) SetRanges

SetRanges passes them along to the RangeSetter.

type Range

type Range struct {
	Start uint64
	End   uint64
}

func (*Range) CloneRpcRange

func (sr *Range) CloneRpcRange(r *rpc.Range)

func (*Range) ToRpcRange

func (sr *Range) ToRpcRange() *rpc.Range

type RangeSetter

type RangeSetter interface {
	// SetRanges is used as a pass through for the orchestration service's
	// SetRanges method.
	SetRanges(ctx context.Context, in *rpc.SetRangesRequest) (*rpc.SetRangesResponse, error)
}

type RoutingTable

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

RoutingTable makes decisions for where a item should be routed.

func NewRoutingTable

func NewRoutingTable(addrs []string, hasher func(string) uint64) *RoutingTable

NewRoutingTable returns a new RoutingTable.

func (*RoutingTable) Lookup

func (t *RoutingTable) Lookup(item string) []int

Lookup takes a item, hash it and determine what node it should be routed to.

func (*RoutingTable) LookupAll

func (t *RoutingTable) LookupAll(item string) []int

LookupAll returns every index that has a range where the item would fall under.

func (*RoutingTable) SetRanges

SetRanges sets the routing table.

type StaticLookup

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

StaticLookup is used to do lookup for static routes.

func NewStaticLookup

func NewStaticLookup(numOfRoutes int, hasher func(string) uint64) *StaticLookup

NewStaticLookup creates and returns a StaticLookup.

func (*StaticLookup) Lookup

func (l *StaticLookup) Lookup(sourceID string) int

Lookup hashes the SourceId and then returns the index that is in range of the hash.

type StoreReader

type StoreReader interface {
	// Gets envelopes from a local or remote Log Cache.
	Get(
		sourceID string,
		start time.Time,
		end time.Time,
		envelopeTypes []logcache_v1.EnvelopeType,
		nameFilter *regexp.Regexp,
		limit int,
		descending bool,
	) []*loggregator_v2.Envelope

	// Meta gets the metadata from Log Cache instances in the cluster.
	Meta() map[string]logcache_v1.MetaInfo
}

StoreReader proxies to the log cache for getting envelopes or Log Cache Metadata.

Jump to

Keyboard shortcuts

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