transport

package
v0.0.0-...-0611383 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2022 License: Apache-2.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 ChannelVersion

type ChannelVersion struct {
	V2 chan gcpv2.Response
	V3 chan gcpv3.Response
}

ChannelVersion wraps v2 and v3 response channels

type Locality

type Locality struct {
	Region  string
	Zone    string
	SubZone string
}

Locality is an interface to abstract the differences between the v2 and v3 Locality type

type Request

type Request interface {
	GetResourceNames() []string
	GetTypeURL() string
	GetVersionInfo() string
	GetNodeID() string
	GetNodeMetadata() *structpb.Struct
	GetCluster() string
	GetError() *status.Status
	GetLocality() *Locality
	GetResponseNonce() string
	GetRaw() *RequestVersion
	CreateWatch(scope tally.Scope) Watch
}

Request is the generic interface to abstract v2 and v3 DiscoveryRequest types

type RequestV2

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

RequestV2 is the v2.DiscoveryRequest impl of Request

func NewRequestV2

func NewRequestV2(r *discoveryv2.DiscoveryRequest) *RequestV2

NewRequestV2 creates a Request objects which wraps v2.DiscoveryRequest

func (*RequestV2) CreateWatch

func (r *RequestV2) CreateWatch(scope tally.Scope) Watch

CreateWatch creates a versioned Watch

func (*RequestV2) GetCluster

func (r *RequestV2) GetCluster() string

GetCluster gets the cluster name

func (*RequestV2) GetError

func (r *RequestV2) GetError() *status.Status

GetError gets the error details

func (*RequestV2) GetLocality

func (r *RequestV2) GetLocality() *Locality

GetLocality gets the node locality

func (*RequestV2) GetNodeID

func (r *RequestV2) GetNodeID() string

GetNodeID gets the node id

func (*RequestV2) GetNodeMetadata

func (r *RequestV2) GetNodeMetadata() *structpb.Struct

GetNodeMetadata gets version-agnostic node metadata

func (*RequestV2) GetRaw

func (r *RequestV2) GetRaw() *RequestVersion

GetRaw gets the error details

func (*RequestV2) GetResourceNames

func (r *RequestV2) GetResourceNames() []string

GetResourceNames gets the ResourceNames

func (*RequestV2) GetResponseNonce

func (r *RequestV2) GetResponseNonce() string

GetResponseNonce gets the error details

func (*RequestV2) GetTypeURL

func (r *RequestV2) GetTypeURL() string

GetTypeURL gets the error details

func (*RequestV2) GetVersionInfo

func (r *RequestV2) GetVersionInfo() string

GetVersionInfo gets the version info

type RequestV3

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

RequestV3 is the v2.DiscoveryRequest impl of Request

func NewRequestV3

func NewRequestV3(r *discoveryv3.DiscoveryRequest) *RequestV3

NewRequestV3 creates a Request objects which wraps v2.DiscoveryRequest

func (*RequestV3) CreateWatch

func (r *RequestV3) CreateWatch(scope tally.Scope) Watch

CreateWatch creates a versioned Watch

func (*RequestV3) GetCluster

func (r *RequestV3) GetCluster() string

GetCluster gets the cluster name

func (*RequestV3) GetError

func (r *RequestV3) GetError() *status.Status

GetError gets the error details

func (*RequestV3) GetLocality

func (r *RequestV3) GetLocality() *Locality

GetLocality gets the node locality

func (*RequestV3) GetNodeID

func (r *RequestV3) GetNodeID() string

GetNodeID gets the node id

func (*RequestV3) GetNodeMetadata

func (r *RequestV3) GetNodeMetadata() *structpb.Struct

GetNodeMetadata gets version-agnostic node metadata

func (*RequestV3) GetRaw

func (r *RequestV3) GetRaw() *RequestVersion

GetRaw gets the error details

func (*RequestV3) GetResourceNames

func (r *RequestV3) GetResourceNames() []string

GetResourceNames gets the ResourceNames

func (*RequestV3) GetResponseNonce

func (r *RequestV3) GetResponseNonce() string

GetResponseNonce gets the error details

func (*RequestV3) GetTypeURL

func (r *RequestV3) GetTypeURL() string

GetTypeURL gets the error details

func (*RequestV3) GetVersionInfo

func (r *RequestV3) GetVersionInfo() string

GetVersionInfo gets the version info

type RequestVersion

type RequestVersion struct {
	V2 *discoveryv2.DiscoveryRequest
	V3 *discoveryv3.DiscoveryRequest
}

RequestVersion holds either one of the v2/v3 DiscoveryRequests

type Response

type Response interface {
	GetPayloadVersion() string
	GetNonce() string
	GetTypeURL() string
	GetRequest() *RequestVersion
	Get() *ResponseVersion
	GetResources() []*any.Any
}

Response is the generic response interface

func NewResponseV2

NewResponseV2 creates a new instance of wrapped Response

func NewResponseV3

NewResponseV3 creates a new instance of wrapped Response

type ResponseV2

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

ResponseV2 is the v2.DiscoveryRequest impl of Response

func (*ResponseV2) Get

func (r *ResponseV2) Get() *ResponseVersion

Get returns the original discovery response

func (*ResponseV2) GetNonce

func (r *ResponseV2) GetNonce() string

GetNonce gets the response nonce

func (*ResponseV2) GetPayloadVersion

func (r *ResponseV2) GetPayloadVersion() string

GetPayloadVersion gets the api version

func (*ResponseV2) GetRequest

func (r *ResponseV2) GetRequest() *RequestVersion

GetRequest returns the original request associated with the response

func (*ResponseV2) GetResources

func (r *ResponseV2) GetResources() []*any.Any

GetResources returns the original discovery response

func (*ResponseV2) GetTypeURL

func (r *ResponseV2) GetTypeURL() string

GetTypeURL returns the typeUrl for the resource

type ResponseV3

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

ResponseV3 is the v3.DiscoveryRequest impl of Response

func (*ResponseV3) Get

func (r *ResponseV3) Get() *ResponseVersion

Get returns the original discovery response

func (*ResponseV3) GetNonce

func (r *ResponseV3) GetNonce() string

GetNonce gets the response nonce

func (*ResponseV3) GetPayloadVersion

func (r *ResponseV3) GetPayloadVersion() string

GetPayloadVersion gets the api version

func (*ResponseV3) GetRequest

func (r *ResponseV3) GetRequest() *RequestVersion

GetRequest returns the original request associated with the response

func (*ResponseV3) GetResources

func (r *ResponseV3) GetResources() []*any.Any

GetResources returns the original discovery response

func (*ResponseV3) GetTypeURL

func (r *ResponseV3) GetTypeURL() string

GetTypeURL returns the typeUrl for the resource

type ResponseVersion

type ResponseVersion struct {
	V2 *discoveryv2.DiscoveryResponse
	V3 *discoveryv3.DiscoveryResponse
}

ResponseVersion holds either one of the v2/v3 DiscoveryRequests

type Stream

type Stream interface {
	SendMsg(version string, nonce string, metadata string) error
	RecvMsg() (Response, error)
	CloseSend() error
}

Stream abstracts the grpc client stream and DiscoveryRequest/Response

func NewStreamV2

func NewStreamV2(clientStream grpc.ClientStream, req Request, l log.Logger) Stream

NewStreamV2 creates a new wrapped transport stream

func NewStreamV3

func NewStreamV3(clientStream grpc.ClientStream, req Request, l log.Logger) Stream

NewStreamV3 creates a new wrapped transport stream

type Watch

type Watch interface {
	// Close is idempotent with Send.
	// When Close and Send are called from separate goroutines they are guaranteed to not panic
	// Close waits until all Send operations drain.
	Close()
	GetChannel() *ChannelVersion
	// Send is a mutex protected function to send responses to the downstream sidecars.
	// It provides guarantee to never panic when called in tandem with Close from separate
	// goroutines. This also guarantees that stale responses are dropped in the event that a
	// newer response arrives.
	Send(Response) error
}

Watch interface abstracts v2 and v3 watches to the downstream sidecars.

Jump to

Keyboard shortcuts

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