Esempio n. 1
0
        public static void CalculateCaches(InputModel input, BufferModel bufferModel)
        {
            List <VideoServerRankModel> filteredVideoServerRank = CheckCacheSize(bufferModel, input.Videos.ToList(), input.CacheSize);

            List <CacheServer> cacheServers = input.ChaceServers.ToList();

            for (int i = 0; i < filteredVideoServerRank.Count; i++)
            {
                VideoServerRankModel vsr = filteredVideoServerRank[i];
                Video       video        = input.Videos[vsr.VideoId];
                CacheServer cacheServer  = cacheServers[vsr.ServerId];

                if (cacheServer.CanAdd(video))
                {
                    cacheServer.AddVideo(video);
                }
            }

            cacheServers = cacheServers.Where(s => s.Videos.Count != 0).ToList();

            WriteFile(cacheServers);
        }
Esempio n. 2
0
 public void AddVideoServerRank(VideoServerRankModel vsr)
 {
     List.Add(vsr);
 }