~launchpad-pqm/launchpad/devel

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Copyright 2009 Canonical Ltd.  This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).

# pylint: disable-msg=E0211,E0213

"""The public interface to the model of the branch puller."""

__metaclass__ = type
__all__ = [
    'IBranchPuller',
    ]


from zope.interface import (
    Attribute,
    Interface,
    )


class IBranchPuller(Interface):
    """The interface to the database for the branch puller."""

    MAXIMUM_MIRROR_FAILURES = Attribute(
        "The maximum number of failures before we disable mirroring.")

    MIRROR_TIME_INCREMENT = Attribute(
        "How frequently we mirror branches.")

    def acquireBranchToPull(*branch_types):
        """Return a Branch to pull and mark it as mirror-started.

        :param branch_types: Only return branches of these types.  Passing no
            types means consider all types (apart from REMOTE).
        :return: The branch object to pull next, or ``None`` if there is no
            branch to pull.
        """