istio: istio.io/istio/pkg/mcp/source Index | Files

package source

import "istio.io/istio/pkg/mcp/source"

Index

Package Files

client_source.go server_source.go source.go

type AuthChecker Uses

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 Uses

type CancelWatchFunc func()

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

type Client Uses

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 Uses

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

NewClient returns a new instance of Client.

func (*Client) Run Uses

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

Run implements mcpClient

type CollectionOptions Uses

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 Uses

func CollectionOptionsFromSlice(names []string) []CollectionOptions

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

type Options Uses

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

Options contains options for configuring MCP sources.

type PushResponseFunc Uses

type PushResponseFunc func(*WatchResponse)

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

type Request Uses

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 Uses

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 Uses

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

NewServer creates a new instance of a MCP source server.

func (*Server) EstablishResourceStream Uses

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

EstablishResourceStream implements the ResourceSourceServer interface.

type ServerOptions Uses

type ServerOptions struct {
    AuthChecker AuthChecker
    RateLimiter rate.Limit
    Metadata    metadata.MD
}

ServerOptions contains sink server specific options

type Source Uses

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 Uses

func New(options *Options) *Source

New creates a new resource source.

func (*Source) ProcessStream Uses

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

type Stream Uses

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 Uses

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 Uses

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, string) 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.

Package source imports 17 packages (graph) and is imported by 6 packages. Updated 2019-08-14. Refresh now. Tools for package owners.