Ejemplo n.º 1
0
        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();
            }
        }
Ejemplo n.º 2
0
        public DigestInfo Digest(Number640 from, Number640 to, int limit, bool ascending)
        {
            var digestInfo = new DigestInfo();
            var rLock      = RangeLock.Lock(from, to);

            try
            {
                var tmp = _backend.SubMap(from, to, limit, ascending);
                foreach (var kvp in tmp)
                {
                    if (!kvp.Value.HasPrepareFlag)
                    {
                        digestInfo.Put(kvp.Key, kvp.Value.BasedOnSet);
                    }
                }
                return(digestInfo);
            }
            finally
            {
                rLock.Unlock();
            }
        }
Ejemplo n.º 3
0
        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();
		    }
        }
Ejemplo n.º 4
0
        public DigestInfo Digest(ICollection<Number640> number640Collection)
        {
            var digestInfo = new DigestInfo();
		    foreach (var num640 in number640Collection)
            {
			    var rangeLock = Lock(num640);
			    try
                {
				    if (_backend.Contains(num640))
                    {
					    var data = GetInternal(num640);
					    if (data != null)
                        {
						    digestInfo.Put(num640, data.BasedOnSet);
					    }
				    }
			    }
                finally
                {
				    rangeLock.Unlock();
			    }
		    }
		    return digestInfo;
        }
Ejemplo n.º 5
0
        public DigestInfo Digest(Number640 from, Number640 to, int limit, bool ascending)
        {
            var digestInfo = new DigestInfo();
		    var rLock = RangeLock.Lock(from, to);
		    try
            {
			    var tmp = _backend.SubMap(from, to, limit, ascending);
			    foreach (var kvp in tmp)
                {
				    if (!kvp.Value.HasPrepareFlag)
                    {
					    digestInfo.Put(kvp.Key, kvp.Value.BasedOnSet);
				    }
			    }
			    return digestInfo;
		    }
            finally
            {
			    rLock.Unlock();
		    }
        }