Esempio n. 1
0
        public async IAsyncEnumerable <TransformationProcessTaskStatus> GetProcessTasksStatus(Guid processId, TasksStatusQuery query, CancellationToken token = default)
        {
            await EnsureTableAsync();

            string partitionKey = processId.ToString();
            // Prepend the type

            var tableQuery = new TableQuery <StateEntity>();

            if (query.State.HasValue)
            {
                // Apply filter
                tableQuery = tableQuery.Where($"{nameof(StateEntity.PartitionKey)} eq '{partitionKey}' and {nameof(StateEntity.State)} eq '{query.State}'");
            }
            else
            {
                tableQuery = tableQuery.Where($"{nameof(StateEntity.PartitionKey)} eq '{partitionKey}'");
            }

            TableContinuationToken tableToken = null;

            do
            {
                // Try to load next segment
                var segment = await tableReference.ExecuteQuerySegmentedAsync(tableQuery, tableToken);

                token.ThrowIfCancellationRequested();

                foreach (var stateEntity in segment)
                {
                    // Remove the type from the beginning of the row key
                    yield return(stateEntity.GetTaskStatus());

                    token.ThrowIfCancellationRequested();
                }

                tableToken = segment.ContinuationToken;
            } while (tableToken != null);
        }
Esempio n. 2
0
 IAsyncEnumerable <TransformationProcessTaskStatus> ITransformationStateManager.GetProcessTasksStatus(Guid processId, TasksStatusQuery query, CancellationToken token)
 {
     throw new NotImplementedException();
 }