Expand description
Components of a federated GraphQL Server.
Most of these modules are of varying interest to different audiences.
If your interests are confined to developing plugins, then the following modules are likely to be of most interest to you:
-
self
- this module (apollo_router) contains high level building blocks for a federated GraphQL router -
graphql
- graphql specific functionality for requests, responses, errors -
layers
- examples of tower layers used to implement plugins -
plugin
- various APIs for implementing a plugin -
services
- the various services handling a GraphQL requests, and APIs for plugins to intercept them
Re-exports§
pub use crate::axum_factory::unsupported_set_axum_router_callback;
pub use crate::test_harness::make_fake_batch;
pub use crate::test_harness::MockedSubgraphs;
pub use crate::test_harness::TestHarness;
Modules§
- graphql
- Types related to GraphQL requests, responses, etc.
- layers
- Reusable layers Layers that are specific to one plugin should not be placed in this module.
- plugin
- Plugin system for the router.
- services
- Implementation of the various steps in the router’s processing pipeline.
- test_
harness - Test harness and mocks for the Apollo Router.
- tracer
- Trace Ids for the router.
- uhg_
custom
Macros§
- assert_
snapshot_ subscriber - This is a really simple macro to assert a snapshot of the logs.
To use it call
.with_subscriber(assert_snapshot_subscriber!())
in your test just before callingawait
. This will assert a snapshot of the logs in pretty yaml format. You can also use subscriber::with_default(assert_snapshot_subscriber!(), || { … }) to assert the logs in non async code. - register_
plugin - Register a plugin with a group and a name Grouping prevent name clashes for plugins, so choose something unique, like your domain name. Plugins will appear in the configuration as a layer property called: {group}.{name}
- register_
private_ plugin - Register a private plugin with a group and a name Grouping prevent name clashes for plugins, so choose something unique, like your domain name. Plugins will appear in the configuration as a layer property called: {group}.{name}
- u64_
counter - Get or create a u64 monotonic counter metric and add a value to it
Structs§
- Configuration
- The configuration for the router.
- Context
- A map of arbitrary JSON values, for use by plugins.
- Endpoint
- A path and a handler to be exposed as a web_endpoint for plugins
- Executable
- Entry point into creating a router executable with more customization than
main
. - Extensions
- A type map of protocol extensions.
- Extensions
Mutex - You can use
Extensions
to pass data between plugins that is not serializable. Such data is not accessible from Rhai or co-processoers. - Notify
- In memory pub/sub implementation
- Router
Http Server - The entry point for running the Router’s HTTP server.
- Uplink
Config - Configuration for polling Apollo Uplink. This struct does not change on router reloads - they are all sourced from CLI options.
Enums§
- Apollo
Router Error - Error types for FederatedServer.
- Configuration
Source - The user supplied config. Either a static instance or a stream for hot reloading.
- License
Source - License controls availability of certain features of the Router. This API experimental and is subject to change outside of semver.
- Listen
Addr - Listening address.
- Schema
Source - The user supplied schema. Either a static string or a stream for hot reloading.
- Shutdown
Source - Specifies when the Router’s HTTP server should gracefully shutdown
Functions§
- main
- This is the main router entrypoint.