Documentation
¶
Index ¶
- Variables
- func CheckDepth(ctx context.Context, req HasMetadata) error
- func CheckRequestToKey(req *v1.DispatchCheckRequest) string
- func CheckRequestToKeyWithCanonical(req *v1.DispatchCheckRequest, canonicalKey string) string
- func ExpandRequestToKey(req *v1.DispatchExpandRequest) string
- func LookupRequestToKey(req *v1.DispatchLookupRequest) string
- func ReachableResourcesRequestToKey(req *v1.DispatchReachableResourcesRequest) string
- type Check
- type CollectingDispatchStream
- type Dispatcher
- type Expand
- type HasMetadata
- type Lookup
- type ReachableResources
- type ReachableResourcesStream
- type Stream
- type WrappedDispatchStream
Constants ¶
This section is empty.
Variables ¶
var ErrMaxDepth = errors.New("max depth exceeded: this usually indicates a recursive or too deep data dependency")
ErrMaxDepth is returned from CheckDepth when the max depth is exceeded.
Functions ¶
func CheckDepth ¶
func CheckDepth(ctx context.Context, req HasMetadata) error
CheckDepth returns ErrMaxDepth if there is insufficient depth remaining to dispatch.
func CheckRequestToKey ¶ added in v1.2.0
func CheckRequestToKey(req *v1.DispatchCheckRequest) string
CheckRequestToKey converts a check request into a cache key based on the relation
func CheckRequestToKeyWithCanonical ¶ added in v1.7.0
func CheckRequestToKeyWithCanonical(req *v1.DispatchCheckRequest, canonicalKey string) string
CheckRequestToKeyWithCanonical converts a check request into a cache key based on the canonical key.
func ExpandRequestToKey ¶ added in v1.2.0
func ExpandRequestToKey(req *v1.DispatchExpandRequest) string
ExpandRequestToKey converts an expand request into a cache key
func LookupRequestToKey ¶ added in v1.2.0
func LookupRequestToKey(req *v1.DispatchLookupRequest) string
LookupRequestToKey converts a lookup request into a cache key
func ReachableResourcesRequestToKey ¶ added in v1.8.0
func ReachableResourcesRequestToKey(req *v1.DispatchReachableResourcesRequest) string
ReachableResourcesRequestToKey converts a reachable resources request into a cache key
Types ¶
type Check ¶
type Check interface {
// DispatchCheck submits a single check request and returns its result.
DispatchCheck(ctx context.Context, req *v1.DispatchCheckRequest) (*v1.DispatchCheckResponse, error)
}
Check interface describes just the methods required to dispatch check requests.
type CollectingDispatchStream ¶ added in v1.8.0
type CollectingDispatchStream[T any] struct { // contains filtered or unexported fields }
CollectingDispatchStream is a dispatch stream that collects results in memory.
func NewCollectingDispatchStream ¶ added in v1.8.0
func NewCollectingDispatchStream[T any](ctx context.Context) *CollectingDispatchStream[T]
NewCollectingDispatchStream creates a new CollectingDispatchStream.
func (*CollectingDispatchStream[T]) Context ¶ added in v1.8.0
func (s *CollectingDispatchStream[T]) Context() context.Context
func (*CollectingDispatchStream[T]) Publish ¶ added in v1.8.0
func (s *CollectingDispatchStream[T]) Publish(result T) error
func (*CollectingDispatchStream[T]) Results ¶ added in v1.8.0
func (s *CollectingDispatchStream[T]) Results() []T
type Dispatcher ¶
type Dispatcher interface {
Check
Expand
Lookup
ReachableResources
// Close closes the dispatcher.
Close() error
}
Dispatcher interface describes a method for passing subchecks off to additional machines.
type Expand ¶
type Expand interface {
// DispatchExpand submits a single expand request and returns its result.
DispatchExpand(ctx context.Context, req *v1.DispatchExpandRequest) (*v1.DispatchExpandResponse, error)
}
Expand interface describes just the methods required to dispatch expand requests.
type HasMetadata ¶
type HasMetadata interface {
zerolog.LogObjectMarshaler
GetMetadata() *v1.ResolverMeta
}
HasMetadata is an interface for requests containing resolver metadata.
type Lookup ¶
type Lookup interface {
// DispatchLookup submits a single lookup request and returns its result.
DispatchLookup(ctx context.Context, req *v1.DispatchLookupRequest) (*v1.DispatchLookupResponse, error)
}
Lookup interface describes just the methods required to dispatch lookup requests.
type ReachableResources ¶ added in v1.8.0
type ReachableResources interface {
// DispatchReachableResources submits a single reachable resources request, writing its results to the specified stream.
DispatchReachableResources(
req *v1.DispatchReachableResourcesRequest,
stream ReachableResourcesStream,
) error
}
ReachableResources interface describes just the methods required to dispatch reachable resources requests.
type ReachableResourcesStream ¶ added in v1.8.0
type ReachableResourcesStream = Stream[*v1.DispatchReachableResourcesResponse]
ReachableResourcesStream is an alias for the stream to which reachable resources will be written.
type Stream ¶ added in v1.8.0
type Stream[T any] interface { // Publish publishes the result to the stream. Publish(T) error // Context returns the context for the stream. Context() context.Context }
Stream defines the interface generically matching a streaming dispatch response.
func StreamWithContext ¶ added in v1.8.0
StreamWithContext returns the given dispatch stream, wrapped to return the given context.
func WrapGRPCStream ¶ added in v1.8.0
WrapGRPCStream wraps a gRPC result stream with a concurrent-safe dispatch stream. This is necessary because gRPC response streams are *not concurrent safe*. See: https://groups.google.com/g/grpc-io/c/aI6L6M4fzQ0?pli=1
type WrappedDispatchStream ¶ added in v1.8.0
type WrappedDispatchStream[T any] struct { Stream Stream[T] Ctx context.Context Processor func(result T) (T, error) }
WrappedDispatchStream is a dispatch stream that wraps another dispatch stream, and performs an operation on each result before puppeting back up to the parent stream.
func (*WrappedDispatchStream[T]) Context ¶ added in v1.8.0
func (s *WrappedDispatchStream[T]) Context() context.Context
func (*WrappedDispatchStream[T]) Publish ¶ added in v1.8.0
func (s *WrappedDispatchStream[T]) Publish(result T) error