public SortedDictionary <Number640, Data> Get(Number640 from, Number640 to, SimpleBloomFilter <Number160> contentKeyBloomFilter, SimpleBloomFilter <Number160> versionKeyBloomFilter, SimpleBloomFilter <Number160> contentBloomFilter, int limit, bool ascending, bool isBloomFilterAnd) { var rLock = RangeLock.Lock(from, to); try { var tmp = _backend.SubMap(from, to, limit, ascending); foreach (var kvp in tmp.ToList()) // iterate over copy { // remove from original if (kvp.Value.HasPrepareFlag) { tmp.Remove(kvp.Key); continue; } if (isBloomFilterAnd) { if (!contentKeyBloomFilter.Contains(kvp.Key.ContentKey)) { tmp.Remove(kvp.Key); continue; } if (!versionKeyBloomFilter.Contains(kvp.Key.VersionKey)) { tmp.Remove(kvp.Key); continue; } if (!contentBloomFilter.Contains(kvp.Value.Hash)) { tmp.Remove(kvp.Key); } } else { if (contentKeyBloomFilter.Contains(kvp.Key.ContentKey)) { tmp.Remove(kvp.Key); continue; } if (versionKeyBloomFilter.Contains(kvp.Key.VersionKey)) { tmp.Remove(kvp.Key); continue; } if (contentBloomFilter.Contains(kvp.Value.Hash)) { tmp.Remove(kvp.Key); } } } return(tmp); } finally { rLock.Unlock(); } }
public DigestInfo Digest(Number320 locationAndDomainKey, SimpleBloomFilter <Number160> keyBloomFilter, SimpleBloomFilter <Number160> contentBloomFilter, int limit, bool ascending, bool isBloomFilterAnd) { var digestInfo = new DigestInfo(); var rLock = Lock(locationAndDomainKey); try { var from = new Number640(locationAndDomainKey, Number160.Zero, Number160.Zero); var to = new Number640(locationAndDomainKey, Number160.MaxValue, Number160.MaxValue); var tmp = _backend.SubMap(from, to, limit, ascending); foreach (var kvp in tmp) { if (isBloomFilterAnd) { if (keyBloomFilter == null || keyBloomFilter.Contains(kvp.Key.ContentKey)) { if (contentBloomFilter == null || contentBloomFilter.Contains(kvp.Value.Hash)) { if (!kvp.Value.HasPrepareFlag) { digestInfo.Put(kvp.Key, kvp.Value.BasedOnSet); } } } } else { if (keyBloomFilter == null || !keyBloomFilter.Contains(kvp.Key.ContentKey)) { if (contentBloomFilter == null || !contentBloomFilter.Contains(kvp.Value.Hash)) { if (!kvp.Value.HasPrepareFlag) { digestInfo.Put(kvp.Key, kvp.Value.BasedOnSet); } } } } } return(digestInfo); } finally { rLock.Unlock(); } }
public DigestInfo Digest(Number320 locationAndDomainKey, SimpleBloomFilter<Number160> keyBloomFilter, SimpleBloomFilter<Number160> contentBloomFilter, int limit, bool ascending, bool isBloomFilterAnd) { var digestInfo = new DigestInfo(); var rLock = Lock(locationAndDomainKey); try { var from = new Number640(locationAndDomainKey, Number160.Zero, Number160.Zero); var to = new Number640(locationAndDomainKey, Number160.MaxValue, Number160.MaxValue); var tmp = _backend.SubMap(from, to, limit, ascending); foreach (var kvp in tmp) { if (isBloomFilterAnd) { if (keyBloomFilter == null || keyBloomFilter.Contains(kvp.Key.ContentKey)) { if (contentBloomFilter == null || contentBloomFilter.Contains(kvp.Value.Hash)) { if (!kvp.Value.HasPrepareFlag) { digestInfo.Put(kvp.Key, kvp.Value.BasedOnSet); } } } } else { if (keyBloomFilter == null || !keyBloomFilter.Contains(kvp.Key.ContentKey)) { if (contentBloomFilter == null || !contentBloomFilter.Contains(kvp.Value.Hash)) { if (!kvp.Value.HasPrepareFlag) { digestInfo.Put(kvp.Key, kvp.Value.BasedOnSet); } } } } } return digestInfo; } finally { rLock.Unlock(); } }
public SortedDictionary<Number640, Data> Get(Number640 from, Number640 to, SimpleBloomFilter<Number160> contentKeyBloomFilter, SimpleBloomFilter<Number160> versionKeyBloomFilter, SimpleBloomFilter<Number160> contentBloomFilter, int limit, bool ascending, bool isBloomFilterAnd) { var rLock = RangeLock.Lock(from, to); try { var tmp = _backend.SubMap(from, to, limit, ascending); foreach (var kvp in tmp.ToList()) // iterate over copy { // remove from original if (kvp.Value.HasPrepareFlag) { tmp.Remove(kvp.Key); continue; } if (isBloomFilterAnd) { if (!contentKeyBloomFilter.Contains(kvp.Key.ContentKey)) { tmp.Remove(kvp.Key); continue; } if (!versionKeyBloomFilter.Contains(kvp.Key.VersionKey)) { tmp.Remove(kvp.Key); continue; } if (!contentBloomFilter.Contains(kvp.Value.Hash)) { tmp.Remove(kvp.Key); } } else { if (contentKeyBloomFilter.Contains(kvp.Key.ContentKey)) { tmp.Remove(kvp.Key); continue; } if (versionKeyBloomFilter.Contains(kvp.Key.VersionKey)) { tmp.Remove(kvp.Key); continue; } if (contentBloomFilter.Contains(kvp.Value.Hash)) { tmp.Remove(kvp.Key); } } } return tmp; } finally { rLock.Unlock(); } }