Documentation ¶
Index ¶
- Variables
- type AllowAllChecker
- type AuthChecker
- type CancelWatchFunc
- type ListAuthChecker
- type PushResponseFunc
- type Reporter
- type Server
- type StatsContext
- func (s *StatsContext) RecordRecvError(err error, code codes.Code)
- func (s *StatsContext) RecordRequestAck(typeURL string, connectionID int64)
- func (s *StatsContext) RecordRequestNack(typeURL string, connectionID int64)
- func (s *StatsContext) RecordRequestSize(typeURL string, connectionID int64, size int)
- func (s *StatsContext) RecordSendError(err error, code codes.Code)
- func (s *StatsContext) SetClientsTotal(clients int64)
- type WatchResponse
- type Watcher
Constants ¶
This section is empty.
Variables ¶
var ( // TypeURLTag holds the type URL for the context. TypeURLTag tag.Key // ErrorCodeTag holds the gRPC error code for the context. ErrorCodeTag tag.Key // ErrorTag holds the error string for the context. ErrorTag tag.Key // ConnectionIDTag holds the connection ID for the context. ConnectionIDTag tag.Key )
Functions ¶
This section is empty.
Types ¶
type AllowAllChecker ¶
type AllowAllChecker struct{}
AllowAllChecker is a simple auth checker that allows all requests.
func (*AllowAllChecker) Check ¶
func (*AllowAllChecker) Check(credentials.AuthInfo) error
Check is an implementation of AuthChecker.Check that allows all check requests.
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.
func NewAllowAllChecker ¶
func NewAllowAllChecker() AuthChecker
NewAllowAllChecker creates a new AllowAllChecker.
type CancelWatchFunc ¶
type CancelWatchFunc func()
CancelWatchFunc allows the consumer to cancel a previous watch, terminating the watch for the request.
type ListAuthChecker ¶
type ListAuthChecker struct {
// contains filtered or unexported fields
}
ListAuthChecker implements AuthChecker function and is backed by a set of ids.
func NewListAuthChecker ¶
func NewListAuthChecker() *ListAuthChecker
NewListAuthChecker returns a new instance of ListAuthChecker
func (*ListAuthChecker) Add ¶
func (l *ListAuthChecker) Add(id string)
Add the provided id to the list of allowed ids.
func (*ListAuthChecker) Allowed ¶
func (l *ListAuthChecker) Allowed(id string) bool
Allowed checks whether the given id is allowed.
func (*ListAuthChecker) Check ¶
func (l *ListAuthChecker) Check(authInfo credentials.AuthInfo) error
Check is an implementation of AuthChecker.Check.
func (*ListAuthChecker) Remove ¶
func (l *ListAuthChecker) Remove(id string)
Remove the provided id from the list of allowed ids.
func (*ListAuthChecker) Set ¶
func (l *ListAuthChecker) Set(ids ...string)
Set new sets of ids. Previous ones are removed.
func (*ListAuthChecker) String ¶
func (l *ListAuthChecker) String() string
String is an implementation of Stringer.String.
type PushResponseFunc ¶
type PushResponseFunc func(*WatchResponse)
PushResponseFunc allows the consumer to push a response for the corresponding watch.
type Reporter ¶
type Reporter interface { SetClientsTotal(clients int64) RecordSendError(err error, code codes.Code) RecordRecvError(err error, code codes.Code) RecordRequestSize(typeURL string, connectionID int64, size int) RecordRequestAck(typeURL string, connectionID int64) RecordRequestNack(typeURL string, connectionID int64) }
Reporter is used to report metrics for an MCP server.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server implements the Mesh Configuration Protocol (MCP) gRPC server.
func New ¶
func New(watcher Watcher, supportedTypes []string, authChecker AuthChecker, reporter Reporter) *Server
New creates a new gRPC server that implements the Mesh Configuration Protocol (MCP).
func (*Server) IncrementalAggregatedResources ¶
func (s *Server) IncrementalAggregatedResources(stream mcp.AggregatedMeshConfigService_IncrementalAggregatedResourcesServer) error
IncrementalAggregatedResources implements bidirectional streaming method for incremental MCP.
func (*Server) StreamAggregatedResources ¶
func (s *Server) StreamAggregatedResources(stream mcp.AggregatedMeshConfigService_StreamAggregatedResourcesServer) error
StreamAggregatedResources implements bidirectional streaming method for MCP.
type StatsContext ¶
type StatsContext struct {
// contains filtered or unexported fields
}
StatsContext enables metric collection backed by OpenCensus.
func NewStatsContext ¶
func NewStatsContext(prefix string) *StatsContext
NewStatsContext creates a new context for recording metrics using OpenCensus. The specified prefix is prepended to all metric names and must be a non-empty string.
func (*StatsContext) RecordRecvError ¶
func (s *StatsContext) RecordRecvError(err error, code codes.Code)
RecordRecvError records an error during a network recv with its error string and code.
func (*StatsContext) RecordRequestAck ¶
func (s *StatsContext) RecordRequestAck(typeURL string, connectionID int64)
RecordRequestAck records an ACK message for a type URL on a connection.
func (*StatsContext) RecordRequestNack ¶
func (s *StatsContext) RecordRequestNack(typeURL string, connectionID int64)
RecordRequestNack records a NACK message for a type URL on a connection.
func (*StatsContext) RecordRequestSize ¶
func (s *StatsContext) RecordRequestSize(typeURL string, connectionID int64, size int)
RecordRequestSize records the size of a request from a connection for a specific type URL.
func (*StatsContext) RecordSendError ¶
func (s *StatsContext) RecordSendError(err error, code codes.Code)
RecordSendError records an error during a network send with its error string and code.
func (*StatsContext) SetClientsTotal ¶
func (s *StatsContext) SetClientsTotal(clients int64)
SetClientsTotal updates the current client count to the given argument.
type WatchResponse ¶
type WatchResponse struct { TypeURL string // Version of the resources in the response for the given // type. The client responses with this version in subsequent // requests as an acknowledgment. Version string // Enveloped resources to be included in the response. Envelopes []*mcp.Envelope }
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(*mcp.MeshConfigRequest, 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.