discoveryservice

package
v0.7.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

Cache implements "github.com/3scale/marin3r/pkg/discoveryservice/xdss".Cache for envoy API v3.

func NewCache

func NewCache(v3 cache_v3.SnapshotCache) Cache

NewCache returns a Cache object.

func (Cache) ClearSnapshot

func (c Cache) ClearSnapshot(nodeID string)

ClearSnapshot clears snapshot and info for a node.

func (Cache) GetSnapshot

func (c Cache) GetSnapshot(nodeID string) (xdss.Snapshot, error)

GetSnapshot gets the snapshot for a node, and returns an error if not found.

func (Cache) NewSnapshot

func (c Cache) NewSnapshot(resourcesVersion string) xdss.Snapshot

NewSnapshot returns a Snapshot object

func (Cache) SetSnapshot

func (c Cache) SetSnapshot(nodeID string, snap xdss.Snapshot) error

SetSnapshot updates a snapshot for a node.

type Callbacks

type Callbacks struct {
	OnError       func(nodeID, previousVersion, msg string, envoyAPI envoy.APIVersion) error
	SnapshotCache *cache_v3.SnapshotCache
	Logger        logr.Logger
}

Callbacks is a type that implements go-control-plane/pkg/server/Callbacks

func (*Callbacks) OnFetchRequest

OnFetchRequest implements go-control-plane/pkg/server/Callbacks.OnFetchRequest OnFetchRequest is called for each Fetch request. Returning an error will end processing of the request and respond with an error.

func (*Callbacks) OnFetchResponse

OnFetchResponse implements go-control-plane/pkg/server/Callbacks.OnFetchRequest OnFetchResponse is called immediately prior to sending a response.

func (*Callbacks) OnStreamClosed

func (cb *Callbacks) OnStreamClosed(id int64)

OnStreamClosed implements go-control-plane/pkg/server/Callbacks.OnStreamClosed OnStreamClosed is called immediately prior to closing an xDS stream with a stream ID.

func (*Callbacks) OnStreamOpen

func (cb *Callbacks) OnStreamOpen(ctx context.Context, id int64, typ string) error

OnStreamOpen implements go-control-plane/pkg/server/Callbacks.OnStreamOpen Returning an error will end processing and close the stream. OnStreamClosed will still be called.

func (*Callbacks) OnStreamRequest

func (cb *Callbacks) OnStreamRequest(id int64, req *envoy_service_discovery_v3.DiscoveryRequest) error

OnStreamRequest implements go-control-plane/pkg/server/Callbacks.OnStreamRequest OnStreamRequest is called once a request is received on a stream. Returning an error will end processing and close the stream. OnStreamClosed will still be called.

func (*Callbacks) OnStreamResponse

OnStreamResponse implements go-control-plane/pkgserver/Callbacks.OnStreamResponse OnStreamResponse is called immediately prior to sending a response on a stream.

type Snapshot

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

Snapshot implements "github.com/3scale/marin3r/pkg/discoveryservice/xdss".Snapshot for envoy API v3.

func NewSnapshot

func NewSnapshot(v3 *cache_v3.Snapshot) Snapshot

NewSnapshot returns a Snapshot object.

func (Snapshot) Consistent

func (s Snapshot) Consistent() error

Consistent check verifies that the dependent resources are exactly listed in the snapshot: - all EDS resources are listed by name in CDS resources - all RDS resources are listed by name in LDS resources

Note that clusters and listeners are requested without name references, so Envoy will accept the snapshot list of clusters as-is even if it does not match all references found in xDS.

func (Snapshot) GetResources

func (s Snapshot) GetResources(rType envoy.Type) map[string]envoy.Resource

GetResources selects snapshot resources by type.

func (Snapshot) GetVersion

func (s Snapshot) GetVersion(rType envoy.Type) string

GetVersion returns the version for a resource type.

func (Snapshot) SetResource

func (s Snapshot) SetResource(name string, res envoy.Resource)

SetResource writes the given v2 resource in the Snapshot object.

func (Snapshot) SetVersion

func (s Snapshot) SetVersion(rType envoy.Type, version string)

SetVersion sets the version for a resource type.

Jump to

Keyboard shortcuts

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