sdk/dotnet/src/Microsoft.Datasync.Client/Offline/Queue/OperationsQueue.cs
/// <summary>
/// Peeks inside the operations queue for the next operation (after the given sequence ID)targeting the set of tables
/// </summary>
/// <param name="previousSequenceId">The previous sequence ID read.</param>
/// <param name="tableNames">The list of tables to consider.</param>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> to observe.</param>
/// <returns>A task that returns the table operation when finished.</returns>
Peeks inside the operations queue for the next operation (after the given sequence ID)targeting the set of tables
Peeks inside the operations queue for the next operation ( after the given sequence ID ) targeting the set of tables
public virtual async Task<TableOperation> PeekAsync(long previousSequenceId, IEnumerable<string> tableNames, CancellationToken cancellationToken = default)
        {
            if (previousSequenceId < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(previousSequenceId), "Sequence ID must be a positive integer");
            }
            QueryDescription query = new(SystemTables.OperationsQueue)
            {
                Filter = Compare(BinaryOperatorKind.GreaterThan, "sequence", previousSequenceId),
                Top = 1
            };
            query.Ordering.Add(new OrderByNode(new MemberAccessNode(null, "sequence"), OrderByDirection.Ascending));
            if (tableNames?.Any() == true)
            {
                BinaryOperatorNode nameInList = tableNames
                    .Select(t => Compare(BinaryOperatorKind.Equal, "tableName", t))
                    .Aggregate((first, second) => new BinaryOperatorNode(BinaryOperatorKind.Or, first, second));
                query.Filter = new BinaryOperatorNode(BinaryOperatorKind.And, query.Filter, nameInList);
            }
            var page = await OfflineStore.GetPageAsync(query, cancellationToken).ConfigureAwait(false);
            JToken result = page.Items?.FirstOrDefault();
            return (result != null && result is JObject op) ? TableOperation.Deserialize(op) : null;
        }
public virtual async Task < TableOperation > PeekAsync ( long previousSequenceId , IEnumerable < string > tableNames , CancellationToken cancellationToken = default ) { if ( previousSequenceId < 0 ) { throw new ArgumentOutOfRangeException ( nameof ( previousSequenceId ) , " " ) ; } QueryDescription query = new ( SystemTables . OperationsQueue ) { Filter = Compare ( BinaryOperatorKind . GreaterThan , " " , previousSequenceId ) , Top = 1 } ; query . Ordering . Add ( new OrderByNode ( new MemberAccessNode ( null , " " ) , OrderByDirection . Ascending ) ) ; if ( tableNames ? . Any ( ) == true ) { BinaryOperatorNode nameInList = tableNames . Select ( t => Compare ( BinaryOperatorKind . Equal , " " , t ) ) . Aggregate ( ( first , second ) => new BinaryOperatorNode ( BinaryOperatorKind . Or , first , second ) ) ; query . Filter = new BinaryOperatorNode ( BinaryOperatorKind . And , query . Filter , nameInList ) ; } var page = await OfflineStore . GetPageAsync ( query , cancellationToken ) . ConfigureAwait ( false ) ; JToken result = page . Items ? . FirstOrDefault ( ) ; return ( result != null && result is JObject op ) ? TableOperation . Deserialize ( op ) : null ; }
Peeks inside the operations queue for the next operation (after the given sequence ID)targeting the set of tables
Peeks inside the operations queue for the next operation ( after the given sequence ID ) targeting the set of tables
A task that returns the table operation when finished.
A task that returns the table operation when finished .
previousSequenceId
long
The previous sequence ID read.
The previous sequence ID read .
tableNames
IEnumerable<string>
The list of tables to consider.
The list of tables to consider .
cancellationToken
CancellationToken
A  to observe.
A to observe .