コード例 #1
0
        async Task <SearchResult> ReadResultAsync(SearchResultMetadata metadata)
        {
            var reader = this.response.XmlReader;

            if (reader.NodeType == XmlNodeType.Element && reader.Name == "results")
            {
                return(null);
            }

            Debug.Assert(reader.ReadState <= ReadState.Interactive, string.Concat("ReadState: ", reader.ReadState));
            reader.MoveToElement();

            reader.EnsureMarkup(XmlNodeType.Element, "result", "response");

            if (reader.Name == "response")
            {
                await this.response.ThrowRequestExceptionAsync().ConfigureAwait(false);
            }

            var result = new SearchResult(metadata);
            await result.ReadXmlAsync(reader).ConfigureAwait(false);

            await reader.ReadAsync().ConfigureAwait(false);

            if (reader.NodeType == XmlNodeType.EndElement && reader.Name == "results")
            {
                await reader.ReadAsync().ConfigureAwait(false);
            }
            else
            {
                reader.EnsureMarkup(XmlNodeType.Element, "result");
            }

            return(result);
        }
コード例 #2
0
        async Task <SearchResultMetadata> ReadMetadataAsync()
        {
            var metadata = new SearchResultMetadata();
            var reader   = this.response.XmlReader;

            for (;;)
            {
                await metadata.ReadXmlAsync(reader).ConfigureAwait(false);

                if (metadata.FieldNames.Count > 0)
                {
                    break;
                }

                Debug.Assert(reader.Name == "results" && (reader.IsEmptyElement ||
                                                          reader.NodeType == XmlNodeType.EndElement),
                             "Expected: <results/> or </results>");

                var isEmptyElement = reader.IsEmptyElement;
                var readerNodeType = reader.NodeType;
                await reader.ReadAsync().ConfigureAwait(false);

                if (isEmptyElement || readerNodeType == XmlNodeType.EndElement)
                {
                    break;
                }
            }

            return(metadata);
        }
コード例 #3
0
        async Task <SearchResultMetadata> ReadMetadataAsync()
        {
            var metadata = new SearchResultMetadata();

            await metadata.ReadXmlAsync(this.response.XmlReader).ConfigureAwait(false);

            return(metadata);
        }
コード例 #4
0
 SearchResultStream(Response response)
 {
     this.metadata = SearchResultMetadata.Missing;
     this.response = response;
     this.awaiter  = new Awaiter(this);
 }
コード例 #5
0
 /// <summary>
 /// Initializes a new instance of the Splunk.Client.SearchResult class.
 /// </summary>
 /// <param name="metadata">
 /// The metadata.
 /// </param>
 internal SearchResult(SearchResultMetadata metadata)
 {
     this.metadata = metadata;
 }
コード例 #6
0
 /// <summary>
 /// Initializes a new instance of the Splunk.Client.SearchResult class.
 /// </summary>
 /// <param name="metadata">
 /// The metadata.
 /// </param>
 internal SearchResult(SearchResultMetadata metadata)
 {
     this.metadata = metadata;
 }