Documentation
¶
Index ¶
- func DispatchTestCache(t testing.TB) cache.Cache[keys.DispatchCacheKey, any]
- type Dispatcher
- func (cd *Dispatcher) Close() error
- func (cd *Dispatcher) DispatchCheck(ctx context.Context, req *v1.DispatchCheckRequest) (*v1.DispatchCheckResponse, error)
- func (cd *Dispatcher) DispatchExpand(ctx context.Context, req *v1.DispatchExpandRequest) (*v1.DispatchExpandResponse, error)
- func (cd *Dispatcher) DispatchLookupResources2(req *v1.DispatchLookupResources2Request, ...) error
- func (cd *Dispatcher) DispatchLookupResources3(req *v1.DispatchLookupResources3Request, ...) error
- func (cd *Dispatcher) DispatchLookupSubjects(req *v1.DispatchLookupSubjectsRequest, stream dispatch.LookupSubjectsStream) error
- func (cd *Dispatcher) DispatchQueryPlan(req *v1.DispatchQueryPlanRequest, stream dispatch.PlanStream) error
- func (cd *Dispatcher) LookupPlanCheck(ctx context.Context, lookup dispatch.PlanCheckLookup) (*v1.ResultPath, bool, error)
- func (cd *Dispatcher) ReadyState() dispatch.ReadyState
- func (cd *Dispatcher) SetDelegate(delegate dispatch.Dispatcher)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DispatchTestCache ¶ added in v1.13.0
Types ¶
type Dispatcher ¶ added in v1.4.0
type Dispatcher struct {
// contains filtered or unexported fields
}
Dispatcher is a dispatcher with cacheInst-in caching.
func NewCachingDispatcher ¶
func NewCachingDispatcher(cacheInst cache.Cache[keys.DispatchCacheKey, any], prometheusmetrics dispatch.MetricsOptions, keyHandler keys.Handler) (*Dispatcher, error)
NewCachingDispatcher creates a new dispatch.Dispatcher which delegates dispatch requests and caches the responses when possible and desirable.
func (*Dispatcher) Close ¶ added in v1.4.0
func (cd *Dispatcher) Close() error
func (*Dispatcher) DispatchCheck ¶ added in v1.4.0
func (cd *Dispatcher) DispatchCheck(ctx context.Context, req *v1.DispatchCheckRequest) (*v1.DispatchCheckResponse, error)
DispatchCheck implements dispatch.Check interface
func (*Dispatcher) DispatchExpand ¶ added in v1.4.0
func (cd *Dispatcher) DispatchExpand(ctx context.Context, req *v1.DispatchExpandRequest) (*v1.DispatchExpandResponse, error)
DispatchExpand implements dispatch.Expand interface and does not do any caching yet.
func (*Dispatcher) DispatchLookupResources2 ¶ added in v1.35.0
func (cd *Dispatcher) DispatchLookupResources2(req *v1.DispatchLookupResources2Request, stream dispatch.LookupResources2Stream) error
func (*Dispatcher) DispatchLookupResources3 ¶ added in v1.45.4
func (cd *Dispatcher) DispatchLookupResources3(req *v1.DispatchLookupResources3Request, stream dispatch.LookupResources3Stream) error
func (*Dispatcher) DispatchLookupSubjects ¶ added in v1.12.0
func (cd *Dispatcher) DispatchLookupSubjects(req *v1.DispatchLookupSubjectsRequest, stream dispatch.LookupSubjectsStream) error
DispatchLookupSubjects implements dispatch.LookupSubjects interface.
func (*Dispatcher) DispatchQueryPlan ¶ added in v1.52.0
func (cd *Dispatcher) DispatchQueryPlan(req *v1.DispatchQueryPlanRequest, stream dispatch.PlanStream) error
func (*Dispatcher) LookupPlanCheck ¶ added in v1.54.0
func (cd *Dispatcher) LookupPlanCheck(ctx context.Context, lookup dispatch.PlanCheckLookup) (*v1.ResultPath, bool, error)
LookupPlanCheck probes the cache for a Plan-Check answer using a lightweight descriptor. This is the cache-hit fast path that avoids serializing the iterator subtree on the sender side: the executor calls this first, and only builds a full DispatchQueryPlanRequest (which is what forces plan serialization) when this misses.
On a hit we increment both queryPlanTotal and queryPlanFromCache so the cache hit ratio across LookupPlanCheck + DispatchQueryPlan stays sensible; on a miss we *do not* increment queryPlanTotal here — the caller will issue the full DispatchQueryPlan next, which counts the dispatch itself.
We also forward to the delegate on miss so a chain of caching dispatchers (rare today, but allowed by the layering) all get probed.
func (*Dispatcher) ReadyState ¶ added in v1.18.1
func (cd *Dispatcher) ReadyState() dispatch.ReadyState
func (*Dispatcher) SetDelegate ¶ added in v1.4.0
func (cd *Dispatcher) SetDelegate(delegate dispatch.Dispatcher)
SetDelegate sets the internal delegate to the specific dispatcher instance.