public async Task InitializeAsync(IMobileServiceLocalStore store, IMobileServiceSyncHandler handler, StoreTrackingOptions trackingOptions) { if (store == null) { throw new ArgumentNullException("store"); } handler = handler ?? new MobileServiceSyncHandler(); this.initializeTask = new TaskCompletionSource <object>(); using (await this.storeQueueLock.WriterLockAsync()) { this.Handler = handler; this.Store = store; this.storeTrackingOptions = trackingOptions; this.syncQueue = new ActionBlock(); await this.Store.InitializeAsync(); this.opQueue = await OperationQueue.LoadAsync(store); this.settings = new MobileServiceSyncSettingsManager(store); this.localOperationsStore = StoreChangeTrackerFactory.CreateTrackedStore(store, StoreOperationSource.Local, trackingOptions, this.client.EventManager, this.settings); this.initializeTask.SetResult(null); } }
public SyncAction(OperationQueue operationQueue, IMobileServiceLocalStore store, CancellationToken cancellationToken) { this.OperationQueue = operationQueue; this.Store = store; this.TaskSource = new TaskCompletionSource <object>(); this.CancellationToken = cancellationToken; cancellationToken.Register(() => TaskSource.TrySetCanceled()); }
public SyncAction(OperationQueue operationQueue, IMobileServiceLocalStore store, CancellationToken cancellationToken) { this.OperationQueue = operationQueue; this.Store = store; this.TaskSource = new TaskCompletionSource<object>(); this.CancellationToken = cancellationToken; cancellationToken.Register(() => { TaskSource.TrySetCanceled(); }); }
public PurgeAction(MobileServiceTable table, MobileServiceTableKind tableKind, string queryId, MobileServiceTableQueryDescription query, bool force, MobileServiceSyncContext context, OperationQueue operationQueue, MobileServiceSyncSettingsManager settings, IMobileServiceLocalStore store, CancellationToken cancellationToken) : base(table, tableKind, queryId, query, null, context, operationQueue, settings, store, cancellationToken) { this.force = force; }
public PurgeAction(MobileServiceTable table, MobileServiceTableKind tableKind, string queryId, MobileServiceTableQueryDescription query, bool force, MobileServiceSyncContext context, OperationQueue operationQueue, MobileServiceSyncSettingsManager settings, IMobileServiceLocalStore store, CancellationToken cancellationToken) : base(table, tableKind, queryId, query, null, context, operationQueue, settings, store, cancellationToken) { this.force = force; }
public PushAction(OperationQueue operationQueue, IMobileServiceLocalStore store, MobileServiceTableKind tableKind, IEnumerable<string> tableNames, IMobileServiceSyncHandler syncHandler, MobileServiceClient client, MobileServiceSyncContext context, CancellationToken cancellationToken) : base(operationQueue, store, cancellationToken) { this.tableKind = tableKind; this.tableNames = tableNames; this.client = client; this.syncHandler = syncHandler; this.context = context; }
public PushAction(OperationQueue operationQueue, IMobileServiceLocalStore store, MobileServiceTableKind tableKind, IEnumerable <string> tableNames, IMobileServiceSyncHandler syncHandler, MobileServiceClient client, MobileServiceSyncContext context, CancellationToken cancellationToken) : base(operationQueue, store, cancellationToken) { this.tableKind = tableKind; this.tableNames = tableNames; this.client = client; this.syncHandler = syncHandler; this.context = context; }
public PullAction(MobileServiceTable table, MobileServiceTableKind tableKind, MobileServiceSyncContext context, string queryId, MobileServiceTableQueryDescription query, IDictionary<string, string> parameters, IEnumerable<string> relatedTables, OperationQueue operationQueue, MobileServiceSyncSettingsManager settings, IMobileServiceLocalStore store, MobileServiceRemoteTableOptions options, MobileServiceObjectReader reader, CancellationToken cancellationToken) : base(table, tableKind, queryId, query, relatedTables, context, operationQueue, settings, store, cancellationToken) { this.options = options; this.parameters = parameters; this.cursor = new PullCursor(query); this.Reader = reader ?? new MobileServiceObjectReader(); }
public static async Task <OperationQueue> LoadAsync(IMobileServiceLocalStore store) { var opQueue = new OperationQueue(store); var query = CreateQuery(); // to know how many pending operations are there query.IncludeTotalCount = true; // to get the max sequence id, order by sequence desc query.Ordering.Add(new OrderByNode(new MemberAccessNode(null, "sequence"), OrderByDirection.Descending)); // we just need the highest value, not all the operations query.Top = 1; QueryResult result = await store.QueryAsync(query); opQueue.pendingOperations = result.TotalCount; opQueue.sequenceId = result.Values == null ? 0 : result.Values.Select(v => v.Value <long>("sequence")).FirstOrDefault(); return(opQueue); }
public TableAction(MobileServiceTable table, MobileServiceTableKind tableKind, string queryId, MobileServiceTableQueryDescription query, IEnumerable<string> relatedTables, MobileServiceSyncContext context, OperationQueue operationQueue, MobileServiceSyncSettingsManager settings, IMobileServiceLocalStore store, CancellationToken cancellationToken) : base(operationQueue, store, cancellationToken) { this.Table = table; this.TableKind = tableKind; this.QueryId = queryId; this.Query = query; this.RelatedTables = relatedTables; this.Settings = settings; this.Context = context; }
public PullAction(MobileServiceTable table, MobileServiceTableKind tableKind, MobileServiceSyncContext context, string queryId, MobileServiceTableQueryDescription query, IDictionary <string, string> parameters, IEnumerable <string> relatedTables, OperationQueue operationQueue, MobileServiceSyncSettingsManager settings, IMobileServiceLocalStore store, MobileServiceRemoteTableOptions options, MobileServiceObjectReader reader, CancellationToken cancellationToken) : base(table, tableKind, queryId, query, relatedTables, context, operationQueue, settings, store, cancellationToken) { this.options = options; this.parameters = parameters; this.cursor = new PullCursor(query); this.Reader = reader ?? new MobileServiceObjectReader(); }
public TableAction(MobileServiceTable table, MobileServiceTableKind tableKind, string queryId, MobileServiceTableQueryDescription query, IEnumerable <string> relatedTables, MobileServiceSyncContext context, OperationQueue operationQueue, MobileServiceSyncSettingsManager settings, IMobileServiceLocalStore store, CancellationToken cancellationToken) : base(operationQueue, store, cancellationToken) { this.Table = table; this.TableKind = tableKind; this.QueryId = queryId; this.Query = query; this.RelatedTables = relatedTables; this.Settings = settings; this.Context = context; }
public async Task InitializeAsync(IMobileServiceLocalStore store, IMobileServiceSyncHandler handler) { if (store == null) { throw new ArgumentNullException("store"); } handler = handler ?? new MobileServiceSyncHandler(); this.initializeTask = new TaskCompletionSource <object>(); using (await this.storeQueueLock.WriterLockAsync()) { this.Handler = handler; this.Store = store; this.syncQueue = new ActionBlock(); await this.Store.InitializeAsync(); this.opQueue = await OperationQueue.LoadAsync(store); this.settings = new MobileServiceSyncSettingsManager(store); this.initializeTask.SetResult(null); } }
public async Task InitializeAsync(IMobileServiceLocalStore store, IMobileServiceSyncHandler handler, StoreTrackingOptions trackingOptions) { if (store == null) { throw new ArgumentNullException("store"); } handler = handler ?? new MobileServiceSyncHandler(); this.initializeTask = new TaskCompletionSource<object>(); using (await this.storeQueueLock.WriterLockAsync()) { this.Handler = handler; this.Store = store; this.storeTrackingOptions = trackingOptions; this.syncQueue = new ActionBlock(); await this.Store.InitializeAsync(); this.opQueue = await OperationQueue.LoadAsync(store); this.settings = new MobileServiceSyncSettingsManager(store); this.localOperationsStore = StoreChangeTrackerFactory.CreateTrackedStore(store, StoreOperationSource.Local, trackingOptions, this.client.EventManager, this.settings); this.initializeTask.SetResult(null); } }
public async Task InitializeAsync(IMobileServiceLocalStore store, IMobileServiceSyncHandler handler) { if (store == null) { throw new ArgumentNullException("store"); } handler = handler ?? new MobileServiceSyncHandler(); this.initializeTask = new TaskCompletionSource<object>(); using (await this.storeQueueLock.WriterLockAsync()) { this.Handler = handler; this.Store = store; this.syncQueue = new ActionBlock(); await this.Store.InitializeAsync(); this.opQueue = await OperationQueue.LoadAsync(store); this.settings = new MobileServiceSyncSettingsManager(store); this.initializeTask.SetResult(null); } }
public static async Task<OperationQueue> LoadAsync(IMobileServiceLocalStore store) { var opQueue = new OperationQueue(store); var query = CreateQuery(); // to know how many pending operations are there query.IncludeTotalCount = true; // to get the max sequence id, order by sequence desc query.Ordering.Add(new OrderByNode(new MemberAccessNode(null, "sequence"), OrderByDirection.Descending)); // we just need the highest value, not all the operations query.Top = 1; QueryResult result = await store.QueryAsync(query); opQueue.pendingOperations = result.TotalCount; opQueue.sequenceId = result.Values == null ? 0 : result.Values.Select(v => v.Value<long>("sequence")).FirstOrDefault(); return opQueue; }