Debian Codegraph @

thirdparty/folly/build/fbcode_builder/getdeps/cache.py

raw
1 # Copyright (c) Meta Platforms, Inc. and affiliates.
2 #
3 # This source code is licensed under the MIT license found in the
4 # LICENSE file in the root directory of this source tree.
5
6
7 class ArtifactCache(object):
8 """The ArtifactCache is a small abstraction that allows caching
9 named things in some external storage mechanism.
10 The primary use case is for storing the build products on CI
11 systems to accelerate the build"""
12
13 def download_to_file(self, name, dest_file_name) -> bool:
14 """If `name` exists in the cache, download it and place it
15 in the specified `dest_file_name` location on the filesystem.
16 If a transient issue was encountered a TransientFailure shall
17 be raised.
18 If `name` doesn't exist in the cache `False` shall be returned.
19 If `dest_file_name` was successfully updated `True` shall be
20 returned.
21 All other conditions shall raise an appropriate exception."""
22 return False
23
24 def upload_from_file(self, name, source_file_name) -> None:
25 """Causes `name` to be populated in the cache by uploading
26 the contents of `source_file_name` to the storage system.
27 If a transient issue was encountered a TransientFailure shall
28 be raised.
29 If the upload failed for some other reason, an appropriate
30 exception shall be raised."""
31 pass
32
33
34 def create_cache() -> None:
35 """This function is monkey patchable to provide an actual
36 implementation"""
37 return None