mobile/android/base/fxa/sync/SchedulePolicy.java

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 package org.mozilla.gecko.fxa.sync;
michael@0 6
michael@0 7 import org.mozilla.gecko.fxa.login.State.Action;
michael@0 8 import org.mozilla.gecko.sync.BackoffHandler;
michael@0 9
michael@0 10 public interface SchedulePolicy {
michael@0 11 /**
michael@0 12 * Call this with the number of other clients syncing to the account.
michael@0 13 */
michael@0 14 public abstract void onSuccessfulSync(int otherClientsCount);
michael@0 15 public abstract void onHandleFinal(Action needed);
michael@0 16 public abstract void onUpgradeRequired();
michael@0 17 public abstract void onUnauthorized();
michael@0 18
michael@0 19 /**
michael@0 20 * Before a sync we typically wish to adjust our backoff policy. This cleans
michael@0 21 * the slate prior to encountering a new backoff, and also functions as a rate
michael@0 22 * limiter.
michael@0 23 *
michael@0 24 * The {@link SchedulePolicy} acts as a controller for the {@link BackoffHandler}.
michael@0 25 * As a result of calling these two methods, the {@link BackoffHandler} will be
michael@0 26 * mutated, and additional side-effects (such as scheduling periodic syncs) can
michael@0 27 * occur.
michael@0 28 *
michael@0 29 * @param rateHandler the backoff handler to configure for basic rate limiting.
michael@0 30 * @param backgroundHandler the backoff handler to configure for background operations.
michael@0 31 */
michael@0 32 public abstract void configureBackoffMillisBeforeSyncing(BackoffHandler rateHandler, BackoffHandler backgroundHandler);
michael@0 33
michael@0 34 /**
michael@0 35 * We received an explicit backoff instruction, typically from a server.
michael@0 36 *
michael@0 37 * @param onlyExtend
michael@0 38 * if <code>true</code>, the backoff handler will be asked to update
michael@0 39 * its backoff only if the provided value is greater than the current
michael@0 40 * backoff.
michael@0 41 */
michael@0 42 public abstract void configureBackoffMillisOnBackoff(BackoffHandler backoffHandler, long backoffMillis, boolean onlyExtend);
michael@0 43 }

mercurial