OLD | NEW |
(Empty) | |
| 1 #region Copyright notice and license |
| 2 |
| 3 // Copyright 2015-2016, Google Inc. |
| 4 // All rights reserved. |
| 5 // |
| 6 // Redistribution and use in source and binary forms, with or without |
| 7 // modification, are permitted provided that the following conditions are |
| 8 // met: |
| 9 // |
| 10 // * Redistributions of source code must retain the above copyright |
| 11 // notice, this list of conditions and the following disclaimer. |
| 12 // * Redistributions in binary form must reproduce the above |
| 13 // copyright notice, this list of conditions and the following disclaimer |
| 14 // in the documentation and/or other materials provided with the |
| 15 // distribution. |
| 16 // * Neither the name of Google Inc. nor the names of its |
| 17 // contributors may be used to endorse or promote products derived from |
| 18 // this software without specific prior written permission. |
| 19 // |
| 20 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 21 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 22 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 23 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 24 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 25 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 26 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 27 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 28 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 29 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 30 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 |
| 32 #endregion |
| 33 |
| 34 using System; |
| 35 using System.Runtime.InteropServices; |
| 36 using Grpc.Core.Utils; |
| 37 |
| 38 namespace Grpc.Core.Internal |
| 39 { |
| 40 /// <summary> |
| 41 /// grpc_call_error from grpc/grpc.h |
| 42 /// </summary> |
| 43 internal enum GRPCCallError |
| 44 { |
| 45 /* everything went ok */ |
| 46 OK = 0, |
| 47 /* something failed, we don't know what */ |
| 48 Error, |
| 49 /* this method is not available on the server */ |
| 50 NotOnServer, |
| 51 /* this method is not available on the client */ |
| 52 NotOnClient, |
| 53 /* this method must be called before server_accept */ |
| 54 AlreadyAccepted, |
| 55 /* this method must be called before invoke */ |
| 56 AlreadyInvoked, |
| 57 /* this method must be called after invoke */ |
| 58 NotInvoked, |
| 59 /* this call is already finished |
| 60 (writes_done or write_status has already been called) */ |
| 61 AlreadyFinished, |
| 62 /* there is already an outstanding read/write operation on the call */ |
| 63 TooManyOperations, |
| 64 /* the flags value was illegal for this call */ |
| 65 InvalidFlags |
| 66 } |
| 67 |
| 68 internal static class CallErrorExtensions |
| 69 { |
| 70 /// <summary> |
| 71 /// Checks the call API invocation's result is OK. |
| 72 /// </summary> |
| 73 public static void CheckOk(this GRPCCallError callError) |
| 74 { |
| 75 GrpcPreconditions.CheckState(callError == GRPCCallError.OK, "Call er
ror: " + callError); |
| 76 } |
| 77 } |
| 78 |
| 79 /// <summary> |
| 80 /// grpc_completion_type from grpc/grpc.h |
| 81 /// </summary> |
| 82 internal enum GRPCCompletionType |
| 83 { |
| 84 /* Shutting down */ |
| 85 Shutdown, |
| 86 |
| 87 /* No event before timeout */ |
| 88 Timeout, |
| 89 |
| 90 /* operation completion */ |
| 91 OpComplete |
| 92 } |
| 93 |
| 94 /// <summary> |
| 95 /// gpr_clock_type from grpc/support/time.h |
| 96 /// </summary> |
| 97 internal enum GPRClockType |
| 98 { |
| 99 /* Monotonic clock */ |
| 100 Monotonic, |
| 101 |
| 102 /* Realtime clock */ |
| 103 Realtime, |
| 104 |
| 105 /* Precise clock good for performance profiling. */ |
| 106 Precise, |
| 107 |
| 108 /* Timespan - the distance between two time points */ |
| 109 Timespan |
| 110 } |
| 111 } |
OLD | NEW |