• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2021 Google LLC
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14"""Module for a generic filestore."""
15
16
17class FilestoreError(Exception):
18  """Error using the filestore."""
19
20
21# pylint: disable=unused-argument,no-self-use
22class BaseFilestore:
23  """Base class for a filestore."""
24
25  def __init__(self, config):
26    self.config = config
27
28  def upload_crashes(self, name, directory):
29    """Uploads the crashes at |directory| to |name|."""
30    raise NotImplementedError('Child class must implement method.')
31
32  def upload_corpus(self, name, directory, replace=False):
33    """Uploads the corpus at |directory| to |name|."""
34    raise NotImplementedError('Child class must implement method.')
35
36  def upload_build(self, name, directory):
37    """Uploads the build at |directory| to |name|."""
38    raise NotImplementedError('Child class must implement method.')
39
40  def upload_coverage(self, name, directory):
41    """Uploads the coverage report at |directory| to |name|."""
42    raise NotImplementedError('Child class must implement method.')
43
44  def download_corpus(self, name, dst_directory):
45    """Downloads the corpus located at |name| to |dst_directory|."""
46    raise NotImplementedError('Child class must implement method.')
47
48  def download_build(self, name, dst_directory):
49    """Downloads the build with |name| to |dst_directory|."""
50    raise NotImplementedError('Child class must implement method.')
51
52  def download_coverage(self, dst_directory):
53    """Downloads the latest project coverage report."""
54    raise NotImplementedError('Child class must implement method.')
55