1# Copyright 2022 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 15package( 16 default_visibility = [ 17 "//fcp:internal", 18 ], 19 licenses = ["notice"], # Apache 2.0 20) 21 22cc_library( 23 name = "temp_files", 24 srcs = ["temp_files.cc"], 25 hdrs = ["temp_files.h"], 26 deps = [ 27 "//fcp/base", 28 "//fcp/client:diag_codes_cc_proto", 29 "//fcp/client:interfaces", 30 "@com_google_absl//absl/status", 31 "@com_google_absl//absl/status:statusor", 32 ], 33) 34 35cc_test( 36 name = "temp_files_test", 37 srcs = ["temp_files_test.cc"], 38 deps = [ 39 ":temp_files", 40 "//fcp/client:test_helpers", 41 "//fcp/testing", 42 "@com_google_absl//absl/status:statusor", 43 "@com_google_googletest//:gtest_main", 44 ], 45) 46 47proto_library( 48 name = "cache_manifest_proto", 49 srcs = ["cache_manifest.proto"], 50 deps = [ 51 "@com_google_protobuf//:any_proto", 52 "@com_google_protobuf//:timestamp_proto", 53 ], 54) 55 56cc_proto_library( 57 name = "cache_manifest_cc_proto", 58 deps = [":cache_manifest_proto"], 59) 60 61cc_library( 62 name = "resource_cache", 63 hdrs = ["resource_cache.h"], 64 deps = [ 65 "@com_google_absl//absl/status", 66 "@com_google_absl//absl/status:statusor", 67 "@com_google_absl//absl/strings:cord", 68 "@com_google_protobuf//:protobuf", 69 ], 70) 71 72cc_library( 73 name = "file_backed_resource_cache", 74 srcs = [ 75 "file_backed_resource_cache.cc", 76 ], 77 hdrs = [ 78 "file_backed_resource_cache.h", 79 ], 80 deps = [ 81 ":cache_manifest_cc_proto", 82 ":resource_cache", 83 "//fcp/base", 84 "//fcp/base:clock", 85 "//fcp/base:time_util", 86 "//fcp/client:diag_codes_cc_proto", 87 "//fcp/client:interfaces", 88 "@com_google_absl//absl/cleanup", 89 "@com_google_absl//absl/status", 90 "@com_google_absl//absl/status:statusor", 91 "@com_google_absl//absl/strings", 92 "@com_google_absl//absl/strings:cord", 93 "@com_google_absl//absl/time", 94 "@com_google_protobuf//:protobuf", 95 "@protodatastore_cpp//protostore:file-storage", 96 "@protodatastore_cpp//protostore:proto-data-store", 97 ], 98) 99 100cc_test( 101 name = "file_backed_resource_cache_test", 102 srcs = ["file_backed_resource_cache_test.cc"], 103 deps = [ 104 ":file_backed_resource_cache", 105 "//fcp/base", 106 "//fcp/base:simulated_clock", 107 "//fcp/client:selector_context_cc_proto", 108 "//fcp/client:test_helpers", 109 "//fcp/testing", 110 "@com_google_absl//absl/status:statusor", 111 "@com_google_absl//absl/time", 112 "@com_google_googletest//:gtest_main", 113 ], 114) 115 116cc_library( 117 name = "test_helpers", 118 testonly = 1, 119 hdrs = ["test_helpers.h"], 120 deps = [ 121 ":resource_cache", 122 "@com_google_googletest//:gtest_main", 123 ], 124) 125