Skip to content
This repository has been archived by the owner on Feb 29, 2020. It is now read-only.

Commit

Permalink
[client][managed][offline] rename queryKey to queryId
Browse files Browse the repository at this point in the history
  • Loading branch information
hasankhan committed Nov 17, 2014
1 parent 1ff0420 commit 93e59f7
Show file tree
Hide file tree
Showing 16 changed files with 85 additions and 85 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static class MobileServiceSyncTableExtensions
/// Pulls all items that match the given query from the associated remote table. Supports incremental sync. For more information, see http://go.microsoft.com/fwlink/?LinkId=506788.
/// </summary>
/// <param name="table">The instance of table to execute pull on.</param>
/// <param name="queryKey">
/// <param name="queryId">
/// A string that uniquely identifies this query and is used to keep track of its sync state. Supplying this parameter enables incremental sync whenever the same key is used again.
/// </param>
/// <param name="query">
Expand All @@ -29,17 +29,17 @@ public static class MobileServiceSyncTableExtensions
/// <returns>
/// A task that completes when pull operation has finished.
/// </returns>
public static Task PullAsync(this IMobileServiceSyncTable table, string queryKey, string query)
public static Task PullAsync(this IMobileServiceSyncTable table, string queryId, string query)
{
return table.PullAsync(queryKey, query, null, CancellationToken.None);
return table.PullAsync(queryId, query, null, CancellationToken.None);
}


/// <summary>
/// Pulls all items that match the given query from the associated remote table. Supports incremental sync. For more information, see http://go.microsoft.com/fwlink/?LinkId=506788.
/// </summary>
/// <param name="table">The instance of table to execute pull on.</param>
/// <param name="queryKey">
/// <param name="queryId">
/// A string that uniquely identifies this query and is used to keep track of its sync state. Supplying this parameter enables incremental sync whenever the same key is used again.
/// </param>
/// <param name="query">
Expand All @@ -55,16 +55,16 @@ public static Task PullAsync(this IMobileServiceSyncTable table, string queryKey
/// <returns>
/// A task that completes when pull operation has finished.
/// </returns>
public static Task PullAsync(this IMobileServiceSyncTable table, string queryKey, string query, IDictionary<string, string> parameters, CancellationToken cancellationToken)
public static Task PullAsync(this IMobileServiceSyncTable table, string queryId, string query, IDictionary<string, string> parameters, CancellationToken cancellationToken)
{
return table.PullAsync(queryKey, query, parameters, true, cancellationToken: cancellationToken);
return table.PullAsync(queryId, query, parameters, true, cancellationToken: cancellationToken);
}

/// <summary>
/// Pulls all items that match the given query from the associated remote table. Supports incremental sync. For more information, see http://go.microsoft.com/fwlink/?LinkId=506788.
/// </summary>
/// <param name="table">The instance of table to execute pull on.</param>
/// <param name="queryKey">
/// <param name="queryId">
/// A string that uniquely identifies this query and is used to keep track of its sync state. Supplying this parameter enables incremental sync whenever the same key is used again.
/// </param>
/// <param name="query">
Expand All @@ -76,9 +76,9 @@ public static Task PullAsync(this IMobileServiceSyncTable table, string queryKey
/// <returns>
/// A task that completes when pull operation has finished.
/// </returns>
public static Task PullAsync<T, U>(this IMobileServiceSyncTable<T> table, string queryKey, IMobileServiceTableQuery<U> query, CancellationToken cancellationToken)
public static Task PullAsync<T, U>(this IMobileServiceSyncTable<T> table, string queryId, IMobileServiceTableQuery<U> query, CancellationToken cancellationToken)
{
return table.PullAsync(queryKey, query, pushOtherTables: true, cancellationToken: cancellationToken);
return table.PullAsync(queryId, query, pushOtherTables: true, cancellationToken: cancellationToken);
}

/// <summary>
Expand All @@ -103,7 +103,7 @@ public static Task PullAsync<T, U>(this IMobileServiceSyncTable<T> table, IMobil
/// from the associated remote table.
/// </summary>
/// <param name="table">The instance of table to execute pull on.</param>
/// <param name="queryKey">
/// <param name="queryId">
/// A string that uniquely identifies this query and is used to keep track of its sync state. Supplying this parameter enables incremental sync whenever the same key is used again.
/// </param>
/// <param name="query">
Expand All @@ -113,9 +113,9 @@ public static Task PullAsync<T, U>(this IMobileServiceSyncTable<T> table, IMobil
/// <returns>
/// A task that completes when pull operation has finished.
/// </returns>
public static Task PullAsync<T, U>(this IMobileServiceSyncTable<T> table, string queryKey, IMobileServiceTableQuery<U> query)
public static Task PullAsync<T, U>(this IMobileServiceSyncTable<T> table, string queryId, IMobileServiceTableQuery<U> query)
{
return table.PullAsync(queryKey, query, cancellationToken: CancellationToken.None);
return table.PullAsync(queryId, query, cancellationToken: CancellationToken.None);
}

/// <summary>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,8 @@
<data name="SyncStore_AlreadyInitialized" xml:space="preserve">
<value>The store is already initialized.</value>
</data>
<data name="MobileServiceSyncTable_InvalidQueryKey" xml:space="preserve">
<value>The query key must start with a letter and can contain only letters and digits.</value>
<data name="MobileServiceSyncTable_InvalidQueryId" xml:space="preserve">
<value>The query id must start with a letter and can contain only letters and digits.</value>
</data>
<data name="MobileServiceSyncTable_IncrementalPullWithOrderNotAllowed" xml:space="preserve">
<value>Incremental pull query must not have orderby clause.</value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public interface IMobileServiceSyncTable<T> : IMobileServiceSyncTable
/// <summary>
/// Pulls all items that match the given query from the associated remote table. Supports incremental sync. For more information, see http://go.microsoft.com/fwlink/?LinkId=506788.
/// </summary>
/// <param name="queryKey">
/// <param name="queryId">
/// A string that uniquely identifies this query and is used to keep track of its sync state. Supplying this parameter enables incremental sync whenever the same key is used again.
/// </param>
/// <param name="query">
Expand All @@ -107,19 +107,19 @@ public interface IMobileServiceSyncTable<T> : IMobileServiceSyncTable
/// <returns>
/// A task that completes when pull operation has finished.
/// </returns>
Task PullAsync<U>(string queryKey, IMobileServiceTableQuery<U> query, bool pushOtherTables, CancellationToken cancellationToken);
Task PullAsync<U>(string queryId, IMobileServiceTableQuery<U> query, bool pushOtherTables, CancellationToken cancellationToken);

/// <summary>
/// Deletes all the items in local table that match the query.
/// </summary>
/// <param name="queryKey">
/// <param name="queryId">
/// A string that uniquely identifies this query and is used to keep track of its sync state. Supplying this parameter resets the incremental sync state for the query.
/// </param>
/// <param name="query">An OData query that determines which items to delete.</param>
/// <param name="cancellationToken">The <see cref="System.Threading.CancellationToken"/> token to observe
/// </param>
/// <returns>A task that completes when purge operation has finished.</returns>
Task PurgeAsync<U>(string queryKey, IMobileServiceTableQuery<U> query, CancellationToken cancellationToken);
Task PurgeAsync<U>(string queryId, IMobileServiceTableQuery<U> query, CancellationToken cancellationToken);

/// <summary>
/// Lookup an instance from a table by its id.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public interface IMobileServiceSyncTable
/// Pulls all items that match the given query from the associated remote table. Supports incremental sync. For more information, see http://go.microsoft.com/fwlink/?LinkId=506788.
/// </summary>
/// </summary>
/// <param name="queryKey">
/// <param name="queryId">
/// A string that uniquely identifies this query and is used to keep track of its sync state. Supplying this parameter enables incremental sync whenever the same key is used again.
/// </param>
/// <param name="query">
Expand All @@ -108,18 +108,18 @@ public interface IMobileServiceSyncTable
/// <returns>
/// A task that completes when pull operation has finished.
/// </returns>
Task PullAsync(string queryKey, string query, IDictionary<string, string> parameters, bool pushOtherTables, CancellationToken cancellationToken);
Task PullAsync(string queryId, string query, IDictionary<string, string> parameters, bool pushOtherTables, CancellationToken cancellationToken);

/// <summary>
/// Deletes all the items in local table that match the query.
/// </summary>
/// <param name="queryKey">
/// <param name="queryId">
/// A string that uniquely identifies this query and is used to keep track of its sync state. Supplying this parameter resets the incremental sync state for the query.
/// </param>
/// <param name="query">An OData query that determines which items to delete.</param>
/// <param name="cancellationToken">The <see cref="System.Threading.CancellationToken"/> token to observe
/// </param>
/// <returns>A task that completes when purge operation has finished.</returns>
Task PurgeAsync(string queryKey, string query, CancellationToken cancellationToken);
Task PurgeAsync(string queryId, string query, CancellationToken cancellationToken);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public async Task<JObject> LookupAsync(string tableName, string id)
/// </summary>
/// <param name="tableName">The name of table to pull</param>
/// <param name="tableKind">The kind of table</param>
/// <param name="queryKey">A string that uniquely identifies this query and is used to keep track of its sync state.</param>
/// <param name="queryId">A string that uniquely identifies this query and is used to keep track of its sync state.</param>
/// <param name="query">An OData query that determines which items to
/// pull from the remote table.</param>
/// <param name="options">An instance of <see cref="MobileServiceRemoteTableOptions"/></param>
Expand All @@ -175,7 +175,7 @@ public async Task<JObject> LookupAsync(string tableName, string id)
/// <returns>
/// A task that completes when pull operation has finished.
/// </returns>
public async Task PullAsync(string tableName, MobileServiceTableKind tableKind, string queryKey, string query, MobileServiceRemoteTableOptions options, IDictionary<string, string> parameters, IEnumerable<string> relatedTables, MobileServiceObjectReader reader, CancellationToken cancellationToken)
public async Task PullAsync(string tableName, MobileServiceTableKind tableKind, string queryId, string query, MobileServiceRemoteTableOptions options, IDictionary<string, string> parameters, IEnumerable<string> relatedTables, MobileServiceObjectReader reader, CancellationToken cancellationToken)
{
await this.EnsureInitializedAsync();

Expand All @@ -202,7 +202,7 @@ public async Task PullAsync(string tableName, MobileServiceTableKind tableKind,
throw new ArgumentException(Resources.MobileServiceSyncTable_PullWithSelectNotSupported, "query");
}

bool isIncrementalSync = !String.IsNullOrEmpty(queryKey);
bool isIncrementalSync = !String.IsNullOrEmpty(queryId);
if (isIncrementalSync)
{
if (queryDescription.Ordering.Any())
Expand Down Expand Up @@ -233,17 +233,17 @@ public async Task PullAsync(string tableName, MobileServiceTableKind tableKind,
// let us not burden the server to calculate the count when we don't need it for pull
queryDescription.IncludeTotalCount = false;

var action = new PullAction(table, tableKind, this, queryKey, queryDescription, parameters, relatedTables, this.opQueue, this.settings, this.Store, options, reader, cancellationToken);
var action = new PullAction(table, tableKind, this, queryId, queryDescription, parameters, relatedTables, this.opQueue, this.settings, this.Store, options, reader, cancellationToken);
await this.ExecuteSyncAction(action);
}

public async Task PurgeAsync(string tableName, MobileServiceTableKind tableKind, string queryKey, string query, CancellationToken cancellationToken)
public async Task PurgeAsync(string tableName, MobileServiceTableKind tableKind, string queryId, string query, CancellationToken cancellationToken)
{
await this.EnsureInitializedAsync();

var table = await this.GetTable(tableName);
var queryDescription = MobileServiceTableQueryDescription.Parse(tableName, query);
var action = new PurgeAction(table, tableKind, queryKey, queryDescription, this, this.opQueue, this.settings, this.Store, cancellationToken);
var action = new PurgeAction(table, tableKind, queryId, queryDescription, this, this.opQueue, this.settings, this.Store, cancellationToken);
await this.ExecuteSyncAction(action);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ public virtual async Task<MobileServiceSystemProperties> GetSystemPropertiesAsyn
return (MobileServiceSystemProperties)Int32.Parse(value);
}

public virtual async Task ResetDeltaTokenAsync(string tableName, string queryKey)
public virtual async Task ResetDeltaTokenAsync(string tableName, string queryId)
{
string key = GetDeltaTokenKey(tableName, queryKey);
string key = GetDeltaTokenKey(tableName, queryId);

using (await this.cacheLock.Acquire(key, CancellationToken.None))
{
Expand All @@ -48,15 +48,15 @@ public virtual async Task ResetDeltaTokenAsync(string tableName, string queryKey
}
}

public async virtual Task<DateTimeOffset> GetDeltaTokenAsync(string tableName, string queryKey)
public async virtual Task<DateTimeOffset> GetDeltaTokenAsync(string tableName, string queryId)
{
string value = await this.GetSettingAsync(GetDeltaTokenKey(tableName, queryKey), DefaultDeltaToken);
string value = await this.GetSettingAsync(GetDeltaTokenKey(tableName, queryId), DefaultDeltaToken);
return DateTimeOffset.Parse(value);
}

public virtual Task SetDeltaTokenAsync(string tableName, string queryKey, DateTimeOffset token)
public virtual Task SetDeltaTokenAsync(string tableName, string queryId, DateTimeOffset token)
{
return this.SetSettingAsync(GetDeltaTokenKey(tableName, queryKey), token.ToString("o"));
return this.SetSettingAsync(GetDeltaTokenKey(tableName, queryId), token.ToString("o"));
}

/// <summary>
Expand Down Expand Up @@ -111,9 +111,9 @@ private async Task<string> GetSettingAsync(string key, string defaultValue)
}
}

private string GetDeltaTokenKey(string tableName, string queryKey)
private string GetDeltaTokenKey(string tableName, string queryId)
{
return tableName + "_" + queryKey + "_deltaToken";
return tableName + "_" + queryId + "_deltaToken";
}

private static string GetSystemPropertiesKey(string tableName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,26 @@ public Task<IEnumerable<U>> ReadAsync<U>(IMobileServiceTableQuery<U> query)
return this.queryProvider.Execute(query);
}

public Task PullAsync<U>(string queryKey, IMobileServiceTableQuery<U> query, bool pushOtherTables, CancellationToken cancellationToken)
public Task PullAsync<U>(string queryId, IMobileServiceTableQuery<U> query, bool pushOtherTables, CancellationToken cancellationToken)
{
if (query == null)
{
throw new ArgumentNullException("query");
}
string queryString = this.queryProvider.ToODataString(query);

return this.PullAsync(queryKey, queryString, query.Parameters, pushOtherTables, cancellationToken);
return this.PullAsync(queryId, queryString, query.Parameters, pushOtherTables, cancellationToken);
}

public Task PurgeAsync<U>(string queryKey, IMobileServiceTableQuery<U> query, CancellationToken cancellationToken)
public Task PurgeAsync<U>(string queryId, IMobileServiceTableQuery<U> query, CancellationToken cancellationToken)
{
if (query == null)
{
throw new ArgumentNullException("query");
}
string queryString = this.queryProvider.ToODataString(query);

return this.PurgeAsync(queryKey, queryString, cancellationToken);
return this.PurgeAsync(queryId, queryString, cancellationToken);
}

public async Task RefreshAsync(T instance)
Expand Down
Loading

0 comments on commit 93e59f7

Please sign in to comment.