Documentation ¶
Overview ¶
Package dispatcher is used to dispatch incoming requests to one or more handlers. The main entry point is the Dispatcher struct, which implements the main runtime.Dispatcher interface.
Once the dispatcher receives a request, it acquires the current routing table, and uses it until the end of the request. Additionally, it acquires an executor from a pool, which is used to perform and track the parallel calls that will be performed against the handlers. The executors scatter the calls
Index ¶
- type Dispatcher
- func (d *Dispatcher) ChangeRoute(new *routing.Table) *RoutingContext
- func (d *Dispatcher) Check(ctx context.Context, bag attribute.Bag) (*adapter.CheckResult, error)
- func (d *Dispatcher) Preprocess(ctx context.Context, bag attribute.Bag, responseBag *attribute.MutableBag) error
- func (d *Dispatcher) Quota(ctx context.Context, bag attribute.Bag, qma *runtime.QuotaMethodArgs) (*adapter.QuotaResult, error)
- func (d *Dispatcher) Report(ctx context.Context, bag attribute.Bag) error
- type RoutingContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
Dispatcher is the runtime2 implementation of the runtime.Dispatcher interface.
func New ¶
func New(identityAttribute string, handlerGP *pool.GoroutinePool, enableTracing bool) *Dispatcher
New returns a new Dispatcher instance. The Dispatcher instance is initialized with an empty routing table.
func (*Dispatcher) ChangeRoute ¶
func (d *Dispatcher) ChangeRoute(new *routing.Table) *RoutingContext
ChangeRoute changes the routing table on the Dispatcher which, in turn, ends up creating a new RoutingContext.
func (*Dispatcher) Check ¶
func (d *Dispatcher) Check(ctx context.Context, bag attribute.Bag) (*adapter.CheckResult, error)
Check implementation of runtime.Dispatcher.
func (*Dispatcher) Preprocess ¶
func (d *Dispatcher) Preprocess(ctx context.Context, bag attribute.Bag, responseBag *attribute.MutableBag) error
Preprocess implementation of runtime.Dispatcher.
func (*Dispatcher) Quota ¶
func (d *Dispatcher) Quota(ctx context.Context, bag attribute.Bag, qma *runtime.QuotaMethodArgs) (*adapter.QuotaResult, error)
Quota implementation of runtime.Dispatcher.
type RoutingContext ¶
type RoutingContext struct { // the routing table of this context. Routes *routing.Table // contains filtered or unexported fields }
RoutingContext is the currently active dispatching context, based on a config snapshot. As config changes, the current/live RoutingContext also changes.
func (*RoutingContext) DecRef ¶
func (t *RoutingContext) DecRef()
DecRef decreases the reference count on the RoutingContext.
func (*RoutingContext) GetRefs ¶
func (t *RoutingContext) GetRefs() int32
GetRefs returns the current reference count on the dispatch context.
func (*RoutingContext) IncRef ¶
func (t *RoutingContext) IncRef()
IncRef increases the reference count on the RoutingContext.