OpenXRI:ServerPipelineArchitecture
From I-names Development Wiki
Contents |
Pipeline Architecture
This page describes the Pipeline Architecture, which is a central concept of the OpenXRI Server's main functionality (storing and serving XRDS documents). This architecture makes server operations easy to understand and flexible.
Overview
The basic idea is that the server maintains two "pipelines", each of which consists of a number of "stages" in a particular order.
>>> The purpose of a pipeline is to assemble an XRD. <<<
Every stage on the pipeline can manipulate the XRD. The XRD produced by one stage becomes the input for the next stage, until all stages are executed and the pipeline therefore completed.
One of the pipelines is called CREATE, the other LOOKUP.
The CREATE pipeline
The job of the CREATE pipeline is to assemble an XRD, which goes into the store. This pipeline is executed whenever a NEW authority (usually with an associated subsegment that resolves to it) is created!
At the beginning of this process, an inital XRD (provided by the calling application or the OpenXRI server web interface) is sent into the pipeline. This initial XRD could be empty, or contain some service endpoints, whatever data the calling application wants to associate with the new authority.
Whatever comes out at the end of the pipeline is considered to be the authority's XRD and goes into the store.
The basic idea of the CREATE pipeline is therefore to automatically set up 'static' data of an authority, i.e. data that needs to be persisted, such as CanonicalIDs, ProviderIDs, service endpoints, refs, etc.
The LOOKUP pipeline
The purpose of the LOOKUP pipeline is to assemble an XRD, which is sent back to a client. This pipeline is executed whenever a resolution request for an authority has to be satisfied!
At the beginning of this process, the authority's XRD from the store (i.e. the XRD that was assembled in the CREATE pipeline) is sent into the pipeline.
Whatever comes out at the end of the pipeline is considered to be the complete XRD for the current part of the request and is added to the XRDS.
The basic idea of the LOOKUP pipeline is therefore to automatically add 'dynamic' data of a request, i.e. data that depends on the particular request, such as an <Expires> element, or an authority resolution SEP that is dynamically generated based on the server configuration.
Stage interface
Every stage on the pipeline has just one method which receives the following information:
- The authority for which an XRD needs to be looked up (or: the parent authority of the authority for which a new XRD has to be created).
- The subsegment that resolves to this authority.
- The XRD as it currently looks like on the pipeline.
The method returns an XRD which is passed on to the next stage.
A stage can call any method on the existing XRD class to modify it. It could even completely replace the current XRD on the pipeline and output a fresh one.
The stages on the CREATE and LOOKUP pipelines share the same interface, i.e. you can put any of them on either pipeline.
Example stages
- AddRandomCanonicalIDStage (useful for the CREATE pipeline)
- AddIncrementalCanonicalIDStage (useful for the CREATE pipeline)
- AddProviderIDStage (useful for the CREATE pipeline)
- AddExpiresStage (useful for the LOOKUP pipeline)
- AddAuthorityResolutionSEP (useful for the LOOKUP pipeline)
- AddAutoLocalIDs (useful for the LOOKUP pipeline)
...
Diagrams
CREATE pipeline example
LOOKUP pipeline example
Overriding the default pipelines
An authority in the OpenXRI Server is able to override both the CREATE and LOOKUP pipeline.
If an authority overrides the LOOKUP pipeline, this means:
- If the server has to look up the XRD of this particular authority, the overridden pipeline will be executed instead of the server-wide default one, and the result XRD will be served to the client as usual.
- This makes it possible to realize very dynamic lookup behaviors such as the =search i-name (e.g. resolving =search*summer will dynamically add a default SEP that takes you to the first entry of a yahoo search).
If an authority overrides the CREATE pipeline, this means:
- If a new authority is created UNDER this authority, the overridden pipeline will be executed instead of the server-wide default one, and the result XRD will be put in the store as usual.
- This allows customized CanonicalID creation and many other use cases (e.g. maybe you want random CanonicalIDs under your @company i-name, but you want incremental CanonicalIDs under your @company*marketing i-name).


