diff options
Diffstat (limited to 'lorrycontroller/hosts.py')
-rw-r--r-- | lorrycontroller/hosts.py | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/lorrycontroller/hosts.py b/lorrycontroller/hosts.py index 76eeadf..b86cbad 100644 --- a/lorrycontroller/hosts.py +++ b/lorrycontroller/hosts.py @@ -55,3 +55,67 @@ class DownstreamHost(abc.ABC): - description: Short string describing the repository ''' pass + + +class UpstreamHost(abc.ABC): + @staticmethod + def check_host_type_params(validator, section): + '''Validate any type-specific fields in a CONFGIT host section. + + validator is an instance of LorryControllerConfValidator that + may be used to check the types of configuration fields. + + section is the dictionary of fields for the section. + + Returns None if the configuration is valid; raises an + exception on error. + ''' + pass + + @staticmethod + def get_host_type_params(section): + '''Convert any type-specific fields in a CONFGIT host section into a + dictionary that will be stored in STATEDB. + + section is the dictionary of fields for the section. + + Returns a dictionary, which may be empty. This will be stored + in STATEDB as the type_params of the host. + ''' + return {} + + @abc.abstractmethod + def __init__(self, host_info): + '''Construct an Upstream Host connector from the given host_info. + The host_info comes directly from STATEDB. + ''' + pass + + @abc.abstractmethod + def list_repos(self): + '''List all visible repositories on the Host. + + Returns a list of path strings. + ''' + pass + + @abc.abstractmethod + def get_repo_url(self, repo_path): + '''Get URL for a repository. + + repo_path is the path to the repository within the Host. + + Returns a URL string suitable for passing to git clone. + ''' + pass + + @abc.abstractmethod + def get_repo_metadata(self, repo_path): + '''Get metadata for a repository. + + repo_path is the path to the repository within the Host. + + Returns a dictionary of metadata suitable for passing to + DownstreamHost.prepare_repo. + ''' + pass |