1
0
mirror of https://github.com/facebook/proxygen.git synced 2025-08-10 05:22:59 +03:00
Files
proxygen/build/fbcode_builder/getdeps/cache.py
Pyre Bot Jr e77a9fe43a Add annotations to opensource/fbcode_builder
Reviewed By: shannonzhu

Differential Revision: D34224272

fbshipit-source-id: 52e19886ab3d4fb015a557244660dd4357a35c17
2022-02-14 16:22:09 -08:00

38 lines
1.5 KiB
Python

# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
class ArtifactCache(object):
"""The ArtifactCache is a small abstraction that allows caching
named things in some external storage mechanism.
The primary use case is for storing the build products on CI
systems to accelerate the build"""
def download_to_file(self, name, dest_file_name) -> bool:
"""If `name` exists in the cache, download it and place it
in the specified `dest_file_name` location on the filesystem.
If a transient issue was encountered a TransientFailure shall
be raised.
If `name` doesn't exist in the cache `False` shall be returned.
If `dest_file_name` was successfully updated `True` shall be
returned.
All other conditions shall raise an appropriate exception."""
return False
def upload_from_file(self, name, source_file_name) -> None:
"""Causes `name` to be populated in the cache by uploading
the contents of `source_file_name` to the storage system.
If a transient issue was encountered a TransientFailure shall
be raised.
If the upload failed for some other reason, an appropriate
exception shall be raised."""
pass
def create_cache() -> None:
"""This function is monkey patchable to provide an actual
implementation"""
return None