Exemplo n.º 1
0
		private ExecutingQueryInfo AddToCurrentlyRunningQueryList(string index, IndexQuery query, CancellationTokenSource externalTokenSource)
		{
			var set = WorkContext.CurrentlyRunningQueries.GetOrAdd(index, x => new ConcurrentSet<ExecutingQueryInfo>());
			var queryStartTime = DateTime.UtcNow;
			var queryId = WorkContext.GetNextQueryId();
			var executingQueryInfo = new ExecutingQueryInfo(queryStartTime, query, queryId, externalTokenSource);
			set.Add(executingQueryInfo);
			return executingQueryInfo;
		}
Exemplo n.º 2
0
		private void RemoveFromCurrentlyRunningQueryList(string index, ExecutingQueryInfo queryStat)
		{
			ConcurrentSet<ExecutingQueryInfo> set;
			if (WorkContext.CurrentlyRunningQueries.TryGetValue(index, out set) == false)
				return;

			set.TryRemove(queryStat);
		}
Exemplo n.º 3
0
 private ExecutingQueryInfo AddToCurrentlyRunningQueryList(string index, IndexQuery query)
 {
     var set = WorkContext.CurrentlyRunningQueries.GetOrAdd(index, x => new ConcurrentSet<ExecutingQueryInfo>());
     var queryStartTime = DateTime.UtcNow;
     var executingQueryInfo = new ExecutingQueryInfo(queryStartTime, query);
     set.Add(executingQueryInfo);
     return executingQueryInfo;
 }
Exemplo n.º 4
0
			public DatabaseQueryOperation(DocumentDatabase database, string indexName, IndexQuery query, IStorageActionsAccessor actions, CancellationTokenSource cancellationTokenSource)
			{
				this.database = database;
				this.indexName = indexName != null ? indexName.Trim() : null;
				this.query = query;
				this.actions = actions;
				cancellationToken = cancellationTokenSource.Token;
				queryStat = database.Queries.AddToCurrentlyRunningQueryList(indexName, query, cancellationTokenSource);

				if (query.ShowTimings == false)
					return;

				executionTimes[QueryTimings.Lucene] = 0;
				executionTimes[QueryTimings.LoadDocuments] = 0;
				executionTimes[QueryTimings.TransformResults] = 0;
			}
Exemplo n.º 5
0
 public DatabaseQueryOperation(DocumentDatabase database, string indexName, IndexQuery query, IStorageActionsAccessor actions, CancellationToken cancellationToken)
 {
     this.database = database;
     this.indexName = indexName != null ? indexName.Trim() : null;
     this.query = query;
     this.actions = actions;
     this.cancellationToken = cancellationToken;
     queryStat = database.Queries.AddToCurrentlyRunningQueryList(indexName, query);
 }