Changed namespace from Google.GRPC to Grpc, sorted using statements, minor refactorings

pull/616/head
Jan Tattermusch 10 years ago
parent e2e081a32e
commit 3086862d20
  1. 4
      src/csharp/GrpcApi/MathExamples.cs
  2. 16
      src/csharp/GrpcApi/MathGrpc.cs
  3. 6
      src/csharp/GrpcApi/MathServiceImpl.cs
  4. 23
      src/csharp/GrpcApi/TestServiceGrpc.cs
  5. 8
      src/csharp/GrpcApiTests/MathClientServerTests.cs
  6. 4
      src/csharp/GrpcCore/Call.cs
  7. 4
      src/csharp/GrpcCore/Calls.cs
  8. 4
      src/csharp/GrpcCore/Channel.cs
  9. 2
      src/csharp/GrpcCore/ClientStreamingAsyncResult.cs
  10. 4
      src/csharp/GrpcCore/GrpcEnvironment.cs
  11. 14
      src/csharp/GrpcCore/Internal/AsyncCall.cs
  12. 4
      src/csharp/GrpcCore/Internal/BatchContextSafeHandleNotOwned.cs
  13. 6
      src/csharp/GrpcCore/Internal/CallSafeHandle.cs
  14. 2
      src/csharp/GrpcCore/Internal/ChannelSafeHandle.cs
  15. 4
      src/csharp/GrpcCore/Internal/ClientStreamingInputObserver.cs
  16. 2
      src/csharp/GrpcCore/Internal/CompletionQueueSafeHandle.cs
  17. 2
      src/csharp/GrpcCore/Internal/Enums.cs
  18. 6
      src/csharp/GrpcCore/Internal/GrpcThreadPool.cs
  19. 2
      src/csharp/GrpcCore/Internal/SafeHandleZeroIsInvalid.cs
  20. 6
      src/csharp/GrpcCore/Internal/ServerSafeHandle.cs
  21. 6
      src/csharp/GrpcCore/Internal/ServerStreamingOutputObserver.cs
  22. 2
      src/csharp/GrpcCore/Internal/Timespec.cs
  23. 2
      src/csharp/GrpcCore/Marshaller.cs
  24. 2
      src/csharp/GrpcCore/Method.cs
  25. 2
      src/csharp/GrpcCore/RpcException.cs
  26. 10
      src/csharp/GrpcCore/Server.cs
  27. 6
      src/csharp/GrpcCore/ServerCallHandler.cs
  28. 2
      src/csharp/GrpcCore/ServerCalls.cs
  29. 2
      src/csharp/GrpcCore/ServerServiceDefinition.cs
  30. 2
      src/csharp/GrpcCore/Status.cs
  31. 40
      src/csharp/GrpcCore/StatusCode.cs
  32. 4
      src/csharp/GrpcCore/Utils/RecordingObserver.cs
  33. 2
      src/csharp/GrpcCore/Utils/RecordingQueue.cs
  34. 14
      src/csharp/GrpcCoreTests/ClientServerTest.cs
  35. 6
      src/csharp/GrpcCoreTests/GrpcEnvironmentTest.cs
  36. 10
      src/csharp/GrpcCoreTests/ServerTest.cs
  37. 6
      src/csharp/GrpcCoreTests/TestResult.xml
  38. 6
      src/csharp/GrpcCoreTests/TimespecTest.cs
  39. 8
      src/csharp/InteropClient/Client.cs
  40. 9
      src/csharp/InteropClient/InteropClient.csproj
  41. 2
      src/csharp/MathClient/MathClient.cs

@ -32,10 +32,10 @@
#endregion #endregion
using System; using System;
using System.Threading.Tasks;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reactive.Linq; using System.Reactive.Linq;
using Google.GRPC.Core.Utils; using System.Threading.Tasks;
using Grpc.Core.Utils;
namespace math namespace math
{ {

@ -32,11 +32,11 @@
#endregion #endregion
using System; using System;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reactive.Linq; using System.Reactive.Linq;
using Google.GRPC.Core; using System.Threading;
using System.Threading.Tasks;
using Grpc.Core;
namespace math namespace math
{ {
@ -99,31 +99,31 @@ namespace math
public DivReply Div(DivArgs request, CancellationToken token = default(CancellationToken)) public DivReply Div(DivArgs request, CancellationToken token = default(CancellationToken))
{ {
var call = new Google.GRPC.Core.Call<DivArgs, DivReply>(divMethod, channel); var call = new Grpc.Core.Call<DivArgs, DivReply>(divMethod, channel);
return Calls.BlockingUnaryCall(call, request, token); return Calls.BlockingUnaryCall(call, request, token);
} }
public Task<DivReply> DivAsync(DivArgs request, CancellationToken token = default(CancellationToken)) public Task<DivReply> DivAsync(DivArgs request, CancellationToken token = default(CancellationToken))
{ {
var call = new Google.GRPC.Core.Call<DivArgs, DivReply>(divMethod, channel); var call = new Grpc.Core.Call<DivArgs, DivReply>(divMethod, channel);
return Calls.AsyncUnaryCall(call, request, token); return Calls.AsyncUnaryCall(call, request, token);
} }
public void Fib(FibArgs request, IObserver<Num> responseObserver, CancellationToken token = default(CancellationToken)) public void Fib(FibArgs request, IObserver<Num> responseObserver, CancellationToken token = default(CancellationToken))
{ {
var call = new Google.GRPC.Core.Call<FibArgs, Num>(fibMethod, channel); var call = new Grpc.Core.Call<FibArgs, Num>(fibMethod, channel);
Calls.AsyncServerStreamingCall(call, request, responseObserver, token); Calls.AsyncServerStreamingCall(call, request, responseObserver, token);
} }
public ClientStreamingAsyncResult<Num, Num> Sum(CancellationToken token = default(CancellationToken)) public ClientStreamingAsyncResult<Num, Num> Sum(CancellationToken token = default(CancellationToken))
{ {
var call = new Google.GRPC.Core.Call<Num, Num>(sumMethod, channel); var call = new Grpc.Core.Call<Num, Num>(sumMethod, channel);
return Calls.AsyncClientStreamingCall(call, token); return Calls.AsyncClientStreamingCall(call, token);
} }
public IObserver<DivArgs> DivMany(IObserver<DivReply> responseObserver, CancellationToken token = default(CancellationToken)) public IObserver<DivArgs> DivMany(IObserver<DivReply> responseObserver, CancellationToken token = default(CancellationToken))
{ {
var call = new Google.GRPC.Core.Call<DivArgs, DivReply>(divManyMethod, channel); var call = new Grpc.Core.Call<DivArgs, DivReply>(divManyMethod, channel);
return Calls.DuplexStreamingCall(call, responseObserver, token); return Calls.DuplexStreamingCall(call, responseObserver, token);
} }
} }

@ -32,11 +32,11 @@
#endregion #endregion
using System; using System;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reactive.Linq; using System.Reactive.Linq;
using Google.GRPC.Core.Utils; using System.Threading;
using System.Threading.Tasks;
using Grpc.Core.Utils;
namespace math namespace math
{ {

@ -30,12 +30,13 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endregion #endregion
using System; using System;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reactive.Linq; using System.Reactive.Linq;
using Google.GRPC.Core; using System.Threading;
using System.Threading.Tasks;
using Grpc.Core;
namespace grpc.testing namespace grpc.testing
{ {
@ -119,49 +120,49 @@ namespace grpc.testing
public Empty EmptyCall(Empty request, CancellationToken token = default(CancellationToken)) public Empty EmptyCall(Empty request, CancellationToken token = default(CancellationToken))
{ {
var call = new Google.GRPC.Core.Call<Empty, Empty>(emptyCallMethod, channel); var call = new Grpc.Core.Call<Empty, Empty>(emptyCallMethod, channel);
return Calls.BlockingUnaryCall(call, request, token); return Calls.BlockingUnaryCall(call, request, token);
} }
public Task<Empty> EmptyCallAsync(Empty request, CancellationToken token = default(CancellationToken)) public Task<Empty> EmptyCallAsync(Empty request, CancellationToken token = default(CancellationToken))
{ {
var call = new Google.GRPC.Core.Call<Empty, Empty>(emptyCallMethod, channel); var call = new Grpc.Core.Call<Empty, Empty>(emptyCallMethod, channel);
return Calls.AsyncUnaryCall(call, request, token); return Calls.AsyncUnaryCall(call, request, token);
} }
public SimpleResponse UnaryCall(SimpleRequest request, CancellationToken token = default(CancellationToken)) public SimpleResponse UnaryCall(SimpleRequest request, CancellationToken token = default(CancellationToken))
{ {
var call = new Google.GRPC.Core.Call<SimpleRequest, SimpleResponse>(unaryCallMethod, channel); var call = new Grpc.Core.Call<SimpleRequest, SimpleResponse>(unaryCallMethod, channel);
return Calls.BlockingUnaryCall(call, request, token); return Calls.BlockingUnaryCall(call, request, token);
} }
public Task<SimpleResponse> UnaryCallAsync(SimpleRequest request, CancellationToken token = default(CancellationToken)) public Task<SimpleResponse> UnaryCallAsync(SimpleRequest request, CancellationToken token = default(CancellationToken))
{ {
var call = new Google.GRPC.Core.Call<SimpleRequest, SimpleResponse>(unaryCallMethod, channel); var call = new Grpc.Core.Call<SimpleRequest, SimpleResponse>(unaryCallMethod, channel);
return Calls.AsyncUnaryCall(call, request, token); return Calls.AsyncUnaryCall(call, request, token);
} }
public void StreamingOutputCall(StreamingOutputCallRequest request, IObserver<StreamingOutputCallResponse> responseObserver, CancellationToken token = default(CancellationToken)) { public void StreamingOutputCall(StreamingOutputCallRequest request, IObserver<StreamingOutputCallResponse> responseObserver, CancellationToken token = default(CancellationToken)) {
var call = new Google.GRPC.Core.Call<StreamingOutputCallRequest, StreamingOutputCallResponse>(streamingOutputCallMethod, channel); var call = new Grpc.Core.Call<StreamingOutputCallRequest, StreamingOutputCallResponse>(streamingOutputCallMethod, channel);
Calls.AsyncServerStreamingCall(call, request, responseObserver, token); Calls.AsyncServerStreamingCall(call, request, responseObserver, token);
} }
public ClientStreamingAsyncResult<StreamingInputCallRequest, StreamingInputCallResponse> StreamingInputCall(CancellationToken token = default(CancellationToken)) public ClientStreamingAsyncResult<StreamingInputCallRequest, StreamingInputCallResponse> StreamingInputCall(CancellationToken token = default(CancellationToken))
{ {
var call = new Google.GRPC.Core.Call<StreamingInputCallRequest, StreamingInputCallResponse>(streamingInputCallMethod, channel); var call = new Grpc.Core.Call<StreamingInputCallRequest, StreamingInputCallResponse>(streamingInputCallMethod, channel);
return Calls.AsyncClientStreamingCall(call, token); return Calls.AsyncClientStreamingCall(call, token);
} }
public IObserver<StreamingOutputCallRequest> FullDuplexCall(IObserver<StreamingOutputCallResponse> responseObserver, CancellationToken token = default(CancellationToken)) public IObserver<StreamingOutputCallRequest> FullDuplexCall(IObserver<StreamingOutputCallResponse> responseObserver, CancellationToken token = default(CancellationToken))
{ {
var call = new Google.GRPC.Core.Call<StreamingOutputCallRequest, StreamingOutputCallResponse>(fullDuplexCallMethod, channel); var call = new Grpc.Core.Call<StreamingOutputCallRequest, StreamingOutputCallResponse>(fullDuplexCallMethod, channel);
return Calls.DuplexStreamingCall(call, responseObserver, token); return Calls.DuplexStreamingCall(call, responseObserver, token);
} }
public IObserver<StreamingOutputCallRequest> HalfDuplexCall(IObserver<StreamingOutputCallResponse> responseObserver, CancellationToken token = default(CancellationToken)) public IObserver<StreamingOutputCallRequest> HalfDuplexCall(IObserver<StreamingOutputCallResponse> responseObserver, CancellationToken token = default(CancellationToken))
{ {
var call = new Google.GRPC.Core.Call<StreamingOutputCallRequest, StreamingOutputCallResponse>(halfDuplexCallMethod, channel); var call = new Grpc.Core.Call<StreamingOutputCallRequest, StreamingOutputCallResponse>(halfDuplexCallMethod, channel);
return Calls.DuplexStreamingCall(call, responseObserver, token); return Calls.DuplexStreamingCall(call, responseObserver, token);
} }
} }

@ -32,12 +32,12 @@
#endregion #endregion
using System; using System;
using NUnit.Framework; using System.Collections.Generic;
using Google.GRPC.Core;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Google.GRPC.Core.Utils; using Grpc.Core;
using System.Collections.Generic; using Grpc.Core.Utils;
using NUnit.Framework;
namespace math.Tests namespace math.Tests
{ {

@ -32,9 +32,9 @@
#endregion #endregion
using System; using System;
using Google.GRPC.Core.Internal; using Grpc.Core.Internal;
namespace Google.GRPC.Core namespace Grpc.Core
{ {
public class Call<TRequest, TResponse> public class Call<TRequest, TResponse>
{ {

@ -34,9 +34,9 @@
using System; using System;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Google.GRPC.Core.Internal; using Grpc.Core.Internal;
namespace Google.GRPC.Core namespace Grpc.Core
{ {
// NOTE: this class is work-in-progress // NOTE: this class is work-in-progress

@ -35,9 +35,9 @@ using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Google.GRPC.Core.Internal; using Grpc.Core.Internal;
namespace Google.GRPC.Core namespace Grpc.Core
{ {
public class Channel : IDisposable public class Channel : IDisposable
{ {

@ -34,7 +34,7 @@
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Google.GRPC.Core namespace Grpc.Core
{ {
/// <summary> /// <summary>
/// Return type for client streaming async method. /// Return type for client streaming async method.

@ -32,10 +32,10 @@
#endregion #endregion
using System; using System;
using Google.GRPC.Core.Internal;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Grpc.Core.Internal;
namespace Google.GRPC.Core namespace Grpc.Core
{ {
/// <summary> /// <summary>
/// Encapsulates initialization and shutdown of gRPC library. /// Encapsulates initialization and shutdown of gRPC library.

@ -32,14 +32,14 @@
#endregion #endregion
using System; using System;
using System.Runtime.InteropServices;
using System.Diagnostics; using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Runtime.CompilerServices; using Grpc.Core.Internal;
using Google.GRPC.Core.Internal;
namespace Google.GRPC.Core.Internal namespace Grpc.Core.Internal
{ {
/// <summary> /// <summary>
/// Handles native call lifecycle and provides convenience methods. /// Handles native call lifecycle and provides convenience methods.
@ -381,7 +381,7 @@ namespace Google.GRPC.Core.Internal
private void CompleteStreamObserver(Status status) private void CompleteStreamObserver(Status status)
{ {
if (status.StatusCode != StatusCode.GRPC_STATUS_OK) if (status.StatusCode != StatusCode.OK)
{ {
// TODO: wrap to handle exceptions; // TODO: wrap to handle exceptions;
readObserver.OnError(new RpcException(status)); readObserver.OnError(new RpcException(status));
@ -413,13 +413,13 @@ namespace Google.GRPC.Core.Internal
if (error != GRPCOpError.GRPC_OP_OK) if (error != GRPCOpError.GRPC_OP_OK)
{ {
tcs.SetException(new RpcException( tcs.SetException(new RpcException(
new Status(StatusCode.GRPC_STATUS_INTERNAL, "Internal error occured.") new Status(StatusCode.Internal, "Internal error occured.")
)); ));
return; return;
} }
var status = ctx.GetReceivedStatus(); var status = ctx.GetReceivedStatus();
if (status.StatusCode != StatusCode.GRPC_STATUS_OK) if (status.StatusCode != StatusCode.OK)
{ {
tcs.SetException(new RpcException(status)); tcs.SetException(new RpcException(status));
return; return;

@ -33,9 +33,9 @@
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Google.GRPC.Core; using Grpc.Core;
namespace Google.GRPC.Core.Internal namespace Grpc.Core.Internal
{ {
/// <summary> /// <summary>
/// Not owned version of /// Not owned version of

@ -32,11 +32,11 @@
#endregion #endregion
using System; using System;
using System.Runtime.InteropServices;
using System.Diagnostics; using System.Diagnostics;
using Google.GRPC.Core; using System.Runtime.InteropServices;
using Grpc.Core;
namespace Google.GRPC.Core.Internal namespace Grpc.Core.Internal
{ {
//TODO: rename the delegate //TODO: rename the delegate
internal delegate void CompletionCallbackDelegate(GRPCOpError error, IntPtr batchContextPtr); internal delegate void CompletionCallbackDelegate(GRPCOpError error, IntPtr batchContextPtr);

@ -36,7 +36,7 @@ using System.Runtime.InteropServices;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Google.GRPC.Core.Internal namespace Grpc.Core.Internal
{ {
/// <summary> /// <summary>
/// grpc_channel from <grpc/grpc.h> /// grpc_channel from <grpc/grpc.h>

@ -32,9 +32,9 @@
#endregion #endregion
using System; using System;
using Google.GRPC.Core.Internal; using Grpc.Core.Internal;
namespace Google.GRPC.Core.Internal namespace Grpc.Core.Internal
{ {
internal class ClientStreamingInputObserver<TWrite, TRead> : IObserver<TWrite> internal class ClientStreamingInputObserver<TWrite, TRead> : IObserver<TWrite>
{ {

@ -35,7 +35,7 @@ using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Google.GRPC.Core.Internal namespace Grpc.Core.Internal
{ {
/// <summary> /// <summary>
/// grpc_completion_queue from <grpc/grpc.h> /// grpc_completion_queue from <grpc/grpc.h>

@ -34,7 +34,7 @@
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace Google.GRPC.Core.Internal namespace Grpc.Core.Internal
{ {
/// <summary> /// <summary>
/// from grpc/grpc.h /// from grpc/grpc.h

@ -32,13 +32,13 @@
#endregion #endregion
using System; using System;
using Google.GRPC.Core.Internal; using System.Collections.Generic;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Collections.Generic; using Grpc.Core.Internal;
namespace Google.GRPC.Core.Internal namespace Grpc.Core.Internal
{ {
/// <summary> /// <summary>
/// Pool of threads polling on the same completion queue. /// Pool of threads polling on the same completion queue.

@ -34,7 +34,7 @@
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace Google.GRPC.Core.Internal namespace Grpc.Core.Internal
{ {
/// <summary> /// <summary>
/// Safe handle to wrap native objects. /// Safe handle to wrap native objects.

@ -32,11 +32,11 @@
#endregion #endregion
using System; using System;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace Google.GRPC.Core.Internal namespace Grpc.Core.Internal
{ {
// TODO: we need to make sure that the delegates are not collected before invoked. // TODO: we need to make sure that the delegates are not collected before invoked.
internal delegate void ServerShutdownCallbackDelegate(IntPtr eventPtr); internal delegate void ServerShutdownCallbackDelegate(IntPtr eventPtr);

@ -32,9 +32,9 @@
#endregion #endregion
using System; using System;
using Google.GRPC.Core.Internal; using Grpc.Core.Internal;
namespace Google.GRPC.Core.Internal namespace Grpc.Core.Internal
{ {
/// <summary> /// <summary>
/// Observer that writes all arriving messages to a call abstraction (in blocking fashion) /// Observer that writes all arriving messages to a call abstraction (in blocking fashion)
@ -52,7 +52,7 @@ namespace Google.GRPC.Core.Internal
public void OnCompleted() public void OnCompleted()
{ {
// TODO: how bad is the Wait here? // TODO: how bad is the Wait here?
call.SendStatusFromServerAsync(new Status(StatusCode.GRPC_STATUS_OK, "")).Wait(); call.SendStatusFromServerAsync(new Status(StatusCode.OK, "")).Wait();
} }
public void OnError(Exception error) public void OnError(Exception error)

@ -35,7 +35,7 @@ using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Threading; using System.Threading;
namespace Google.GRPC.Core.Internal namespace Grpc.Core.Internal
{ {
/// <summary> /// <summary>
/// gpr_timespec from grpc/support/time.h /// gpr_timespec from grpc/support/time.h

@ -33,7 +33,7 @@
using System; using System;
namespace Google.GRPC.Core namespace Grpc.Core
{ {
/// <summary> /// <summary>
/// For serializing and deserializing messages. /// For serializing and deserializing messages.

@ -33,7 +33,7 @@
using System; using System;
namespace Google.GRPC.Core namespace Grpc.Core
{ {
public enum MethodType public enum MethodType
{ {

@ -33,7 +33,7 @@
using System; using System;
namespace Google.GRPC.Core namespace Grpc.Core
{ {
public class RpcException : Exception public class RpcException : Exception
{ {

@ -32,14 +32,14 @@
#endregion #endregion
using System; using System;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Threading.Tasks;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using Google.GRPC.Core.Internal; using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using Grpc.Core.Internal;
namespace Google.GRPC.Core namespace Grpc.Core
{ {
/// <summary> /// <summary>
/// Server is implemented only to be able to do /// Server is implemented only to be able to do

@ -32,9 +32,9 @@
#endregion #endregion
using System; using System;
using Google.GRPC.Core.Internal; using Grpc.Core.Internal;
namespace Google.GRPC.Core namespace Grpc.Core
{ {
internal interface IServerCallHandler internal interface IServerCallHandler
{ {
@ -111,7 +111,7 @@ namespace Google.GRPC.Core
var finishedTask = asyncCall.ServerSideStreamingRequestCallAsync(new NullObserver<byte[]>()); var finishedTask = asyncCall.ServerSideStreamingRequestCallAsync(new NullObserver<byte[]>());
asyncCall.SendStatusFromServerAsync(new Status(StatusCode.GRPC_STATUS_UNIMPLEMENTED, "No such method.")).Wait(); asyncCall.SendStatusFromServerAsync(new Status(StatusCode.Unimplemented, "No such method.")).Wait();
finishedTask.Wait(); finishedTask.Wait();
} }

@ -33,7 +33,7 @@
using System; using System;
namespace Google.GRPC.Core namespace Grpc.Core
{ {
// TODO: perhaps add also serverSideStreaming and clientSideStreaming // TODO: perhaps add also serverSideStreaming and clientSideStreaming

@ -34,7 +34,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace Google.GRPC.Core namespace Grpc.Core
{ {
public class ServerServiceDefinition public class ServerServiceDefinition
{ {

@ -34,7 +34,7 @@
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace Google.GRPC.Core namespace Grpc.Core
{ {
/// <summary> /// <summary>
/// Represents RPC result. /// Represents RPC result.

@ -33,22 +33,22 @@
using System; using System;
namespace Google.GRPC.Core namespace Grpc.Core
{ {
// TODO: element names should changed to comply with C# naming conventions. // TODO: element names should changed to comply with C# naming conventions.
/// <summary> /// <summary>
/// grpc_status_code from grpc/status.h /// based on grpc_status_code from grpc/status.h
/// </summary> /// </summary>
public enum StatusCode public enum StatusCode
{ {
/* Not an error; returned on success /* Not an error; returned on success
HTTP Mapping: 200 OK */ HTTP Mapping: 200 OK */
GRPC_STATUS_OK = 0, OK = 0,
/* The operation was cancelled (typically by the caller). /* The operation was cancelled (typically by the caller).
HTTP Mapping: 499 Client Closed Request */ HTTP Mapping: 499 Client Closed Request */
GRPC_STATUS_CANCELLED = 1, Cancelled = 1,
/* Unknown error. An example of where this error may be returned is /* Unknown error. An example of where this error may be returned is
if a Status value received from another address space belongs to if a Status value received from another address space belongs to
an error-space that is not known in this address space. Also an error-space that is not known in this address space. Also
@ -56,14 +56,14 @@ namespace Google.GRPC.Core
may be converted to this error. may be converted to this error.
HTTP Mapping: 500 Internal Server Error */ HTTP Mapping: 500 Internal Server Error */
GRPC_STATUS_UNKNOWN = 2, Unknown = 2,
/* Client specified an invalid argument. Note that this differs /* Client specified an invalid argument. Note that this differs
from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments
that are problematic regardless of the state of the system that are problematic regardless of the state of the system
(e.g., a malformed file name). (e.g., a malformed file name).
HTTP Mapping: 400 Bad Request */ HTTP Mapping: 400 Bad Request */
GRPC_STATUS_INVALID_ARGUMENT = 3, InvalidArgument = 3,
/* Deadline expired before operation could complete. For operations /* Deadline expired before operation could complete. For operations
that change the state of the system, this error may be returned that change the state of the system, this error may be returned
even if the operation has completed successfully. For example, a even if the operation has completed successfully. For example, a
@ -71,16 +71,16 @@ namespace Google.GRPC.Core
enough for the deadline to expire. enough for the deadline to expire.
HTTP Mapping: 504 Gateway Timeout */ HTTP Mapping: 504 Gateway Timeout */
GRPC_STATUS_DEADLINE_EXCEEDED = 4, DeadlineExceeded = 4,
/* Some requested entity (e.g., file or directory) was not found. /* Some requested entity (e.g., file or directory) was not found.
HTTP Mapping: 404 Not Found */ HTTP Mapping: 404 Not Found */
GRPC_STATUS_NOT_FOUND = 5, NotFound = 5,
/* Some entity that we attempted to create (e.g., file or directory) /* Some entity that we attempted to create (e.g., file or directory)
already exists. already exists.
HTTP Mapping: 409 Conflict */ HTTP Mapping: 409 Conflict */
GRPC_STATUS_ALREADY_EXISTS = 6, AlreadyExists = 6,
/* The caller does not have permission to execute the specified /* The caller does not have permission to execute the specified
operation. PERMISSION_DENIED must not be used for rejections operation. PERMISSION_DENIED must not be used for rejections
caused by exhausting some resource (use RESOURCE_EXHAUSTED caused by exhausting some resource (use RESOURCE_EXHAUSTED
@ -89,17 +89,17 @@ namespace Google.GRPC.Core
instead for those errors). instead for those errors).
HTTP Mapping: 403 Forbidden */ HTTP Mapping: 403 Forbidden */
GRPC_STATUS_PERMISSION_DENIED = 7, PermissionDenied = 7,
/* The request does not have valid authentication credentials for the /* The request does not have valid authentication credentials for the
operation. operation.
HTTP Mapping: 401 Unauthorized */ HTTP Mapping: 401 Unauthorized */
GRPC_STATUS_UNAUTHENTICATED = 16, Unauthenticated = 16,
/* Some resource has been exhausted, perhaps a per-user quota, or /* Some resource has been exhausted, perhaps a per-user quota, or
perhaps the entire file system is out of space. perhaps the entire file system is out of space.
HTTP Mapping: 429 Too Many Requests */ HTTP Mapping: 429 Too Many Requests */
GRPC_STATUS_RESOURCE_EXHAUSTED = 8, ResourceExhausted = 8,
/* Operation was rejected because the system is not in a state /* Operation was rejected because the system is not in a state
required for the operation's execution. For example, directory required for the operation's execution. For example, directory
to be deleted may be non-empty, an rmdir operation is applied to to be deleted may be non-empty, an rmdir operation is applied to
@ -126,7 +126,7 @@ namespace Google.GRPC.Core
the request contains Etag related headers. So if the server does see the request contains Etag related headers. So if the server does see
Etag related headers in the request, it may choose to return 412 Etag related headers in the request, it may choose to return 412
instead of 400 for this error code. */ instead of 400 for this error code. */
GRPC_STATUS_FAILED_PRECONDITION = 9, FailedPrecondition = 9,
/* The operation was aborted, typically due to a concurrency issue /* The operation was aborted, typically due to a concurrency issue
like sequencer check failures, transaction aborts, etc. like sequencer check failures, transaction aborts, etc.
@ -134,7 +134,7 @@ namespace Google.GRPC.Core
ABORTED, and UNAVAILABLE. ABORTED, and UNAVAILABLE.
HTTP Mapping: 409 Conflict */ HTTP Mapping: 409 Conflict */
GRPC_STATUS_ABORTED = 10, Aborted = 10,
/* Operation was attempted past the valid range. E.g., seeking or /* Operation was attempted past the valid range. E.g., seeking or
reading past end of file. reading past end of file.
@ -152,17 +152,17 @@ namespace Google.GRPC.Core
they are done. they are done.
HTTP Mapping: 400 Bad Request */ HTTP Mapping: 400 Bad Request */
GRPC_STATUS_OUT_OF_RANGE = 11, OutOfRange = 11,
/* Operation is not implemented or not supported/enabled in this service. /* Operation is not implemented or not supported/enabled in this service.
HTTP Mapping: 501 Not Implemented */ HTTP Mapping: 501 Not Implemented */
GRPC_STATUS_UNIMPLEMENTED = 12, Unimplemented = 12,
/* Internal errors. Means some invariants expected by underlying /* Internal errors. Means some invariants expected by underlying
system has been broken. If you see one of these errors, system has been broken. If you see one of these errors,
something is very broken. something is very broken.
HTTP Mapping: 500 Internal Server Error */ HTTP Mapping: 500 Internal Server Error */
GRPC_STATUS_INTERNAL = 13, Internal = 13,
/* The service is currently unavailable. This is a most likely a /* The service is currently unavailable. This is a most likely a
transient condition and may be corrected by retrying with transient condition and may be corrected by retrying with
a backoff. a backoff.
@ -171,13 +171,11 @@ namespace Google.GRPC.Core
ABORTED, and UNAVAILABLE. ABORTED, and UNAVAILABLE.
HTTP Mapping: 503 Service Unavailable */ HTTP Mapping: 503 Service Unavailable */
GRPC_STATUS_UNAVAILABLE = 14, Unavailable = 14,
/* Unrecoverable data loss or corruption. /* Unrecoverable data loss or corruption.
HTTP Mapping: 500 Internal Server Error */ HTTP Mapping: 500 Internal Server Error */
GRPC_STATUS_DATA_LOSS = 15, DataLoss = 15
/* Force users to include a default branch: */
GRPC_STATUS__DO_NOT_USE = -1
} }
} }

@ -32,10 +32,10 @@
#endregion #endregion
using System; using System;
using System.Threading.Tasks;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks;
namespace Google.GRPC.Core.Utils namespace Grpc.Core.Utils
{ {
public class RecordingObserver<T> : IObserver<T> public class RecordingObserver<T> : IObserver<T>
{ {

@ -36,7 +36,7 @@ using System.Threading.Tasks;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Concurrent; using System.Collections.Concurrent;
namespace Google.GRPC.Core.Utils namespace Grpc.Core.Utils
{ {
// TODO: replace this by something that implements IAsyncEnumerator. // TODO: replace this by something that implements IAsyncEnumerator.
/// <summary> /// <summary>

@ -32,15 +32,15 @@
#endregion #endregion
using System; using System;
using NUnit.Framework;
using Google.GRPC.Core;
using Google.GRPC.Core.Internal;
using System.Threading;
using System.Diagnostics; using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Google.GRPC.Core.Utils; using Grpc.Core;
using Grpc.Core.Internal;
using Grpc.Core.Utils;
using NUnit.Framework;
namespace Google.GRPC.Core.Tests namespace Grpc.Core.Tests
{ {
public class ClientServerTest public class ClientServerTest
{ {
@ -133,7 +133,7 @@ namespace Google.GRPC.Core.Tests
Calls.BlockingUnaryCall(call, "ABC", default(CancellationToken)); Calls.BlockingUnaryCall(call, "ABC", default(CancellationToken));
Assert.Fail(); Assert.Fail();
} catch(RpcException e) { } catch(RpcException e) {
Assert.AreEqual(StatusCode.GRPC_STATUS_UNIMPLEMENTED, e.Status.StatusCode); Assert.AreEqual(StatusCode.Unimplemented, e.Status.StatusCode);
} }
} }

@ -32,11 +32,11 @@
#endregion #endregion
using System; using System;
using NUnit.Framework;
using Google.GRPC.Core;
using System.Threading; using System.Threading;
using Grpc.Core;
using NUnit.Framework;
namespace Google.GRPC.Core.Tests namespace Grpc.Core.Tests
{ {
public class GrpcEnvironmentTest public class GrpcEnvironmentTest
{ {

@ -32,12 +32,12 @@
#endregion #endregion
using System; using System;
using Grpc.Core;
using Grpc.Core.Internal;
using Grpc.Core.Utils;
using NUnit.Framework; using NUnit.Framework;
using Google.GRPC.Core.Internal;
using Google.GRPC.Core;
using Google.GRPC.Core.Utils;
namespace Google.GRPC.Core.Tests namespace Grpc.Core.Tests
{ {
public class ServerTest public class ServerTest
{ {
@ -47,7 +47,7 @@ namespace Google.GRPC.Core.Tests
GrpcEnvironment.Initialize(); GrpcEnvironment.Initialize();
Server server = new Server(); Server server = new Server();
int port = server.AddPort("localhost:0"); server.AddPort("localhost:0");
server.Start(); server.Start();
server.ShutdownAsync().Wait(); server.ShutdownAsync().Wait();

@ -15,17 +15,17 @@
<results> <results>
<test-suite type="TestFixture" name="CallsTest" executed="True" result="Success" success="True" time="0.009" asserts="0"> <test-suite type="TestFixture" name="CallsTest" executed="True" result="Success" success="True" time="0.009" asserts="0">
<results> <results>
<test-case name="Google.GRPC.Core.Tests.CallsTest.Test1" executed="True" result="Success" success="True" time="0.004" asserts="0" /> <test-case name="Grpc.Core.Tests.CallsTest.Test1" executed="True" result="Success" success="True" time="0.004" asserts="0" />
</results> </results>
</test-suite> </test-suite>
<test-suite type="TestFixture" name="ClientServerTest" executed="True" result="Success" success="True" time="0.149" asserts="0"> <test-suite type="TestFixture" name="ClientServerTest" executed="True" result="Success" success="True" time="0.149" asserts="0">
<results> <results>
<test-case name="Google.GRPC.Core.Tests.ClientServerTest.EmptyCall" executed="True" result="Success" success="True" time="0.111" asserts="0" /> <test-case name="Grpc.Core.Tests.ClientServerTest.EmptyCall" executed="True" result="Success" success="True" time="0.111" asserts="0" />
</results> </results>
</test-suite> </test-suite>
<test-suite type="TestFixture" name="ServerTest" executed="True" result="Success" success="True" time="0.001" asserts="0"> <test-suite type="TestFixture" name="ServerTest" executed="True" result="Success" success="True" time="0.001" asserts="0">
<results> <results>
<test-case name="Google.GRPC.Core.Tests.ServerTest.StartAndShutdownServer" executed="True" result="Success" success="True" time="0.001" asserts="0" /> <test-case name="Grpc.Core.Tests.ServerTest.StartAndShutdownServer" executed="True" result="Success" success="True" time="0.001" asserts="0" />
</results> </results>
</test-suite> </test-suite>
</results> </results>

@ -32,11 +32,11 @@
#endregion #endregion
using System; using System;
using NUnit.Framework;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Google.GRPC.Core.Internal; using Grpc.Core.Internal;
using NUnit.Framework;
namespace Google.GRPC.Core.Internal.Tests namespace Grpc.Core.Internal.Tests
{ {
public class TimespecTest public class TimespecTest
{ {

@ -33,14 +33,14 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using NUnit.Framework;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using Google.GRPC.Core;
using Google.GRPC.Core.Utils;
using Google.ProtocolBuffers; using Google.ProtocolBuffers;
using Grpc.Core;
using Grpc.Core.Utils;
using NUnit.Framework;
using grpc.testing; using grpc.testing;
namespace Google.GRPC.Interop namespace Grpc.Interop
{ {
class Client class Client
{ {

@ -9,7 +9,7 @@
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<RootNamespace>InteropClient</RootNamespace> <RootNamespace>InteropClient</RootNamespace>
<AssemblyName>InteropClient</AssemblyName> <AssemblyName>InteropClient</AssemblyName>
<StartupObject>Google.GRPC.Interop.Client</StartupObject> <StartupObject>Grpc.Interop.Client</StartupObject>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
@ -33,14 +33,13 @@
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Google.ProtocolBuffers, Version=2.4.1.521, Culture=neutral, PublicKeyToken=55f7125234beb589, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Google.ProtocolBuffers.2.4.1.521\lib\net40\Google.ProtocolBuffers.dll</HintPath>
</Reference>
<Reference Include="nunit.framework"> <Reference Include="nunit.framework">
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath> <HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="Google.ProtocolBuffers">
<HintPath>..\packages\Google.ProtocolBuffers.2.4.1.521\lib\net40\Google.ProtocolBuffers.dll</HintPath>
</Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />

@ -33,8 +33,8 @@
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Google.GRPC.Core;
using System.Threading; using System.Threading;
using Grpc.Core;
namespace math namespace math
{ {

Loading…
Cancel
Save