Documentation
¶
Index ¶
- func NewClusterDispatcher(client ClusterClient, conn *grpc.ClientConn, config ClusterDispatcherConfig, ...) (dispatch.Dispatcher, error)
- func RunDispatchExpr[R any](de *DispatchExpr, request R) ([]string, error)
- type ClusterClient
- type ClusterDispatcherConfig
- type DispatchExpr
- type SecondaryDispatch
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClusterDispatcher ¶
func NewClusterDispatcher(client ClusterClient, conn *grpc.ClientConn, config ClusterDispatcherConfig, secondaryDispatch map[string]SecondaryDispatch, secondaryDispatchExprs map[string]*DispatchExpr, startingPrimaryHedgingDelay time.Duration) (dispatch.Dispatcher, error)
NewClusterDispatcher creates a dispatcher implementation that uses the provided client to dispatch requests to peer nodes in the cluster.
func RunDispatchExpr ¶ added in v1.27.0
func RunDispatchExpr[R any](de *DispatchExpr, request R) ([]string, error)
RunDispatchExpr runs a dispatch CEL expression over the given request and returns the secondary dispatchers to invoke, if any.
Types ¶
type ClusterClient ¶ added in v1.27.0
type ClusterClient interface {
DispatchCheck(ctx context.Context, req *v1.DispatchCheckRequest, opts ...grpc.CallOption) (*v1.DispatchCheckResponse, error)
DispatchExpand(ctx context.Context, req *v1.DispatchExpandRequest, opts ...grpc.CallOption) (*v1.DispatchExpandResponse, error)
DispatchLookupResources2(ctx context.Context, in *v1.DispatchLookupResources2Request, opts ...grpc.CallOption) (v1.DispatchService_DispatchLookupResources2Client, error)
DispatchLookupResources3(ctx context.Context, in *v1.DispatchLookupResources3Request, opts ...grpc.CallOption) (v1.DispatchService_DispatchLookupResources3Client, error)
DispatchLookupSubjects(ctx context.Context, in *v1.DispatchLookupSubjectsRequest, opts ...grpc.CallOption) (v1.DispatchService_DispatchLookupSubjectsClient, error)
}
type ClusterDispatcherConfig ¶ added in v1.16.2
type DispatchExpr ¶ added in v1.27.0
type DispatchExpr struct {
// contains filtered or unexported fields
}
DispatchExpr is a CEL expression that can be run to determine the secondary dispatchers, if any, to invoke for the incoming request.
func ParseDispatchExpression ¶ added in v1.27.0
func ParseDispatchExpression(methodName string, exprString string) (*DispatchExpr, error)
ParseDispatchExpression parses a dispatch expression via CEL.
type SecondaryDispatch ¶ added in v1.27.0
type SecondaryDispatch struct {
// Name is the name of the secondary dispatcher.
Name string
// Client is the client to use for dispatching to the secondary.
Client ClusterClient
// MaximumHedgingDelay is the maximum delay that the primary will wait before dispatching
// when this secondary is active.
MaximumPrimaryHedgingDelay time.Duration
}
SecondaryDispatch defines a struct holding a client and its name for secondary dispatching.
Click to show internal directories.
Click to hide internal directories.