Exemplo n.º 1
0
            private void UpdateReport()
            {
                using (_lockManager.ReadLock())
                {
                    long blockCount = _clusterIndex.Count;
                    long usingSpace = _fileStream.Length;

                    long lockSpace = 0;
                    {
                        foreach (var hash in _protectionManager.GetHashes())
                        {
                            if (_clusterIndex.TryGetValue(hash, out var clusterInfo))
                            {
                                lockSpace += clusterInfo.Indexes.Length * SectorSize;
                            }
                        }
                    }

                    long freeSpace = (_size - lockSpace);

                    _report = new CacheReport(blockCount, usingSpace, lockSpace, freeSpace);
                }
            }
Exemplo n.º 2
0
        public IEnumerable <CacheContentReport> GetCacheContentReports()
        {
            using (_lockManager.ReadLock())
            {
                var list = new List <CacheContentReport>();

                foreach (var info in _contentInfoManager.GetFileContentInfos())
                {
                    list.Add(new CacheContentReport(info.CreationTime, info.ShareInfo.FileLength, info.Metadata, info.ShareInfo.Path));
                }

                return(list);
            }
        }
Exemplo n.º 3
0
            public IEnumerable <Signature> GetBroadcastSignatures()
            {
                using (_lockManager.ReadLock())
                {
                    var hashset = new HashSet <Signature>();

                    hashset.UnionWith(_broadcastMetadatas.Values.SelectMany(n => n.Keys));

                    return(hashset);
                }
            }