예제 #1
0
        public CallSafeHandle CreateCall(CompletionRegistry registry, CallSafeHandle parentCall, ContextPropagationFlags propagationMask, CompletionQueueSafeHandle cq, string method, string host, Timespec deadline)
        {
            var result = grpcsharp_channel_create_call(this, parentCall, propagationMask, cq, method, host, deadline);

            result.SetCompletionRegistry(registry);
            return(result);
        }
예제 #2
0
 public void WatchConnectivityState(ChannelState lastObservedState, Timespec deadline, CompletionQueueSafeHandle cq,
     CompletionRegistry completionRegistry, BatchCompletionDelegate callback)
 {
     var ctx = BatchContextSafeHandle.Create();
     completionRegistry.RegisterBatchCompletion(ctx, callback);
     Native.grpcsharp_channel_watch_connectivity_state(this, lastObservedState, deadline, cq, ctx);
 }
예제 #3
0
        /// <summary>
        /// Create a completion queue that can only be used for Next operations.
        /// </summary>
        public static CompletionQueueSafeHandle CreateAsync(CompletionRegistry completionRegistry)
        {
            var cq = Native.grpcsharp_completion_queue_create_async();

            cq.completionRegistry = completionRegistry;
            return(cq);
        }
예제 #4
0
        public static CallSafeHandle Create(ChannelSafeHandle channel, CompletionRegistry registry, CompletionQueueSafeHandle cq, string method, string host, Timespec deadline)
        {
            var result = grpcsharp_channel_create_call(channel, cq, method, host, deadline);

            result.SetCompletionRegistry(registry);
            return(result);
        }
예제 #5
0
        public void WatchConnectivityState(ChannelState lastObservedState, Timespec deadline, CompletionQueueSafeHandle cq,
                                           CompletionRegistry completionRegistry, BatchCompletionDelegate callback)
        {
            var ctx = BatchContextSafeHandle.Create();

            completionRegistry.RegisterBatchCompletion(ctx, callback);
            grpcsharp_channel_watch_connectivity_state(this, lastObservedState, deadline, cq, ctx);
        }
        /// <summary>
        /// Create a completion queue that can only be used for Next operations.
        /// </summary>
        public static CompletionQueueSafeHandle CreateAsync(CompletionRegistry completionRegistry)
        {
            var cq = Native.grpcsharp_completion_queue_create_async();

            cq.completionRegistry = completionRegistry;
            cq.shutdownRefcount   = new AtomicCounter(1);
            return(cq);
        }
예제 #7
0
 /// <summary>
 /// Creates gRPC environment.
 /// </summary>
 private GrpcEnvironment()
 {
     GrpcLog.RedirectNativeLogs(Console.Error);
     grpcsharp_init();
     completionRegistry = new CompletionRegistry();
     threadPool = new GrpcThreadPool(THREAD_POOL_SIZE);
     threadPool.Start();
     // TODO: use proper logging here
     Console.WriteLine("GRPC initialized.");
 }
예제 #8
0
 /// <summary>
 /// Creates gRPC environment.
 /// </summary>
 private GrpcEnvironment()
 {
     NativeLogRedirector.Redirect();
     grpcsharp_init();
     completionRegistry = new CompletionRegistry(this);
     threadPool = new GrpcThreadPool(this, THREAD_POOL_SIZE);
     threadPool.Start();
     // TODO: use proper logging here
     Logger.Info("gRPC initialized.");
 }
예제 #9
0
        private static IReadOnlyCollection <CompletionQueueSafeHandle> CreateCompletionQueueList(GrpcEnvironment environment, int completionQueueCount)
        {
            var list = new List <CompletionQueueSafeHandle>();

            for (int i = 0; i < completionQueueCount; i++)
            {
                var completionRegistry = new CompletionRegistry(environment);
                list.Add(CompletionQueueSafeHandle.CreateAsync(completionRegistry));
            }
            return(list.AsReadOnly());
        }
예제 #10
0
 public CallSafeHandle CreateCall(CompletionRegistry registry, CallSafeHandle parentCall, ContextPropagationFlags propagationMask, CompletionQueueSafeHandle cq, string method, string host, Timespec deadline, CallCredentialsSafeHandle credentials)
 {
     using (Profilers.ForCurrentThread().NewScope("ChannelSafeHandle.CreateCall"))
     {
         var result = Native.grpcsharp_channel_create_call(this, parentCall, propagationMask, cq, method, host, deadline);
         if (credentials != null)
         {
             result.SetCredentials(credentials);
         }
         result.Initialize(registry, cq);
         return(result);
     }
 }
예제 #11
0
 public CallSafeHandle CreateCall(CompletionRegistry registry, CallSafeHandle parentCall, ContextPropagationFlags propagationMask, CompletionQueueSafeHandle cq, string method, string host, Timespec deadline, CredentialsSafeHandle credentials)
 {
     using (Profilers.ForCurrentThread().NewScope("ChannelSafeHandle.CreateCall"))
     {
         var result = grpcsharp_channel_create_call(this, parentCall, propagationMask, cq, method, host, deadline);
         if (credentials != null)
         {
             result.SetCredentials(credentials);
         }
         result.SetCompletionRegistry(registry);
         return result;
     }
 }
예제 #12
0
 public CallSafeHandle CreateCall(CompletionRegistry registry, CompletionQueueSafeHandle cq, string method, string host, Timespec deadline)
 {
     var result = grpcsharp_channel_create_call(this, cq, method, host, deadline);
     result.SetCompletionRegistry(registry);
     return result;
 }
 private static IReadOnlyCollection<CompletionQueueSafeHandle> CreateCompletionQueueList(GrpcEnvironment environment, int completionQueueCount)
 {
     var list = new List<CompletionQueueSafeHandle>();
     for (int i = 0; i < completionQueueCount; i++)
     {
         var completionRegistry = new CompletionRegistry(environment);
         list.Add(CompletionQueueSafeHandle.Create(completionRegistry));
     }
     return list.AsReadOnly();
 }
예제 #14
0
 public void SetCompletionRegistry(CompletionRegistry completionRegistry)
 {
     this.completionRegistry = completionRegistry;
 }
예제 #15
0
 public void Initialize(CompletionRegistry completionRegistry, CompletionQueueSafeHandle completionQueue)
 {
     this.completionRegistry = completionRegistry;
     this.completionQueue = completionQueue;
 }
예제 #16
0
 public void SetCompletionRegistry(CompletionRegistry completionRegistry)
 {
     this.completionRegistry = completionRegistry;
 }
예제 #17
0
 /// <summary>
 /// Creates gRPC environment.
 /// </summary>
 private GrpcEnvironment()
 {
     GrpcNativeInit();
     completionRegistry = new CompletionRegistry(this);
     threadPool = new GrpcThreadPool(this, THREAD_POOL_SIZE);
     threadPool.Start();
 }
예제 #18
0
 public static CompletionQueueSafeHandle Create(CompletionRegistry completionRegistry)
 {
     var cq = Native.grpcsharp_completion_queue_create();
     cq.completionRegistry = completionRegistry;
     return cq;
 }
예제 #19
0
 public void Initialize(CompletionRegistry completionRegistry, CompletionQueueSafeHandle completionQueue)
 {
     this.completionRegistry = completionRegistry;
     this.completionQueue    = completionQueue;
 }
예제 #20
0
 public CallSafeHandle CreateCall(CompletionRegistry registry, CallSafeHandle parentCall, ContextPropagationFlags propagationMask, CompletionQueueSafeHandle cq, string method, string host, Timespec deadline)
 {
     var result = grpcsharp_channel_create_call(this, parentCall, propagationMask, cq, method, host, deadline);
     result.SetCompletionRegistry(registry);
     return result;
 }
예제 #21
0
        /// <summary>
        /// Creates gRPC environment.
        /// </summary>
        private GrpcEnvironment()
        {
            NativeLogRedirector.Redirect();
            GrpcNativeInit();
            completionRegistry = new CompletionRegistry(this);
            threadPool = new GrpcThreadPool(this, _threadPoolSize);
            threadPool.Start();

        }