mirror of
https://github.com/facebook/proxygen.git
synced 2025-08-01 10:26:51 +03:00
Summary: Pull Request resolved: https://github.com/facebookincubator/zstrong/pull/723 Reviewed By: grievejia Differential Revision: D54471437 fbshipit-source-id: bc644553e31464ceb632034e4ce3f05ba30fbbcd
40 lines
1.5 KiB
Python
40 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.
|
|
|
|
# pyre-unsafe
|
|
|
|
|
|
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
|