istio: istio.io/istio/mixer/pkg/runtime/dispatcher Index | Files

package dispatcher

import "istio.io/istio/mixer/pkg/runtime/dispatcher"

Package dispatcher is used to dispatch incoming requests to one or more handlers. The main entry point is the Impl struct, which implements the main dispatcher.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

Package Files

dispatcher.go dispatchstate.go reporter.go routingcontext.go session.go tracing.go util.go

type Dispatcher Uses

type Dispatcher interface {
    // Preprocess dispatches to the set of adapters that will run before any
    // other adapters in Mixer (aka: the Check, Report, Quota adapters).
    Preprocess(ctx context.Context, requestBag attribute.Bag, responseBag *attribute.MutableBag) error

    // Check dispatches to the set of adapters associated with the Check API method
    Check(ctx context.Context, requestBag attribute.Bag) (adapter.CheckResult, error)

    // GetReporter get an interface where reports are buffered.
    GetReporter(ctx context.Context) Reporter

    // Quota dispatches to the set of adapters associated with the Quota API method
    Quota(ctx context.Context, requestBag attribute.Bag,
        qma QuotaMethodArgs) (adapter.QuotaResult, error)
}

Dispatcher dispatches incoming API calls to configured adapters.

type Impl Uses

type Impl struct {
    // contains filtered or unexported fields
}

Impl is the runtime implementation of the Dispatcher interface.

func New Uses

func New(handlerGP *pool.GoroutinePool, enableTracing bool) *Impl

New returns a new Impl instance. The Impl instance is initialized with an empty routing table.

func (*Impl) ChangeRoute Uses

func (d *Impl) ChangeRoute(newTable *routing.Table) *RoutingContext

ChangeRoute changes the routing table on the Impl which, in turn, ends up creating a new RoutingContext.

func (*Impl) Check Uses

func (d *Impl) Check(ctx context.Context, bag attribute.Bag) (adapter.CheckResult, error)

Check implementation of runtime.Impl.

func (*Impl) GetReporter Uses

func (d *Impl) GetReporter(ctx context.Context) Reporter

GetReporter implementation of runtime.Impl.

func (*Impl) Preprocess Uses

func (d *Impl) Preprocess(ctx context.Context, bag attribute.Bag, responseBag *attribute.MutableBag) error

Preprocess implementation of runtime.Impl.

func (*Impl) Quota Uses

func (d *Impl) Quota(ctx context.Context, bag attribute.Bag, qma QuotaMethodArgs) (adapter.QuotaResult, error)

Quota implementation of runtime.Impl.

type QuotaMethodArgs Uses

type QuotaMethodArgs struct {
    // Used for deduplicating quota allocation/free calls in the case of
    // failed RPCs and retries. This should be a UUID per call, where the same
    // UUID is used for retries of the same quota allocation call.
    DeduplicationID string

    // The quota to allocate from.
    Quota string

    // The amount of quota to allocate.
    Amount int64

    // If true, allows a response to return less quota than requested. When
    // false, the exact requested amount is returned or 0 if not enough quota
    // was available.
    BestEffort bool
}

QuotaMethodArgs is supplied by invocations of the Quota method.

type Reporter Uses

type Reporter interface {
    // Report adds an entry to the report state
    Report(requestBag attribute.Bag) error

    // Flush dispatches all buffered state to the appropriate adapters.
    Flush() error

    // Completes use of the reporter
    Done()
}

Reporter is used to produce a series of reports

type RoutingContext Uses

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) GetRefs Uses

func (rc *RoutingContext) GetRefs() int32

GetRefs returns the current reference count on the dispatch context.

Package dispatcher imports 27 packages (graph) and is imported by 6 packages. Updated 2019-08-12. Refresh now. Tools for package owners.