Example #1
0
        public SourceSearchResult(
            ILogSourceSearchWorkerInternal worker,
            ISearchResultInternal parent,
            CancellationToken cancellation,
            Progress.IProgressAggregator progress,
            Telemetry.ITelemetryCollector telemetryCollector
            )
        {
            this.searchWorker       = worker;
            this.parent             = parent;
            this.telemetryCollector = telemetryCollector;
            this.messages           = new MessagesContainers.ListBasedCollection();

            this.progressSink = progress.CreateProgressSink();
            this.workerTask   = Worker(cancellation, progressSink);
            AwaitWorker();
        }
Example #2
0
        MessagesContainers.ListBasedCollection ISourceSearchResultInternal.CreateMessagesSnapshot()
        {
            var status = ((ISourceSearchResultInternal)this).Status;

            if (status != SearchResultStatus.Active)
            {
                // if search state is terminal,
                // a reference to finalized immutable messages collection can be returned.
                return(lastMessagesSnapshot = messages);
            }
            // otherwise make an immutable snapshot

            // todo: consider making non-copying snapshot.
            // that requires a container that supports 3 operations
            // each to be invoked from one of 2 threads.
            // operations are: push_back(T), count(), at(int).
            // snapshot user thread would call count() to capture size, then at() to iterate.
            // search worker would call push_back().
            lock (messagesLock)
            {
                return(lastMessagesSnapshot = new MessagesContainers.ListBasedCollection(messages.Items));
            }
        }
Example #3
0
 void IDisposable.Dispose()
 {
     messages.Clear();
     lastMessagesSnapshot = null;
 }
Example #4
0
 public CombinedSourceSearchResult(ILogSource logSource)
 {
     this.logSource = logSource;
     this.messages  = new MessagesContainers.ListBasedCollection();
     this.sequentialMessagesPositions = new List <long>();
 }