source

package
v0.0.0-...-1a56975 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthChecker

type AuthChecker interface {
	Check(authInfo credentials.AuthInfo) error
}

AuthChecker is used to check the transport auth info that is associated with each stream. If the function returns nil, then the connection will be allowed. If the function returns an error, then it will be percolated up to the gRPC stack.

Note that it is possible that this method can be called with nil authInfo. This can happen either if there is no peer info, or if the underlying gRPC stream is insecure. The implementations should be resilient in this case and apply appropriate policy.

type CancelWatchFunc

type CancelWatchFunc func()

CancelWatchFunc allows the consumer to cancel a previous watch, terminating the watch for the request.

type Client

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

Client implements the client for the MCP sink service. The client is the source of configuration and sends configuration to the server.

func NewClient

func NewClient(client mcp.ResourceSinkClient, options *Options) *Client

NewClient returns a new instance of Client.

func (*Client) Run

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

Run implements mcpClient

type CollectionOptions

type CollectionOptions struct {
	// Name of the collection, e.g. istio/networking/v1alpha3/VirtualService
	Name string

	// When true, the source is allowed to push incremental updates to the sink.
	// Incremental updates are only used if the sink requests it (per request)
	// and the source decides to make use of it.
	Incremental bool
}

CollectionOptions configures the per-collection updates.

func CollectionOptionsFromSlice

func CollectionOptionsFromSlice(names []string) []CollectionOptions

CollectionOptionsFromSlice returns a slice of collection options from a slice of collection names.

type Options

type Options struct {
	Watcher            Watcher
	CollectionsOptions []CollectionOptions
	Reporter           monitoring.Reporter
	ConnRateLimiter    rate.LimitFactory
}

Options contains options for configuring MCP sources.

type PushResponseFunc

type PushResponseFunc func(*WatchResponse)

PushResponseFunc allows the consumer to push a response for the corresponding watch.

type Request

type Request struct {
	Collection string

	// Most recent version was that ACK/NACK'd by the sink
	VersionInfo string
	SinkNode    *mcp.SinkNode
	// contains filtered or unexported fields
}

Request is a temporary abstraction for the MCP node request which can be used with the mcp.MeshConfigRequest and mcp.RequestResources. It can be removed once we fully cutover to mcp.RequestResources.

type Server

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

Server implements the server for the MCP source service. The server is the source of configuration and sends configuration to the client.

func NewServer

func NewServer(srcOptions *Options, serverOptions *ServerOptions) *Server

NewServer creates a new instance of a MCP source server.

func (*Server) EstablishResourceStream

func (s *Server) EstablishResourceStream(stream mcp.ResourceSource_EstablishResourceStreamServer) error

EstablishResourceStream implements the ResourceSourceServer interface.

type ServerOptions

type ServerOptions struct {
	AuthChecker AuthChecker
	RateLimiter rate.Limit
}

ServerOptions contains sink server specific options

type Source

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

Source implements the resource source message exchange for MCP. It can be instantiated by client and server

func New

func New(options *Options) *Source

New creates a new resource source.

func (*Source) ProcessStream

func (s *Source) ProcessStream(stream Stream) error

type Stream

type Stream interface {
	Send(*mcp.Resources) error
	Recv() (*mcp.RequestResources, error)
	Context() context.Context
}

Stream is for sending Resource messages and receiving RequestResources messages.

type WatchResponse

type WatchResponse struct {
	Collection string

	// Version of the resources in the response for the given
	// type. The node responses with this version in subsequent
	// requests as an acknowledgment.
	Version string

	// Resourced resources to be included in the response.
	Resources []*mcp.Resource

	// The original request for triggered this response
	Request *Request
}

WatchResponse contains a versioned collection of pre-serialized resources.

type Watcher

type Watcher interface {
	// Watch returns a new open watch for a non-empty request.
	//
	// Cancel is an optional function to release resources in the
	// producer. It can be called idempotently to cancel and release resources.
	Watch(*Request, PushResponseFunc) CancelWatchFunc
}

Watcher requests watches for configuration resources by node, last applied version, and type. The watch should send the responses when they are ready. The watch can be canceled by the consumer.

Jump to

Keyboard shortcuts

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