The engine layer presents this EngineAPI to the presentation layer.
The engine layer presents this EngineAPI to the presentation layer. The engine layer handles query validation, execution planning & optimization, and finally orchestrates the fetching of data by leveraging the FetcherApi.
Engine's must be threadsafe as they are called from multiple threads simultaneously.
The fetcher calls the Naptime APIs (either local or remote) to acquire all of the data necessary.
Contains the complete set of static type information to fully specify a Naptime service.
Contains the complete set of static type information to fully specify a Naptime service.
The Resource schemas for all available resources.
All of the data types that compose the service.
Implements a default schema provider for local-only ARI operation.
This encapsulates all of the information needed to compute a response.
This encapsulates all of the information needed to compute a response.
The request header is used for authentication parsing in the underlying requests made. Path and query parameters included in the request header are ignored in favor of the data within the topLevelRequests fields.
A non-empty list of "roots" used to begin queries. Every query begins with a "base" resource and related models are joined upon it from there.
Represents a requested field within a requested resource.
Represents a requested field within a requested resource.
TODO: figure out directives
The name of the requested field.
The name the field should be renamed to in the response.
If the field takes parameters, they are encapsulated here.
The list of fields in the related resource.
All of the data required to assemble a response to an automatic includes query.
All of the data required to assemble a response to an automatic includes query.
TODO: performance test, and determine if mutable collections yield non-trivial performance improvements.
A map from the top level requests to a TopLevelResponse, containing ids and pagination
A map from the resource name to a Map of IDs to DataMaps.
Provides the metadata required to power the engine.
Provides the metadata required to power the engine.
For local-only operation, a LocalSchemaProvider implements this interface. For distributed operations, a more sophisticated SchemaProvider must be implemented.
Encapsulates the starting root of a query into the naptime resource tree.
Encapsulates the starting root of a query into the naptime resource tree.
The name of the resource that forms the root of the request.
The field selection on the first resource.
Represents the response data from a TopLevelRequest, including returned ids and pagination
Represents the response data from a TopLevelRequest, including returned ids and pagination
a list of IDs returned by the top level request. (i.e. ids 5, 6, and 7 were returned by the bySlug finder)
pagination info from the top level request, including total and next cursor
This ari defines the key abstractions for automatic resource inclusion as well as GraphQL.
The system is split up into 3 distinct layers:
A request enters the system via the presentation layer (typically parsed from the network). The presentation layer constructs a org.coursera.naptime.ari.Request and passes that to engine. The engine performs a number of validations against the schema, and then makes a number of requests to to the Data Fetching layer to assemble all of the (available) data required to construct a response. This is passed back to the presentation layer, which constructs a response to be sent out on the wire.
The API between the presentation layer and the inclusion engine is the org.coursera.naptime.ari.EngineApi
The API between the inclusion engine and the data fetching layer is defined by org.coursera.naptime.ari.FetcherApi.
BEWARE: This code is currently in a high state of flux. Do not depend upon it unless you are prepared for breakages!