示例#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();

        }