1# Copyright 2020 The Pigweed Authors 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); you may not 4# use this file except in compliance with the License. You may obtain a copy of 5# the License at 6# 7# https://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, WITHOUT 11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12# License for the specific language governing permissions and limitations under 13# the License. 14 15load("@rules_cc//cc:cc_library.bzl", "cc_library") 16load("@rules_python//sphinxdocs:sphinx_docs_library.bzl", "sphinx_docs_library") 17load("//pw_build:compatibility.bzl", "incompatible_with_mcu") 18load("//pw_unit_test:pw_cc_test.bzl", "pw_cc_test") 19 20package( 21 default_visibility = ["//visibility:public"], 22 features = ["-layering_check"], 23) 24 25licenses(["notice"]) 26 27cc_library( 28 name = "pw_blob_store", 29 srcs = ["blob_store.cc"], 30 hdrs = [ 31 "public/pw_blob_store/blob_store.h", 32 "public/pw_blob_store/internal/metadata_format.h", 33 ], 34 implementation_deps = ["//pw_assert:check"], 35 strip_include_prefix = "public", 36 deps = [ 37 "//pw_assert:assert", 38 "//pw_bytes", 39 "//pw_checksum", 40 "//pw_kvs", 41 "//pw_log", 42 "//pw_preprocessor", 43 "//pw_span", 44 "//pw_status", 45 "//pw_stream", 46 "//pw_sync:borrow", 47 ], 48) 49 50cc_library( 51 name = "flat_file_system_entry", 52 srcs = ["flat_file_system_entry.cc"], 53 hdrs = ["public/pw_blob_store/flat_file_system_entry.h"], 54 implementation_deps = ["//pw_assert:check"], 55 strip_include_prefix = "public", 56 deps = [ 57 ":pw_blob_store", 58 "//pw_bytes", 59 "//pw_file:flat_file_system", 60 "//pw_status", 61 "//pw_sync:mutex", 62 ], 63) 64 65pw_cc_test( 66 name = "blob_store_test", 67 srcs = [ 68 "blob_store_test.cc", 69 ], 70 # TODO: b/385375184 - Fix this test! 71 tags = ["noubsan"], 72 deps = [ 73 ":pw_blob_store", 74 "//pw_kvs:crc16", 75 "//pw_kvs:fake_flash", 76 "//pw_kvs:fake_flash_test_key_value_store", 77 "//pw_log", 78 "//pw_random", 79 "//pw_sync:borrow", 80 ], 81) 82 83pw_cc_test( 84 name = "blob_store_chunk_write_test", 85 srcs = [ 86 "blob_store_chunk_write_test.cc", 87 ], 88 deps = [ 89 ":pw_blob_store", 90 "//pw_kvs:crc16", 91 "//pw_kvs:fake_flash", 92 "//pw_kvs:fake_flash_test_key_value_store", 93 "//pw_log", 94 "//pw_random", 95 ], 96) 97 98pw_cc_test( 99 name = "blob_store_deferred_write_test", 100 srcs = [ 101 "blob_store_deferred_write_test.cc", 102 ], 103 deps = [ 104 ":pw_blob_store", 105 "//pw_kvs:crc16", 106 "//pw_kvs:fake_flash", 107 "//pw_kvs:fake_flash_test_key_value_store", 108 "//pw_log", 109 "//pw_random", 110 ], 111) 112 113pw_cc_test( 114 name = "flat_file_system_entry_test", 115 srcs = ["flat_file_system_entry_test.cc"], 116 deps = [ 117 ":flat_file_system_entry", 118 ":pw_blob_store", 119 "//pw_kvs:crc16", 120 "//pw_kvs:fake_flash", 121 "//pw_kvs:fake_flash_test_key_value_store", 122 "//pw_random", 123 "//pw_sync:mutex", 124 ], 125) 126 127sphinx_docs_library( 128 name = "docs", 129 srcs = [ 130 "docs.rst", 131 ], 132 prefix = "pw_blob_store/", 133 target_compatible_with = incompatible_with_mcu(), 134) 135