Skip to content

Commit

Permalink
Migrated new executor interfaces and added documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelstaib committed Apr 19, 2020
1 parent a4db781 commit c668be4
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 2 deletions.
Expand Up @@ -6,7 +6,7 @@

namespace HotChocolate.Execution
{
public interface IExecutionContext
internal interface IOperationContext
{
/// <summary>
/// Gets the schema on which the query is being executed.
Expand Down
12 changes: 12 additions & 0 deletions src/HotChocolate/Core/src/Execution/IOperationExecutor.cs
@@ -0,0 +1,12 @@
using System.Threading;
using System.Threading.Tasks;

namespace HotChocolate.Execution
{
internal interface IOperationExecutor
{
Task<IExecutionResult> ExecuteAsync(
IOperationContext executionContext,
CancellationToken cancellationToken);
}
}
47 changes: 47 additions & 0 deletions src/HotChocolate/Core/src/Execution/IQueryExecutor.cs
@@ -0,0 +1,47 @@
using System;
using System.Threading;
using System.Threading.Tasks;

namespace HotChocolate.Execution
{
/// <summary>
/// This executor processes GraphQL query, mutation and subscription requests for the
/// <see cref="Schema" /> to which it is bound to.
/// </summary>
public interface IQueryExecutor
: IDisposable
{
/// <summary>
/// Gets the schema to which this executor is bound to.
/// </summary>
/// <value></value>
ISchema Schema { get; }

/// <summary>
/// Executes the given GraphQL <paramref name="request" />.
/// </summary>
/// <param name="request">
/// The GraphQL request object.
/// </param>
/// <param name="cancellationToken">
/// The cancellation token.
/// </param>
/// <returns>
/// Returns the execution result of the given GraphQL <paramref name="request" />.
/// If the request operation is a simple query or mutation the result is a
/// <see cref="IReadOnlyQueryResult" />.
///
/// If the request operation is a query or mutation where data is deferred, streamed or
/// includes live data the result is a <see cref="IResponseStream" /> where reach result
/// that the <see cref="IResponseStream" /> yields is a <see cref="IReadOnlyQueryResult" />.
///
/// If the request operation is a subscription the result is a
/// <see cref="IResponseStream" /> where reach result that the
/// <see cref="IResponseStream" /> yields is a
/// <see cref="IReadOnlyQueryResult" />.
/// </returns>
Task<IExecutionResult> ExecuteAsync(
IReadOnlyQueryRequest request,
CancellationToken cancellationToken = default);
}
}
Expand Up @@ -4,7 +4,7 @@

namespace HotChocolate.Execution
{
public interface IQueryContext : IHasContextData
public interface IRequestContext : IHasContextData
{
/// <summary>
/// Gets the GraphQL schema on which the query is executed.
Expand Down
8 changes: 8 additions & 0 deletions src/HotChocolate/Core/src/Execution/RequestMiddleware.cs
@@ -0,0 +1,8 @@
using System.Threading.Tasks;

namespace HotChocolate.Execution
{
public delegate RequestDelegate RequestMiddleware(RequestDelegate next);

public delegate Task RequestDelegate(IRequestContext context);
}

0 comments on commit c668be4

Please sign in to comment.