grpc_metadata_array from grpc/grpc.h
상속: Grpc.Core.Internal.SafeHandleZeroIsInvalid
예제 #1
0
파일: AsyncCall.cs 프로젝트: yashykt/grpc
        /// <summary>
        /// Starts a streaming request - streaming response call.
        /// Use StartSendMessage and StartSendCloseFromClient to stream requests.
        /// </summary>
        public void StartDuplexStreamingCall()
        {
            lock (myLock)
            {
                bool callStartedOk = false;
                try
                {
                    GrpcPreconditions.CheckState(!started);
                    started = true;
                    receiveResponseHeadersPending = true;

                    Initialize(details.Channel.CompletionQueue);

                    streamingResponseCallFinishedTcs = new TaskCompletionSource <object>();
                    using (var metadataArray = MetadataArraySafeHandle.Create(details.Options.Headers))
                    {
                        call.StartDuplexStreaming(ReceivedStatusOnClientCallback, metadataArray, details.Options.Flags);
                        callStartedOk = true;
                    }
                    call.StartReceiveInitialMetadata(ReceivedResponseHeadersCallback);
                }
                finally
                {
                    if (!callStartedOk)
                    {
                        OnFailedToStartCallLocked();
                    }
                }
            }
        }
예제 #2
0
        public void StartDuplexStreaming(BatchCompletionDelegate callback, MetadataArraySafeHandle metadataArray)
        {
            var ctx = BatchContextSafeHandle.Create();

            GrpcEnvironment.CompletionRegistry.RegisterBatchCompletion(ctx, callback);
            grpcsharp_call_start_duplex_streaming(this, ctx, metadataArray).CheckOk();
        }
예제 #3
0
        /// <summary>
        /// Starts a unary request - streamed response call.
        /// </summary>
        public void StartServerStreamingCall(TRequest msg)
        {
            lock (myLock)
            {
                bool callStartedOk = false;
                try
                {
                    GrpcPreconditions.CheckState(!started);
                    started = true;

                    Initialize(details.Channel.CompletionQueue);

                    halfcloseRequested = true;

                    using (var serializationScope = DefaultSerializationContext.GetInitializedThreadLocalScope())
                    {
                        var payload = UnsafeSerialize(msg, serializationScope.Context);
                        streamingResponseCallFinishedTcs = new TaskCompletionSource <object>();
                        using (var metadataArray = MetadataArraySafeHandle.Create(details.Options.Headers))
                        {
                            call.StartServerStreaming(ReceivedStatusOnClientCallback, payload, GetWriteFlagsForCall(), metadataArray, details.Options.Flags);
                            callStartedOk = true;
                        }
                    }
                    call.StartReceiveInitialMetadata(ReceivedResponseHeadersCallback);
                }
                finally
                {
                    if (!callStartedOk)
                    {
                        OnFailedToStartCallLocked();
                    }
                }
            }
        }
예제 #4
0
파일: AsyncCall.cs 프로젝트: yashykt/grpc
        /// <summary>
        /// Starts a streamed request - unary response call.
        /// Use StartSendMessage and StartSendCloseFromClient to stream requests.
        /// </summary>
        public Task <TResponse> ClientStreamingCallAsync()
        {
            lock (myLock)
            {
                bool callStartedOk = false;
                try
                {
                    GrpcPreconditions.CheckState(!started);
                    started = true;

                    Initialize(details.Channel.CompletionQueue);

                    readingDone = true;

                    unaryResponseTcs = new TaskCompletionSource <TResponse>();
                    using (var metadataArray = MetadataArraySafeHandle.Create(details.Options.Headers))
                    {
                        call.StartClientStreaming(UnaryResponseClientCallback, metadataArray, details.Options.Flags);
                        callStartedOk = true;
                    }

                    return(unaryResponseTcs.Task);
                }
                finally
                {
                    if (!callStartedOk)
                    {
                        OnFailedToStartCallLocked();
                    }
                }
            }
        }
예제 #5
0
        /// <summary>
        /// Starts a unary request - unary response call.
        /// </summary>
        public Task <TResponse> UnaryCallAsync(TRequest msg)
        {
            lock (myLock)
            {
                bool callStartedOk = false;
                try
                {
                    GrpcPreconditions.CheckState(!started);
                    started = true;

                    Initialize(details.Channel.CompletionQueue);

                    halfcloseRequested = true;
                    readingDone        = true;

                    byte[] payload = UnsafeSerialize(msg);

                    unaryResponseTcs = new TaskCompletionSource <TResponse>();
                    using (var metadataArray = MetadataArraySafeHandle.Create(details.Options.Headers))
                    {
                        call.StartUnary(UnaryResponseClientCallback, payload, GetWriteFlagsForCall(), metadataArray, details.Options.Flags);
                        callStartedOk = true;
                    }

                    return(unaryResponseTcs.Task);
                }
                finally
                {
                    if (!callStartedOk)
                    {
                        OnFailedToStartCallLocked();
                    }
                }
            }
        }
        /// <summary>
        /// Sends call result status, indicating we are done with writes.
        /// Sending a status different from StatusCode.OK will also implicitly cancel the call.
        /// </summary>
        public Task SendStatusFromServerAsync(Status status, Metadata trailers, Tuple <TResponse, WriteFlags> optionalWrite)
        {
            byte[] payload = optionalWrite != null?UnsafeSerialize(optionalWrite.Item1) : null;

            var writeFlags = optionalWrite != null ? optionalWrite.Item2 : default(WriteFlags);

            lock (myLock)
            {
                GrpcPreconditions.CheckState(started);
                GrpcPreconditions.CheckState(!disposed);
                GrpcPreconditions.CheckState(!halfcloseRequested, "Can only send status from server once.");

                using (var metadataArray = MetadataArraySafeHandle.Create(trailers))
                {
                    call.StartSendStatusFromServer(HandleSendStatusFromServerFinished, status, metadataArray, !initialMetadataSent,
                                                   payload, writeFlags);
                }
                halfcloseRequested      = true;
                initialMetadataSent     = true;
                sendStatusFromServerTcs = new TaskCompletionSource <object>();
                if (optionalWrite != null)
                {
                    streamingWritesCounter++;
                }
                return(sendStatusFromServerTcs.Task);
            }
        }
예제 #7
0
 GRPCCallError IPlatformInvocation.grpcsharp_call_send_status_from_server(CallSafeHandle call,
                                                                          BatchContextSafeHandle ctx, StatusCode statusCode, string statusMessage,
                                                                          MetadataArraySafeHandle metadataArray, bool sendEmptyInitialMetadata)
 {
     return(grpcsharp_call_send_status_from_server(call, ctx, statusCode, statusMessage, metadataArray,
                                                   sendEmptyInitialMetadata));
 }
예제 #8
0
 GRPCCallError IPlatformInvocation.grpcsharp_call_start_server_streaming(CallSafeHandle call,
                                                                         BatchContextSafeHandle ctx, byte[] send_buffer, UIntPtr send_buffer_len,
                                                                         MetadataArraySafeHandle metadataArray, WriteFlags writeFlags)
 {
     return(grpcsharp_call_start_server_streaming(call, ctx, send_buffer, send_buffer_len, metadataArray,
                                                  writeFlags));
 }
 private IObservable <Unit> StartGetMetadata(AuthInterceptorContext context, IntPtr callbackPtr, IntPtr userDataPtr)
 {
     try
     {
         var metadata = new Metadata();
         return(interceptor(context, metadata)
                .ForEachAsync(_ =>
         {
             using (var metadataArray = MetadataArraySafeHandle.Create(metadata))
             {
                 Native.grpcsharp_metadata_credentials_notify_from_plugin(callbackPtr, userDataPtr, metadataArray, StatusCode.OK, null);
             }
         })
                .Catch((Exception e) =>
         {
             Native.grpcsharp_metadata_credentials_notify_from_plugin(callbackPtr, userDataPtr, MetadataArraySafeHandle.Create(Metadata.Empty), StatusCode.Unknown, GetMetadataExceptionMsg);
             Logger.Error(e, GetMetadataExceptionMsg);
             return Observable.ReturnUnit();     // no throw.
         }));
     }
     catch (Exception e)
     {
         Native.grpcsharp_metadata_credentials_notify_from_plugin(callbackPtr, userDataPtr, MetadataArraySafeHandle.Create(Metadata.Empty), StatusCode.Unknown, GetMetadataExceptionMsg);
         Logger.Error(e, GetMetadataExceptionMsg);
         return(Observable.ReturnUnit());
     }
 }
예제 #10
0
파일: AsyncCall.cs 프로젝트: mway08/grpc
        // TODO: this method is not Async, so it shouldn't be in AsyncCall class, but
        // it is reusing fair amount of code in this class, so we are leaving it here.
        // TODO: for other calls, you need to call Initialize, this methods calls initialize
        // on its own, so there's a usage inconsistency.
        /// <summary>
        /// Blocking unary request - unary response call.
        /// </summary>
        public TResponse UnaryCall(Channel channel, string methodName, TRequest msg, Metadata headers)
        {
            using (CompletionQueueSafeHandle cq = CompletionQueueSafeHandle.Create())
            {
                byte[] payload = UnsafeSerialize(msg);

                unaryResponseTcs = new TaskCompletionSource <TResponse>();

                lock (myLock)
                {
                    Initialize(channel, cq, methodName);
                    started            = true;
                    halfcloseRequested = true;
                    readingDone        = true;
                }

                using (var metadataArray = MetadataArraySafeHandle.Create(headers))
                {
                    call.BlockingUnary(cq, payload, unaryResponseHandler, metadataArray);
                }

                try
                {
                    // Once the blocking call returns, the result should be available synchronously.
                    return(unaryResponseTcs.Task.Result);
                }
                catch (AggregateException ae)
                {
                    throw ExceptionHelper.UnwrapRpcException(ae);
                }
            }
        }
예제 #11
0
        public void StartSendInitialMetadata(BatchCompletionDelegate callback, MetadataArraySafeHandle metadataArray)
        {
            var ctx = BatchContextSafeHandle.Create();

            completionRegistry.RegisterBatchCompletion(ctx, callback);
            grpcsharp_call_send_initial_metadata(this, ctx, metadataArray).CheckOk();
        }
예제 #12
0
        public void StartClientStreaming(BatchCompletionDelegate callback, MetadataArraySafeHandle metadataArray)
        {
            var ctx = BatchContextSafeHandle.Create();

            completionRegistry.RegisterBatchCompletion(ctx, callback);
            grpcsharp_call_start_client_streaming(this, ctx, metadataArray).CheckOk();
        }
예제 #13
0
        public void StartSendInitialMetadata(SendCompletionHandler callback, MetadataArraySafeHandle metadataArray)
        {
            var ctx = BatchContextSafeHandle.Create();

            completionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success));
            grpcsharp_call_send_initial_metadata(this, ctx, metadataArray).CheckOk();
        }
예제 #14
0
        public void StartClientStreaming(UnaryResponseClientHandler callback, MetadataArraySafeHandle metadataArray)
        {
            var ctx = BatchContextSafeHandle.Create();

            completionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success, context.GetReceivedStatusOnClient(), context.GetReceivedMessage(), context.GetReceivedInitialMetadata()));
            grpcsharp_call_start_client_streaming(this, ctx, metadataArray).CheckOk();
        }
예제 #15
0
        public void StartDuplexStreaming(ReceivedStatusOnClientHandler callback, MetadataArraySafeHandle metadataArray)
        {
            var ctx = BatchContextSafeHandle.Create();

            completionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success, context.GetReceivedStatusOnClient()));
            grpcsharp_call_start_duplex_streaming(this, ctx, metadataArray).CheckOk();
        }
예제 #16
0
        /// <summary>
        /// Initiates sending a initial metadata.
        /// Even though C-core allows sending metadata in parallel to sending messages, we will treat sending metadata as a send message operation
        /// to make things simpler.
        /// </summary>
        public Task SendInitialMetadataAsync(Metadata headers)
        {
            lock (myLock)
            {
                GrpcPreconditions.CheckNotNull(headers, "metadata");

                GrpcPreconditions.CheckState(started);
                GrpcPreconditions.CheckState(!initialMetadataSent, "Response headers can only be sent once per call.");
                GrpcPreconditions.CheckState(streamingWritesCounter == 0, "Response headers can only be sent before the first write starts.");

                var earlyResult = CheckSendAllowedOrEarlyResult();
                if (earlyResult != null)
                {
                    return(earlyResult);
                }

                using (var metadataArray = MetadataArraySafeHandle.Create(headers))
                {
                    call.StartSendInitialMetadata(SendCompletionCallback, metadataArray);
                }

                this.initialMetadataSent = true;
                streamingWriteTcs        = new TaskCompletionSource <object>();
                return(streamingWriteTcs.Task);
            }
        }
예제 #17
0
        /// <summary>
        /// Sends call result status, indicating we are done with writes.
        /// Sending a status different from StatusCode.OK will also implicitly cancel the call.
        /// </summary>
        public Task SendStatusFromServerAsync(Status status, Metadata trailers, ResponseWithFlags?optionalWrite)
        {
            using (var serializationScope = DefaultSerializationContext.GetInitializedThreadLocalScope())
            {
                var payload    = optionalWrite.HasValue ? UnsafeSerialize(optionalWrite.Value.Response, serializationScope.Context) : SliceBufferSafeHandle.NullInstance;
                var writeFlags = optionalWrite.HasValue ? optionalWrite.Value.WriteFlags : default(WriteFlags);

                lock (myLock)
                {
                    GrpcPreconditions.CheckState(started);
                    GrpcPreconditions.CheckState(!disposed);
                    GrpcPreconditions.CheckState(!halfcloseRequested, "Can only send status from server once.");

                    using (var metadataArray = MetadataArraySafeHandle.Create(trailers))
                    {
                        call.StartSendStatusFromServer(SendStatusFromServerCompletionCallback, status, metadataArray, !initialMetadataSent,
                                                       payload, writeFlags);
                    }
                    halfcloseRequested      = true;
                    initialMetadataSent     = true;
                    sendStatusFromServerTcs = new TaskCompletionSource <object>();
                    if (optionalWrite.HasValue)
                    {
                        streamingWritesCounter++;
                    }
                    return(sendStatusFromServerTcs.Task);
                }
            }
        }
 public void StartUnary(BatchContextSafeHandle ctx, byte[] payload, MetadataArraySafeHandle metadataArray, WriteFlags writeFlags)
 {
     using (Profilers.ForCurrentThread().NewScope("CallSafeHandle.StartUnary"))
     {
         Native.grpcsharp_call_start_unary(this, ctx, payload, new UIntPtr((ulong)payload.Length), metadataArray, writeFlags)
             .CheckOk();
     }
 }
예제 #19
0
 public void StartClientStreaming(IUnaryResponseClientCallback callback, MetadataArraySafeHandle metadataArray, CallFlags callFlags)
 {
     using (completionQueue.NewScope())
     {
         var ctx = completionQueue.CompletionRegistry.RegisterBatchCompletion(CompletionHandler_IUnaryResponseClientCallback, callback);
         Native.grpcsharp_call_start_client_streaming(this, ctx, metadataArray, callFlags).CheckOk();
     }
 }
예제 #20
0
 public void StartSendInitialMetadata(ISendCompletionCallback callback, MetadataArraySafeHandle metadataArray)
 {
     using (completionQueue.NewScope())
     {
         var ctx = completionQueue.CompletionRegistry.RegisterBatchCompletion(CompletionHandler_ISendCompletionCallback, callback);
         Native.grpcsharp_call_send_initial_metadata(this, ctx, metadataArray).CheckOk();
     }
 }
예제 #21
0
 public void StartDuplexStreaming(IReceivedStatusOnClientCallback callback, MetadataArraySafeHandle metadataArray, CallFlags callFlags)
 {
     using (completionQueue.NewScope())
     {
         var ctx = completionQueue.CompletionRegistry.RegisterBatchCompletion(CompletionHandler_IReceivedStatusOnClientCallback, callback);
         Native.grpcsharp_call_start_duplex_streaming(this, ctx, metadataArray, callFlags).CheckOk();
     }
 }
예제 #22
0
        public void StartUnary(byte[] payload, BatchCompletionDelegate callback, MetadataArraySafeHandle metadataArray)
        {
            var ctx = BatchContextSafeHandle.Create();

            completionRegistry.RegisterBatchCompletion(ctx, callback);
            grpcsharp_call_start_unary(this, ctx, payload, new UIntPtr((ulong)payload.Length), metadataArray)
            .CheckOk();
        }
예제 #23
0
 public void StartUnary(BatchContextSafeHandle ctx, byte[] payload, MetadataArraySafeHandle metadataArray, WriteFlags writeFlags)
 {
     using (Profilers.ForCurrentThread().NewScope("CallSafeHandle.StartUnary"))
     {
         Native.grpcsharp_call_start_unary(this, ctx, payload, new UIntPtr((ulong)payload.Length), metadataArray, writeFlags)
         .CheckOk();
     }
 }
예제 #24
0
        public void StartUnary(UnaryResponseClientHandler callback, byte[] payload, MetadataArraySafeHandle metadataArray, WriteFlags writeFlags)
        {
            var ctx = BatchContextSafeHandle.Create();

            completionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success, context.GetReceivedStatusOnClient(), context.GetReceivedMessage(), context.GetReceivedInitialMetadata()));
            grpcsharp_call_start_unary(this, ctx, payload, new UIntPtr((ulong)payload.Length), metadataArray, writeFlags)
            .CheckOk();
        }
 public void StartClientStreaming(UnaryResponseClientHandler callback, MetadataArraySafeHandle metadataArray)
 {
     using (completionQueue.NewScope())
     {
         var ctx = BatchContextSafeHandle.Create();
         completionQueue.CompletionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success, context.GetReceivedStatusOnClient(), context.GetReceivedMessage(), context.GetReceivedInitialMetadata()));
         Native.grpcsharp_call_start_client_streaming(this, ctx, metadataArray).CheckOk();
     }
 }
 public void StartUnary(UnaryResponseClientHandler callback, byte[] payload, MetadataArraySafeHandle metadataArray, WriteFlags writeFlags)
 {
     using (completionQueue.NewScope())
     {
         var ctx = BatchContextSafeHandle.Create();
         completionQueue.CompletionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success, context.GetReceivedStatusOnClient(), context.GetReceivedMessage(), context.GetReceivedInitialMetadata()));
         Native.grpcsharp_call_start_unary(this, ctx, payload, new UIntPtr((ulong)payload.Length), metadataArray, writeFlags)
             .CheckOk();
     }
 }
예제 #27
0
        // Gets data of recv_status_on_client completion.
        public ClientSideStatus GetReceivedStatusOnClient()
        {
            string details = Marshal.PtrToStringAnsi(grpcsharp_batch_context_recv_status_on_client_details(this));
            var    status  = new Status(grpcsharp_batch_context_recv_status_on_client_status(this), details);

            IntPtr metadataArrayPtr = grpcsharp_batch_context_recv_status_on_client_trailing_metadata(this);
            var    metadata         = MetadataArraySafeHandle.ReadMetadataFromPtrUnsafe(metadataArrayPtr);

            return(new ClientSideStatus(status, metadata));
        }
예제 #28
0
        // Gets data of recv_status_on_client completion.
        public ClientSideStatus GetReceivedStatusOnClient()
        {
            UIntPtr detailsLength;
            IntPtr  detailsPtr = Native.grpcsharp_batch_context_recv_status_on_client_details(this, out detailsLength);
            string  details    = MarshalUtils.PtrToStringUTF8(detailsPtr, (int)detailsLength.ToUInt32());
            var     status     = new Status(Native.grpcsharp_batch_context_recv_status_on_client_status(this), details);

            IntPtr metadataArrayPtr = Native.grpcsharp_batch_context_recv_status_on_client_trailing_metadata(this);
            var    metadata         = MetadataArraySafeHandle.ReadMetadataFromPtrUnsafe(metadataArrayPtr);

            return(new ClientSideStatus(status, metadata));
        }
예제 #29
0
        // TODO: this method is not Async, so it shouldn't be in AsyncCall class, but
        // it is reusing fair amount of code in this class, so we are leaving it here.
        /// <summary>
        /// Blocking unary request - unary response call.
        /// </summary>
        public TResponse UnaryCall(TRequest msg)
        {
            var profiler = Profilers.ForCurrentThread();

            using (profiler.NewScope("AsyncCall.UnaryCall"))
                using (CompletionQueueSafeHandle cq = CompletionQueueSafeHandle.CreateSync())
                {
                    byte[] payload = UnsafeSerialize(msg);

                    unaryResponseTcs = new TaskCompletionSource <TResponse>();

                    lock (myLock)
                    {
                        GrpcPreconditions.CheckState(!started);
                        started = true;
                        Initialize(cq);

                        halfcloseRequested = true;
                        readingDone        = true;
                    }

                    using (var metadataArray = MetadataArraySafeHandle.Create(details.Options.Headers))
                    {
                        var ctx = details.Channel.Environment.BatchContextPool.Lease();
                        try
                        {
                            call.StartUnary(ctx, payload, GetWriteFlagsForCall(), metadataArray, details.Options.Flags);
                            var  ev      = cq.Pluck(ctx.Handle);
                            bool success = (ev.success != 0);
                            try
                            {
                                using (profiler.NewScope("AsyncCall.UnaryCall.HandleBatch"))
                                {
                                    HandleUnaryResponse(success, ctx.GetReceivedStatusOnClient(), ctx.GetReceivedMessage(), ctx.GetReceivedInitialMetadata());
                                }
                            }
                            catch (Exception e)
                            {
                                Logger.Error(e, "Exception occurred while invoking completion delegate.");
                            }
                        }
                        finally
                        {
                            ctx.Recycle();
                        }
                    }

                    // Once the blocking call returns, the result should be available synchronously.
                    // Note that GetAwaiter().GetResult() doesn't wrap exceptions in AggregateException.
                    return(unaryResponseTcs.Task.GetAwaiter().GetResult());
                }
        }
예제 #30
0
        // Gets data of server_rpc_new completion.
        public ServerRpcNew GetServerRpcNew(Server server)
        {
            var call = grpcsharp_batch_context_server_rpc_new_call(this);

            var method   = Marshal.PtrToStringAnsi(grpcsharp_batch_context_server_rpc_new_method(this));
            var host     = Marshal.PtrToStringAnsi(grpcsharp_batch_context_server_rpc_new_host(this));
            var deadline = grpcsharp_batch_context_server_rpc_new_deadline(this);

            IntPtr metadataArrayPtr = grpcsharp_batch_context_server_rpc_new_request_metadata(this);
            var    metadata         = MetadataArraySafeHandle.ReadMetadataFromPtrUnsafe(metadataArrayPtr);

            return(new ServerRpcNew(server, call, method, host, deadline, metadata));
        }
예제 #31
0
파일: AsyncCall.cs 프로젝트: varung/grpc
        /// <summary>
        /// Starts a streaming request - streaming response call.
        /// Use StartSendMessage and StartSendCloseFromClient to stream requests.
        /// </summary>
        public void StartDuplexStreamingCall(Metadata headers)
        {
            lock (myLock)
            {
                Preconditions.CheckNotNull(call);

                started = true;

                using (var metadataArray = MetadataArraySafeHandle.Create(headers))
                {
                    call.StartDuplexStreaming(finishedHandler, metadataArray);
                }
            }
        }
예제 #32
0
        /// <summary>
        /// Starts a streaming request - streaming response call.
        /// Use StartSendMessage and StartSendCloseFromClient to stream requests.
        /// </summary>
        public void StartDuplexStreamingCall()
        {
            lock (myLock)
            {
                Preconditions.CheckState(!started);
                started = true;

                Initialize(details.Channel.Environment.CompletionQueue);

                using (var metadataArray = MetadataArraySafeHandle.Create(details.Options.Headers))
                {
                    call.StartDuplexStreaming(HandleFinished, metadataArray);
                }
            }
        }
예제 #33
0
        /// <summary>
        /// Starts a streaming request - streaming response call.
        /// Use StartSendMessage and StartSendCloseFromClient to stream requests.
        /// </summary>
        public void StartDuplexStreamingCall()
        {
            lock (myLock)
            {
                GrpcPreconditions.CheckState(!started);
                started = true;

                Initialize(details.Channel.CompletionQueue);

                using (var metadataArray = MetadataArraySafeHandle.Create(details.Options.Headers))
                {
                    call.StartDuplexStreaming(HandleFinished, metadataArray);
                }
                call.StartReceiveInitialMetadata(HandleReceivedResponseHeaders);
            }
        }
예제 #34
0
 public void StartUnary(UnaryResponseClientHandler callback, byte[] payload, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags callFlags)
 {
     UnaryResponseClientHandler = callback;
 }
예제 #35
0
 static extern GRPCCallError grpcsharp_call_start_server_streaming(CallSafeHandle call,
     BatchContextSafeHandle ctx, byte[] send_buffer, UIntPtr send_buffer_len,
     MetadataArraySafeHandle metadataArray, WriteFlags writeFlags);
예제 #36
0
 void IPlatformInvocation.grpcsharp_metadata_array_add(MetadataArraySafeHandle array, string key, byte[] value,
     UIntPtr valueLength)
 {
     grpcsharp_metadata_array_add(array, key, value, valueLength);
 }
예제 #37
0
 void IPlatformInvocation.grpcsharp_metadata_credentials_notify_from_plugin(IntPtr callbackPtr, IntPtr userData,
     MetadataArraySafeHandle metadataArray, StatusCode statusCode, string errorDetails)
 {
     grpcsharp_metadata_credentials_notify_from_plugin(callbackPtr, userData, metadataArray, statusCode,
         errorDetails);
 }
예제 #38
0
 GRPCCallError IPlatformInvocation.grpcsharp_call_start_duplex_streaming(CallSafeHandle call,
     BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray)
 {
     return grpcsharp_call_start_duplex_streaming(call, ctx, metadataArray);
 }
예제 #39
0
 GRPCCallError IPlatformInvocation.grpcsharp_call_send_initial_metadata(CallSafeHandle call,
     BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray)
 {
     return grpcsharp_call_send_initial_metadata(call, ctx, metadataArray);
 }
예제 #40
0
 public void StartSendStatusFromServer(SendCompletionHandler callback, Status status, MetadataArraySafeHandle metadataArray, bool sendEmptyInitialMetadata,
     byte[] optionalPayload, WriteFlags writeFlags)
 {
     SendStatusFromServerHandler = callback;
 }
예제 #41
0
 static extern GRPCCallError grpcsharp_call_send_initial_metadata(CallSafeHandle call,
     BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray);
예제 #42
0
 public void StartDuplexStreaming(ReceivedStatusOnClientHandler callback, MetadataArraySafeHandle metadataArray, CallFlags callFlags)
 {
     ReceivedStatusOnClientHandler = callback;
 }
예제 #43
0
 public void StartSendInitialMetadata(SendCompletionHandler callback, MetadataArraySafeHandle metadataArray)
 {
     SendCompletionHandler = callback;
 }
예제 #44
0
 public void StartServerStreaming(ReceivedStatusOnClientHandler callback, byte[] payload, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags callFlags)
 {
     ReceivedStatusOnClientHandler = callback;
 }
예제 #45
0
 public void StartClientStreaming(UnaryResponseClientHandler callback, MetadataArraySafeHandle metadataArray, CallFlags callFlags)
 {
     UnaryResponseClientHandler = callback;
 }
예제 #46
0
 public void StartUnary(BatchContextSafeHandle ctx, byte[] payload, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags callFlags)
 {
     throw new NotImplementedException();
 }
예제 #47
0
 static extern GRPCCallError grpcsharp_call_start_duplex_streaming(CallSafeHandle call,
     BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray);
예제 #48
0
 public void StartSendStatusFromServer(BatchCompletionDelegate callback, Status status, MetadataArraySafeHandle metadataArray, bool sendEmptyInitialMetadata)
 {
     var ctx = BatchContextSafeHandle.Create();
     completionRegistry.RegisterBatchCompletion(ctx, callback);
     grpcsharp_call_send_status_from_server(this, ctx, status.StatusCode, status.Detail, metadataArray, sendEmptyInitialMetadata).CheckOk();
 }
예제 #49
0
 static extern GRPCCallError grpcsharp_call_send_status_from_server(CallSafeHandle call,
     BatchContextSafeHandle ctx, StatusCode statusCode, string statusMessage, MetadataArraySafeHandle metadataArray, bool sendEmptyInitialMetadata);
 public void StartSendStatusFromServer(SendCompletionHandler callback, Status status, MetadataArraySafeHandle metadataArray, bool sendEmptyInitialMetadata,
     byte[] optionalPayload, WriteFlags writeFlags)
 {
     using (completionQueue.NewScope())
     {
         var ctx = BatchContextSafeHandle.Create();
         var optionalPayloadLength = optionalPayload != null ? new UIntPtr((ulong)optionalPayload.Length) : UIntPtr.Zero;
         completionQueue.CompletionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success));
         Native.grpcsharp_call_send_status_from_server(this, ctx, status.StatusCode, status.Detail, metadataArray, sendEmptyInitialMetadata,
             optionalPayload, optionalPayloadLength, writeFlags).CheckOk();
     }
 }
예제 #51
0
 GRPCCallError IPlatformInvocation.grpcsharp_call_start_server_streaming(CallSafeHandle call,
     BatchContextSafeHandle ctx, byte[] send_buffer, UIntPtr send_buffer_len,
     MetadataArraySafeHandle metadataArray, WriteFlags writeFlags)
 {
     return grpcsharp_call_start_server_streaming(call, ctx, send_buffer, send_buffer_len, metadataArray,
         writeFlags);
 }
 public void StartSendInitialMetadata(SendCompletionHandler callback, MetadataArraySafeHandle metadataArray)
 {
     using (completionQueue.NewScope())
     {
         var ctx = BatchContextSafeHandle.Create();
         completionQueue.CompletionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success));
         Native.grpcsharp_call_send_initial_metadata(this, ctx, metadataArray).CheckOk();
     }
 }
예제 #53
0
 GRPCCallError IPlatformInvocation.grpcsharp_call_send_status_from_server(CallSafeHandle call,
     BatchContextSafeHandle ctx, StatusCode statusCode, string statusMessage,
     MetadataArraySafeHandle metadataArray, bool sendEmptyInitialMetadata)
 {
     return grpcsharp_call_send_status_from_server(call, ctx, statusCode, statusMessage, metadataArray,
         sendEmptyInitialMetadata);
 }
예제 #54
0
 public void StartDuplexStreaming(BatchCompletionDelegate callback, MetadataArraySafeHandle metadataArray)
 {
     var ctx = BatchContextSafeHandle.Create();
     completionRegistry.RegisterBatchCompletion(ctx, callback);
     grpcsharp_call_start_duplex_streaming(this, ctx, metadataArray).CheckOk();
 }
예제 #55
0
 static extern void grpcsharp_metadata_array_add(MetadataArraySafeHandle array, string key, byte[] value, UIntPtr valueLength);
예제 #56
0
 public void StartSendInitialMetadata(BatchCompletionDelegate callback, MetadataArraySafeHandle metadataArray)
 {
     var ctx = BatchContextSafeHandle.Create();
     completionRegistry.RegisterBatchCompletion(ctx, callback);
     grpcsharp_call_send_initial_metadata(this, ctx, metadataArray).CheckOk();
 }
예제 #57
0
 static extern void grpcsharp_metadata_credentials_notify_from_plugin(IntPtr callbackPtr, IntPtr userData, MetadataArraySafeHandle metadataArray, StatusCode statusCode, string errorDetails);
예제 #58
0
 public void StartUnary(BatchContextSafeHandle ctx, byte[] payload, MetadataArraySafeHandle metadataArray, WriteFlags writeFlags)
 {
     grpcsharp_call_start_unary(this, ctx, payload, new UIntPtr((ulong)payload.Length), metadataArray, writeFlags)
         .CheckOk();
 }
예제 #59
0
 public void StartServerStreaming(BatchCompletionDelegate callback, byte[] payload, MetadataArraySafeHandle metadataArray, WriteFlags writeFlags)
 {
     var ctx = BatchContextSafeHandle.Create();
     completionRegistry.RegisterBatchCompletion(ctx, callback);
     grpcsharp_call_start_server_streaming(this, ctx, payload, new UIntPtr((ulong)payload.Length), metadataArray, writeFlags).CheckOk();
 }
예제 #60
0
 public void StartSendStatusFromServer(SendCompletionHandler callback, Status status, MetadataArraySafeHandle metadataArray, bool sendEmptyInitialMetadata)
 {
     SendCompletionHandler = callback;
 }