Skip to content

Commit

Permalink
Allow injectors and extractors to be separate interfaces (#578)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwear authored Apr 30, 2020
1 parent c03fe50 commit e7fe34a
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions specification/context/api-propagators.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,22 @@ Required arguments:

The Get function is responsible for handling case sensitivity. If the getter is intended to work with a HTTP request object, the getter MUST be case insensitive. To improve compatibility with other text-based protocols, text `Format` implementions MUST ensure to always use the canonical casing for their attributes. NOTE: Cannonical casing for HTTP headers is usually title case (e.g. `Content-Type` instead of `content-type`).

## Injectors and Extractors as Separate Interfaces

Languages can choose to implement a `Propagator` for a format as a single object
exposing `Inject` and `Extract` methods, or they can opt to divide the
responsibilities further into individual `Injector`s and `Extractor`s. A
`Propagator` can be implemented by composing individual `Injector`s and
`Extractors`.

## Composite Propagator

Implementations MUST offer a facility to group multiple `Propagator`s
from different cross-cutting concerns in order to leverage them as a
single entity.

The resulting composite `Propagator` will invoke the `Propagators`
in the order they were specified.
A composite propagator can be built from a list of propagators, or a list of
injectors and extractors. The resulting composite `Propagator` will invoke the `Propagator`s, `Injector`s, or `Extractor`s, in the order they were specified.

Each composite `Propagator` will be bound to a specific `Format`, such
as `HttpTextFormat`, as different `Format`s will likely operate on different
Expand All @@ -161,7 +169,7 @@ There MUST be functions to accomplish the following operations.

Required arguments:

- A list of `Propagator`s.
- A list of `Propagator`s or a list of `Injector`s and `Extractor`s.

Returns a new composite `Propagator` with the specified `Propagator`s.

Expand Down

0 comments on commit e7fe34a

Please sign in to comment.