コード例 #1
0
        public void Reduce(
            string index,
            AbstractViewGenerator viewGenerator,
            IEnumerable <IGrouping <int, object> > mappedResults,
            int level,
            WorkContext context,
            IStorageActionsAccessor actions,
            HashSet <string> reduceKeys)
        {
            Index value;

            if (indexes.TryGetValue(index, out value) == false)
            {
                log.Debug("Tried to index on a non existent index {0}, ignoring", index);
                return;
            }
            var mapReduceIndex = value as MapReduceIndex;

            if (mapReduceIndex == null)
            {
                log.Warn("Tried to reduce on an index that is not a map/reduce index: {0}, ignoring", index);
                return;
            }
            using (EnsureInvariantCulture())
            {
                var reduceDocuments = new MapReduceIndex.ReduceDocuments(mapReduceIndex, viewGenerator, mappedResults, level, context, actions, reduceKeys);
                reduceDocuments.ExecuteReduction();
                context.RaiseIndexChangeNotification(new IndexChangeNotification
                {
                    Name = index,
                    Type = IndexChangeTypes.ReduceCompleted
                });
            }
        }
コード例 #2
0
ファイル: IndexStorage.cs プロジェクト: felipeleusin/ravendb
		public IndexingPerformanceStats Reduce(
			int index,
			AbstractViewGenerator viewGenerator,
			IEnumerable<IGrouping<int, object>> mappedResults,
			int level,
			WorkContext context,
			IStorageActionsAccessor actions,
			HashSet<string> reduceKeys,
			int inputCount)
		{
			Index value = indexes[index];
			if (value == null)
			{
				log.Debug("Tried to index on a non existent index {0}, ignoring", index);
				return null;
			}
			var mapReduceIndex = value as MapReduceIndex;
			if (mapReduceIndex == null)
			{
				log.Warn("Tried to reduce on an index that is not a map/reduce index: {0}, ignoring", index);
				return null;
			}
			using (EnsureInvariantCulture())
			{
				var reduceDocuments = new MapReduceIndex.ReduceDocuments(mapReduceIndex, viewGenerator, mappedResults, level, context, actions, reduceKeys, inputCount);

				var performance = reduceDocuments.ExecuteReduction();

				context.RaiseIndexChangeNotification(new IndexChangeNotification
				{
					Name = value.PublicName,
					Type = IndexChangeTypes.ReduceCompleted
				});

				return performance;
			}
		}
コード例 #3
0
ファイル: IndexStorage.cs プロジェクト: synhershko/ravendb
		public void Reduce(
			string index, 
			AbstractViewGenerator viewGenerator, 
			IEnumerable<IGrouping<int, object>> mappedResults,
			int level,
			WorkContext context, 
			IStorageActionsAccessor actions,
			HashSet<string> reduceKeys)
		{
			Index value;
			if (indexes.TryGetValue(index, out value) == false)
			{
				log.Debug("Tried to index on a non existent index {0}, ignoring", index);
				return;
			}
			var mapReduceIndex = value as MapReduceIndex;
			if (mapReduceIndex == null)
			{
				log.Warn("Tried to reduce on an index that is not a map/reduce index: {0}, ignoring", index);
				return;
			}
			using (EnsureInvariantCulture())
			{
				var reduceDocuments = new MapReduceIndex.ReduceDocuments(mapReduceIndex, viewGenerator, mappedResults, level, context, actions, reduceKeys);
				reduceDocuments.ExecuteReduction();
				context.RaiseIndexChangeNotification(new IndexChangeNotification
				{
					Name = index,
					Type = IndexChangeTypes.ReduceCompleted
				});
			}
		}