Package

org.coursera.naptime

ari

Permalink

package ari

This ari defines the key abstractions for automatic resource inclusion as well as GraphQL.

The system is split up into 3 distinct layers:

+---------------------------------------------------------------------+
|                       Presentation Layer                            |
|           GraphQL            |            Naptime HTTP              |
+------------------------------+--------------------------------------+
|                                                                     |
|                      Inclusion Engine                               |
|                                                                     |
+---------------------------------------------------------------------+
|                        Data fetching                                |
|         Local execution      |           remote execution           |
+=====================================================================+
|                                                                     |
|                   Unmodified Naptime APIs                           |
|                                                                     |
+---------------------------------------------------------------------+

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!

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. ari
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Type Members

  1. trait EngineApi extends AnyRef

    Permalink

    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.

  2. trait FetcherApi extends AnyRef

    Permalink

    The fetcher calls the Naptime APIs (either local or remote) to acquire all of the data necessary.

  3. case class FullSchema(resources: Set[Resource], types: Set[DataSchema]) extends Product with Serializable

    Permalink

    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.

    resources

    The Resource schemas for all available resources.

    types

    All of the data types that compose the service.

  4. class LocalSchemaProvider extends SchemaProvider with StrictLogging

    Permalink

    Implements a default schema provider for local-only ARI operation.

  5. case class Request(requestHeader: RequestHeader, topLevelRequests: Seq[TopLevelRequest]) extends Product with Serializable

    Permalink

    This encapsulates all of the information needed to compute a response.

    This encapsulates all of the information needed to compute a response.

    requestHeader

    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.

    topLevelRequests

    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.

  6. case class RequestField(name: String, alias: Option[String], args: Set[(String, JsValue)], selections: List[RequestField]) extends Product with Serializable

    Permalink

    Represents a requested field within a requested resource.

    Represents a requested field within a requested resource.

    TODO: figure out directives

    name

    The name of the requested field.

    alias

    The name the field should be renamed to in the response.

    args

    If the field takes parameters, they are encapsulated here.

    selections

    The list of fields in the related resource.

  7. case class Response(topLevelIds: Map[TopLevelRequest, DataList], data: Map[ResourceName, Map[AnyRef, DataMap]]) extends Product with Serializable

    Permalink

    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.

    topLevelIds

    A map from the top level requests to a DataList containing the ordered list of IDs for the top of the response

    data

    A map from the resource name to a Map of IDs to DataMaps.

  8. trait SchemaProvider extends AnyRef

    Permalink

    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.

  9. case class TopLevelRequest(resource: ResourceName, selection: RequestField, alias: Option[String] = None) extends Product with Serializable

    Permalink

    Encapsulates the starting root of a query into the naptime resource tree.

    Encapsulates the starting root of a query into the naptime resource tree.

    resource

    The name of the resource that forms the root of the request.

    selection

    The field selection on the first resource.

Value Members

  1. object FullSchema extends Serializable

    Permalink
  2. object Response extends Serializable

    Permalink
  3. package engine

    Permalink
  4. package fetcher

    Permalink

Inherited from AnyRef

Inherited from Any

Ungrouped