Esempio n. 1
0
        public override Task <DefectsResponse> GetDefects(DefectsRequest request, ServerCallContext context)
        {
            var wafer        = new Query().GetWafer(request.WaferId);
            var defsResponse = new DefectsResponse();

            foreach (var def in wafer.Defects)
            {
                defsResponse.Defects.Add(CreateDefect(def));
            }
            return(Task.FromResult(defsResponse));
        }
Esempio n. 2
0
 public override async Task GetDefectsStream(DefectsRequest request,
                                             IServerStreamWriter <DefectsResponse> responseStream, ServerCallContext context)
 {
     using (var buffer = new BlockingCollection <DefectsResponse>())
     {
         using (var producer = Task.Factory.StartNew(() => { ProduceDefects(request.WaferId, buffer); }))
         {
             foreach (var defectsResponse in buffer.GetConsumingEnumerable())
             {
                 await responseStream.WriteAsync(defectsResponse);
             }
             producer.Wait();
         }
     }
 }
Esempio n. 3
0
        public override Task <DefectsResponse> GetDefects(DefectsRequest request, ServerCallContext context)
        {
            var sw = new Stopwatch();

            sw.Start();
            var wafer        = new Query().GetWafer(request.WaferId);
            var defsResponse = new DefectsResponse();
            var defCount     = wafer.Defects.Count;

            for (var idx = 0; idx < defCount; idx++)
            {
                defsResponse.Defects.Add(CreateDefect(wafer.Defects[idx]));
            }
            sw.Stop();
            Console.WriteLine($"Data preparation time {sw.ElapsedMilliseconds} ms");
            return(Task.FromResult(defsResponse));
        }