From 58ad7109c39a5d6c5fccbae41a21dc66564d50a3 Mon Sep 17 00:00:00 2001 From: ValdemarGr Date: Wed, 30 Aug 2023 19:35:23 +0200 Subject: [PATCH] chore: doc interpreters --- .../scala/gql/server/interpreter/QueryInterpreter.scala | 3 +++ .../scala/gql/server/interpreter/StreamInterpreter.scala | 7 +++++++ .../scala/gql/server/interpreter/SubqueryInterpreter.scala | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/modules/server/src/main/scala/gql/server/interpreter/QueryInterpreter.scala b/modules/server/src/main/scala/gql/server/interpreter/QueryInterpreter.scala index 71d48e448..a3be517b1 100644 --- a/modules/server/src/main/scala/gql/server/interpreter/QueryInterpreter.scala +++ b/modules/server/src/main/scala/gql/server/interpreter/QueryInterpreter.scala @@ -11,6 +11,9 @@ import gql._ import gql.preparation._ import cats.effect.std.Supervisor +/** The [[QueryInterpreter]] will prepare a query for execution by inspecting the ast and planning the query accordingly. + * Once all inputs have been prepared, the execution AST is passed to the [[SubqueryInterpreter]] for evaluation. + */ trait QueryInterpreter[F[_]] { import QueryInterpreter._ diff --git a/modules/server/src/main/scala/gql/server/interpreter/StreamInterpreter.scala b/modules/server/src/main/scala/gql/server/interpreter/StreamInterpreter.scala index a12c217ee..dd5494d04 100644 --- a/modules/server/src/main/scala/gql/server/interpreter/StreamInterpreter.scala +++ b/modules/server/src/main/scala/gql/server/interpreter/StreamInterpreter.scala @@ -11,6 +11,13 @@ import gql.preparation._ import fs2.Stream import scala.concurrent.duration.FiniteDuration +/** The [[StreamInterpreter]] is resposible for: + * - Wireing together results for a query. + * - Handling incoming asynchronous events. + * - Handling resource lifetimes. + * + * For actual query excution, take a look at [[QueryInterpreter]]. + */ trait StreamInterpreter[F[_]] { import StreamInterpreter._ diff --git a/modules/server/src/main/scala/gql/server/interpreter/SubqueryInterpreter.scala b/modules/server/src/main/scala/gql/server/interpreter/SubqueryInterpreter.scala index f7e489a84..e92f1e87a 100644 --- a/modules/server/src/main/scala/gql/server/interpreter/SubqueryInterpreter.scala +++ b/modules/server/src/main/scala/gql/server/interpreter/SubqueryInterpreter.scala @@ -29,6 +29,12 @@ import gql.resolver._ import io.circe.syntax._ import gql._ +/** The [[SubqueryInterpreter]] recursively runs through the AST and performs a multitude of tasks: + * - Runs the [[Resolver]]/[[Step]]s defined in the query. + * - Accumulates errors that occur during the evaluation of the query. + * - Logs streams that have been subscribed to. + * - Batches computations that have been marked as batchable. + */ trait SubqueryInterpreter[F[_]] { type W[A] = WriterT[F, Chain[EvalFailure], A]