Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public class GreetingService(IApiClient ApiClient)

[NexusOperationHandler]
public IOperationHandler<string, string> SayHello2() =>
// Advanced, potentially asynchronous operations can
// Advanced, potentially asynchronous operations can
new SayHello2Handler(ApiClient);

public class SayHello2Handler(IApiClient ApiClient) : IOperationHandler<string, string>
Expand All @@ -86,11 +86,6 @@ public class GreetingService(IApiClient ApiClient)
OperationStartContext context, string name) =>
throw new NotImplementedException("Excluded for brevity");

public Task<string> FetchResultAsync(OperationFetchResultContext context) =>
throw new NotImplementedException("Excluded for brevity");

public Task<OperationInfo> FetchInfoAsync(OperationFetchInfoContext context) =>
throw new NotImplementedException("Excluded for brevity");

public Task CancelAsync(OperationCancelContext context) =>
throw new NotImplementedException("Excluded for brevity");
Expand All @@ -104,8 +99,8 @@ public class GreetingService(IApiClient ApiClient)

Prerequisites:

* [.NET](https://learn.microsoft.com/en-us/dotnet/core/install/)
* This repository cloned
- [.NET](https://learn.microsoft.com/en-us/dotnet/core/install/)
- This repository cloned

With all prerequisites in place, run:

Expand All @@ -131,8 +126,8 @@ Run:

Can add options like:

* `--logger "console;verbosity=detailed"` to show logs
* `--filter "FullyQualifiedName=NexusRpc.Tests.ServiceDefinitionTests.FromType_NonInterface_Bad"` to run a
- `--logger "console;verbosity=detailed"` to show logs
- `--filter "FullyQualifiedName=NexusRpc.Tests.ServiceDefinitionTests.FromType_NonInterface_Bad"` to run a
specific test

To help show full stdout/stderr, this is also available as an in-proc test program. Run:
Expand All @@ -141,4 +136,4 @@ To help show full stdout/stderr, this is also available as an in-proc test progr

Extra args can be added after `--`, e.g. `-- -verbose` would show verbose logs and `-- --help` would show other
options. If the arguments are anything but `--help`, the current assembly is prepended to the args before sending to the
xUnit runner.
xUnit runner.
33 changes: 0 additions & 33 deletions src/NexusRpc/Handlers/Handler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,39 +96,6 @@ public async Task<OperationStartResult<HandlerContent>> StartOperationAsync(
new HandlerContent(resultContent.Data, resultContent.Headers));
}

/// <inheritdoc/>
public async Task<HandlerContent> FetchOperationResultAsync(OperationFetchResultContext context)
{
// Get handler
var instance = GetInstance(context);
var handler = GetInterceptedHandler(context, instance);
var opDef = instance.Definition.Operations[context.Operation];

// Fetch result
var result = await handler.FetchResultAsync(context).ConfigureAwait(false);

// Change sync result value to NoValue if return type is void
if (opDef.OutputType == typeof(void))
{
result = default(NoValue);
}

// Serialize
var resultContent = await serializer.SerializeAsync(result).ConfigureAwait(false);
return new(resultContent.Data, resultContent.Headers);
}

/// <inheritdoc/>
public Task<OperationInfo> FetchOperationInfoAsync(OperationFetchInfoContext context)
{
// Get handler
var instance = GetInstance(context);
var handler = GetInterceptedHandler(context, instance);

// Return info
return handler.FetchInfoAsync(context);
}

/// <inheritdoc/>
public Task CancelOperationAsync(OperationCancelContext context)
{
Expand Down
19 changes: 0 additions & 19 deletions src/NexusRpc/Handlers/IHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,6 @@ Task<OperationStartResult<HandlerContent>> StartOperationAsync(
OperationStartContext context,
HandlerContent input);

/// <summary>
/// Fetch operation result, waiting if necessary.
/// </summary>
/// <param name="context">Context.</param>
/// <returns>Task with result contents.</returns>
/// <exception cref="OperationStillRunningException">Operation still running (after optional
/// wait).</exception>
/// <exception cref="OperationException">Operation failed.</exception>
/// <exception cref="HandlerException">Unexpected handler failure.</exception>
Task<HandlerContent> FetchOperationResultAsync(OperationFetchResultContext context);

/// <summary>
/// Fetch operation info.
/// </summary>
/// <param name="context">Context.</param>
/// <returns>Task with operation info.</returns>
/// <exception cref="HandlerException">Unexpected handler failure.</exception>
Task<OperationInfo> FetchOperationInfoAsync(OperationFetchInfoContext context);

/// <summary>
/// Request operation cancel.
/// </summary>
Expand Down
19 changes: 0 additions & 19 deletions src/NexusRpc/Handlers/IOperationHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,6 @@ Task<OperationStartResult<TResult>> StartAsync(
OperationStartContext context,
TInput input);

/// <summary>
/// Fetch operation result, waiting if necessary.
/// </summary>
/// <param name="context">Context.</param>
/// <returns>Task with result contents.</returns>
/// <exception cref="OperationStillRunningException">Operation still running (after optional
/// wait).</exception>
/// <exception cref="OperationException">Operation failed.</exception>
/// <exception cref="HandlerException">Unexpected handler failure.</exception>
Task<TResult> FetchResultAsync(OperationFetchResultContext context);

/// <summary>
/// Fetch operation info.
/// </summary>
/// <param name="context">Context.</param>
/// <returns>Task with operation info.</returns>
/// <exception cref="HandlerException">Unexpected handler failure.</exception>
Task<OperationInfo> FetchInfoAsync(OperationFetchInfoContext context);

/// <summary>
/// Request operation cancel.
/// </summary>
Expand Down
20 changes: 0 additions & 20 deletions src/NexusRpc/Handlers/OperationFetchInfoContext.cs

This file was deleted.

34 changes: 0 additions & 34 deletions src/NexusRpc/Handlers/OperationFetchResultContext.cs

This file was deleted.

12 changes: 0 additions & 12 deletions src/NexusRpc/Handlers/OperationHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,6 @@ public async Task<OperationStartResult<TResult>> StartAsync(
return OperationStartResult.SyncResult(result);
}

public Task<TResult> FetchResultAsync(OperationFetchResultContext context) =>
throw new NotImplementedException("Not supported on sync operation");

public Task<OperationInfo> FetchInfoAsync(OperationFetchInfoContext context) =>
throw new NotImplementedException("Not supported on sync operation");

public Task CancelAsync(OperationCancelContext context) =>
throw new NotImplementedException("Not supported on sync operation");
}
Expand All @@ -119,12 +113,6 @@ public GenericOperationHandler(IOperationHandler<TInput, TResult> underlying) =>
return new(result.SyncResultValue, result.AsyncOperationToken);
}

public async Task<object?> FetchResultAsync(OperationFetchResultContext context) =>
await Underlying.FetchResultAsync(context).ConfigureAwait(false);

public Task<OperationInfo> FetchInfoAsync(OperationFetchInfoContext context) =>
Underlying.FetchInfoAsync(context);

public Task CancelAsync(OperationCancelContext context) =>
Underlying.CancelAsync(context);
}
Expand Down
9 changes: 0 additions & 9 deletions src/NexusRpc/OperationInfo.cs

This file was deleted.

17 changes: 0 additions & 17 deletions src/NexusRpc/OperationStillRunningException.cs

This file was deleted.

Loading