예제 #1
0
        public List <GpuNameCount> QueryGpuNameCounts(QueryGpuNameCountsRequest query, out int total)
        {
            List <KeyValuePair <GpuName, int> > list = new List <KeyValuePair <GpuName, int> >();
            bool isFilterByKeyword = !string.IsNullOrEmpty(query.Keyword);

            if (isFilterByKeyword)
            {
                foreach (var item in _gpuNameCountDic.OrderBy(a => a.Key.Name))
                {
                    if (item.Key.Name.Contains(query.Keyword))
                    {
                        list.Add(item);
                    }
                }
            }
            else
            {
                list.AddRange(_gpuNameCountDic);
            }
            total = list.Count;
            return(list.Take(paging: query).Select(a => new GpuNameCount {
                Name = a.Key.Name,
                Count = a.Value,
                GpuType = a.Key.GpuType,
                TotalMemory = a.Key.TotalMemory
            }).ToList());
        }
예제 #2
0
 public void QueryGpuNameCountsAsync(QueryGpuNameCountsRequest request, Action <QueryGpuNameCountsResponse, Exception> callback)
 {
     RpcRoot.JsonRpc.SignPostAsync(
         _controllerName,
         nameof(IAdminController.QueryGpuNameCounts),
         request,
         callback,
         timeountMilliseconds: 5 * 1000);
 }
예제 #3
0
        public QueryGpuNameCountsResponse QueryGpuNameCounts([FromBody] QueryGpuNameCountsRequest request)
        {
            if (request == null)
            {
                return(ResponseBase.InvalidInput <QueryGpuNameCountsResponse>("参数错误"));
            }
            request.PagingTrim();
            var data = AppRoot.GpuNameSet.QueryGpuNameCounts(request, out int total);

            return(QueryGpuNameCountsResponse.Ok(data, total));
        }
예제 #4
0
 public void QueryGpuNameCountsAsync(QueryGpuNameCountsRequest request, Action <QueryGpuNameCountsResponse, Exception> callback)
 {
     JsonRpcRoot.SignPostAsync(RpcRoot.OfficialServerHost, RpcRoot.OfficialServerPort, _controllerName, nameof(IGpuNameController.QueryGpuNameCounts), request, callback, timeountMilliseconds: 5 * 1000);
 }