public IEnumerator <StreamResult <T> > Stream <T>(IDocumentQuery <T> query) { var streamOperation = new StreamOperation(this); var command = streamOperation.CreateRequest(query.GetIndexQuery()); RequestExecutor.Execute(command, Context, sessionInfo: _sessionInfo); var result = streamOperation.SetResult(command.Result); return(YieldResults(query, result)); }
private IEnumerator <TimeSeriesStreamResult <T> > StreamTimeSeriesInternal <T>(IDocumentQuery <T> query) where T : ITimeSeriesQueryStreamResult, new() { var streamOperation = new StreamOperation(this); var command = streamOperation.CreateRequest(query.GetIndexQuery()); RequestExecutor.Execute(command, Context, sessionInfo: _sessionInfo); var result = streamOperation.SetResultForTimeSeries(command.Result); return(YieldTimeSeriesResults(query, result)); }
public async Task <IAsyncEnumerator <StreamResult <T> > > StreamAsync <T>(string startsWith, string matches = null, int start = 0, int pageSize = int.MaxValue, string startAfter = null, CancellationToken token = default) { var streamOperation = new StreamOperation(this); var command = streamOperation.CreateRequest(startsWith, matches, start, pageSize, null, startAfter); await RequestExecutor.ExecuteAsync(command, Context, SessionInfo, token).ConfigureAwait(false); var result = streamOperation.SetResultAsync(command.Result); return(new YieldStream <T>(this, null, null, result, token)); }
public async Task StreamIntoAsync <T>(IAsyncDocumentQuery <T> query, Stream output, CancellationToken token = default) { var streamOperation = new StreamOperation(this); var command = streamOperation.CreateRequest(query.GetIndexQuery()); await RequestExecutor.ExecuteAsync(command, Context, SessionInfo, token).ConfigureAwait(false); using (command.Result.Response) using (command.Result.Stream) { await command.Result.Stream.CopyToAsync(output, 16 * 1024, token).ConfigureAwait(false); } }
public void StreamInto <T>(IDocumentQuery <T> query, Stream output) { var streamOperation = new StreamOperation(this); var command = streamOperation.CreateRequest(query.GetIndexQuery()); RequestExecutor.Execute(command, Context, sessionInfo: _sessionInfo); using (command.Result.Response) using (command.Result.Stream) { command.Result.Stream.CopyTo(output); } }
private async Task <IAsyncEnumerator <StreamResult <T> > > StreamAsync <T>(long?fromEtag, string startsWith, string matches, int start, int pageSize, RavenPagingInformation pagingInformation = null, string skipAfter = null, string transformer = null, Dictionary <string, object> transformerParameters = null, CancellationToken token = default(CancellationToken)) { var streamOperation = new StreamOperation(this); var command = streamOperation.CreateRequest(fromEtag, startsWith, matches, start, pageSize, null, pagingInformation, skipAfter, transformer, transformerParameters); await RequestExecuter.ExecuteAsync(command, Context, token).ConfigureAwait(false); var result = streamOperation.SetResultAsync(command.Result); return(new YieldStream <T>(this, result, token)); }
public async Task <IAsyncEnumerator <StreamResult <T> > > StreamAsync <T>(IAsyncDocumentQuery <T> query, CancellationToken token = default(CancellationToken)) { var streamOperation = new StreamOperation(this); var command = streamOperation.CreateRequest((IRavenQueryInspector)query); await RequestExecuter.ExecuteAsync(command, Context, token).ConfigureAwait(false); var result = streamOperation.SetResultAsync(command.Result); var queryOperation = ((AsyncDocumentQuery <T>)query).InitializeQueryOperation(); queryOperation.DisableEntitiesTracking = true; return(new YieldStream <T>(this, result, token)); }
public IEnumerator <StreamResult <T> > Stream <T>(IDocumentQuery <T> query, out StreamQueryStatistics streamQueryStats) { var stats = new StreamQueryStatistics(); var streamOperation = new StreamOperation(this, stats); var command = streamOperation.CreateRequest(query.GetIndexQuery()); RequestExecutor.Execute(command, Context, sessionInfo: SessionInfo); using (var result = streamOperation.SetResult(command.Result)) { streamQueryStats = stats; return(YieldResults(query, result)); } }
private IEnumerator <TimeSeriesStreamResult <T> > StreamTimeSeriesInternal <T>(IDocumentQuery <T> query, out StreamQueryStatistics streamQueryStats) where T : ITimeSeriesQueryStreamResult, new() { var stats = new StreamQueryStatistics(); var streamOperation = new StreamOperation(this, stats); var command = streamOperation.CreateRequest(query.GetIndexQuery()); RequestExecutor.Execute(command, Context, sessionInfo: _sessionInfo); streamOperation.EnsureIsAcceptable(query.IndexName, command.Result); var result = streamOperation.SetResultForTimeSeries(command.Result); streamQueryStats = stats; return(YieldTimeSeriesResults(query, result)); }
private async Task <IAsyncEnumerator <StreamResult <T> > > PerformQueryStreamOperation <T>(IAsyncDocumentQuery <T> query, StreamQueryStatistics streamQueryStats, CancellationToken token) { var documentQuery = (AsyncDocumentQuery <T>)query; var fieldsToFetch = documentQuery.FieldsToFetchToken; var indexQuery = query.GetIndexQuery(); var streamOperation = new StreamOperation(this, streamQueryStats); var command = streamOperation.CreateRequest(indexQuery); await RequestExecutor.ExecuteAsync(command, Context, SessionInfo, token).ConfigureAwait(false); var result = streamOperation.SetResultAsync(command.Result); var queryOperation = ((AsyncDocumentQuery <T>)query).InitializeQueryOperation(); queryOperation.NoTracking = true; return(new YieldStream <T>(this, query, fieldsToFetch, result, token)); }
public async Task <IAsyncEnumerator <StreamResult <T> > > StreamAsync <T>(IAsyncDocumentQuery <T> query, CancellationToken token = default(CancellationToken)) { var documentQuery = (AsyncDocumentQuery <T>)query; var projectionFields = documentQuery.FieldsToFetchToken?.Projections; var indexQuery = query.GetIndexQuery(); var streamOperation = new StreamOperation(this); var command = streamOperation.CreateRequest(indexQuery); await RequestExecutor.ExecuteAsync(command, Context, token, SessionInfo).ConfigureAwait(false); var result = streamOperation.SetResultAsync(command.Result); var queryOperation = ((AsyncDocumentQuery <T>)query).InitializeQueryOperation(); queryOperation.DisableEntitiesTracking = true; return(new YieldStream <T>(this, query, projectionFields, result, token)); }
public IEnumerator <StreamResult <T> > Stream <T>(IDocumentQuery <T> query) { var streamOperation = new StreamOperation(this); var command = streamOperation.CreateRequest((IRavenQueryInspector)query); RequestExecuter.Execute(command, Context); using (var result = streamOperation.SetResult(command.Result)) { while (result.MoveNext()) { var res = result.Current; var stremResult = CreateStreamResult <T>(res); yield return(stremResult); } } }
public IEnumerator <StreamResult <T> > Stream <T>(string startsWith, string matches = null, int start = 0, int pageSize = int.MaxValue, string startAfter = null) { var streamOperation = new StreamOperation(this); var command = streamOperation.CreateRequest(startsWith, matches, start, pageSize, null, startAfter); RequestExecutor.Execute(command, Context, sessionInfo: SessionInfo); using (var result = streamOperation.SetResult(command.Result)) { while (result.MoveNext()) { var json = result.Current; yield return(CreateStreamResult <T>(json, null)); } } }
private async Task <IAsyncEnumerator <TimeSeriesStreamResult <T> > > TimeSeriesStreamInternalAsync <T>(IAsyncDocumentQuery <T> query, StreamQueryStatistics streamQueryStats, CancellationToken token) where T : ITimeSeriesQueryStreamResult, new() { using (AsyncTaskHolder()) { var documentQuery = (AsyncDocumentQuery <T>)query; var indexQuery = query.GetIndexQuery(); var streamOperation = new StreamOperation(this, streamQueryStats); var command = streamOperation.CreateRequest(indexQuery); await RequestExecutor.ExecuteAsync(command, Context, _sessionInfo, token).ConfigureAwait(false); var result = await streamOperation.SetResultForTimeSeriesAsync(command.Result).ConfigureAwait(false); var queryOperation = ((AsyncDocumentQuery <T>)query).InitializeQueryOperation(); queryOperation.NoTracking = true; return(new YieldTimeSeriesStream <T>(this, documentQuery, result, token)); } }
private IEnumerator <StreamResult <T> > Stream <T>(long?fromEtag, string startsWith, string matches, int start, int pageSize, RavenPagingInformation pagingInformation, string skipAfter, string transformer, Dictionary <string, object> transformerParameters) { var streamOperation = new StreamOperation(this); var command = streamOperation.CreateRequest(fromEtag, startsWith, matches, start, pageSize, null, pagingInformation, skipAfter, transformer, transformerParameters); RequestExecuter.Execute(command, Context); using (var result = streamOperation.SetResult(command.Result)) { while (result.MoveNext()) { var res = result.Current; var stremResult = CreateStreamResult <T>(res); yield return(stremResult); } } }
private async Task <IAsyncEnumerator <StreamResult <T> > > PerformQueryStreamOperation <T>(IAsyncDocumentQuery <T> query, StreamQueryStatistics streamQueryStats, CancellationToken token) { using (AsyncTaskHolder()) { var documentQuery = (IAbstractDocumentQueryImpl <T>)query; var fieldsToFetch = documentQuery.FieldsToFetchToken; var queryOperation = documentQuery.InitializeQueryOperation(); queryOperation.NoTracking = true; var indexQuery = query.GetIndexQuery(); var streamOperation = new StreamOperation(this, streamQueryStats); var command = streamOperation.CreateRequest(indexQuery); await RequestExecutor.ExecuteAsync(command, Context, _sessionInfo, token).ConfigureAwait(false); streamOperation.EnsureIsAcceptable(query.IndexName, command.Result); var result = await streamOperation.SetResultAsync(command.Result, token).ConfigureAwait(false); return(new YieldStream <T>(this, result, documentQuery, fieldsToFetch, token)); } }