Loading tools/aconfig/aconfig_storage_file/Android.bp +1 −1 Original line number Diff line number Diff line Loading @@ -56,7 +56,7 @@ rust_protobuf { min_sdk_version: "29", } cc_library_static { cc_library { name: "libaconfig_storage_protos_cc", proto: { export_proto_headers: true, Loading tools/aconfig/aconfig_storage_file/protos/aconfig_storage_metadata.proto +2 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,8 @@ message storage_file_info { optional string flag_map = 4; optional string flag_val = 5; optional string flag_info = 6; optional int64 timestamp = 7; optional string local_overrides = 7; optional int64 timestamp = 8; } message storage_files { Loading tools/aconfig/aconfig_storage_write_api/aconfig_storage_write_api.cpp +24 −23 Original line number Diff line number Diff line Loading @@ -66,8 +66,31 @@ static Result<std::string> find_storage_file( return Error() << "Unable to find storage files for container " << container; } namespace private_internal_api { /// Get mutable mapped file implementation. Result<MutableMappedStorageFile> get_mutable_mapped_file_impl( std::string const& pb_file, std::string const& container, StorageFileType file_type) { if (file_type != StorageFileType::flag_val && file_type != StorageFileType::flag_info) { return Error() << "Cannot create mutable mapped file for this file type"; } auto file_result = find_storage_file(pb_file, container, file_type); if (!file_result.ok()) { return Error() << file_result.error(); } return map_mutable_storage_file(*file_result); } } // namespace private internal api /// Map a storage file static Result<MutableMappedStorageFile> map_storage_file(std::string const& file) { Result<MutableMappedStorageFile> map_mutable_storage_file(std::string const& file) { struct stat file_stat; if (stat(file.c_str(), &file_stat) < 0) { return ErrnoError() << "stat failed"; Loading Loading @@ -97,28 +120,6 @@ static Result<MutableMappedStorageFile> map_storage_file(std::string const& file return mapped_file; } namespace private_internal_api { /// Get mutable mapped file implementation. Result<MutableMappedStorageFile> get_mutable_mapped_file_impl( std::string const& pb_file, std::string const& container, StorageFileType file_type) { if (file_type != StorageFileType::flag_val && file_type != StorageFileType::flag_info) { return Error() << "Cannot create mutable mapped file for this file type"; } auto file_result = find_storage_file(pb_file, container, file_type); if (!file_result.ok()) { return Error() << file_result.error(); } return map_storage_file(*file_result); } } // namespace private internal api /// Get mutable mapped file Result<MutableMappedStorageFile> get_mutable_mapped_file( std::string const& container, Loading tools/aconfig/aconfig_storage_write_api/include/aconfig_storage/aconfig_storage_write_api.hpp +4 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,10 @@ Result<MutableMappedStorageFile> get_mutable_mapped_file_impl( } // namespace private_internal_api /// Map a storage file Result<MutableMappedStorageFile> map_mutable_storage_file( std::string const& file); /// Get mapped writeable storage file Result<MutableMappedStorageFile> get_mutable_mapped_file( std::string const& container, Loading Loading
tools/aconfig/aconfig_storage_file/Android.bp +1 −1 Original line number Diff line number Diff line Loading @@ -56,7 +56,7 @@ rust_protobuf { min_sdk_version: "29", } cc_library_static { cc_library { name: "libaconfig_storage_protos_cc", proto: { export_proto_headers: true, Loading
tools/aconfig/aconfig_storage_file/protos/aconfig_storage_metadata.proto +2 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,8 @@ message storage_file_info { optional string flag_map = 4; optional string flag_val = 5; optional string flag_info = 6; optional int64 timestamp = 7; optional string local_overrides = 7; optional int64 timestamp = 8; } message storage_files { Loading
tools/aconfig/aconfig_storage_write_api/aconfig_storage_write_api.cpp +24 −23 Original line number Diff line number Diff line Loading @@ -66,8 +66,31 @@ static Result<std::string> find_storage_file( return Error() << "Unable to find storage files for container " << container; } namespace private_internal_api { /// Get mutable mapped file implementation. Result<MutableMappedStorageFile> get_mutable_mapped_file_impl( std::string const& pb_file, std::string const& container, StorageFileType file_type) { if (file_type != StorageFileType::flag_val && file_type != StorageFileType::flag_info) { return Error() << "Cannot create mutable mapped file for this file type"; } auto file_result = find_storage_file(pb_file, container, file_type); if (!file_result.ok()) { return Error() << file_result.error(); } return map_mutable_storage_file(*file_result); } } // namespace private internal api /// Map a storage file static Result<MutableMappedStorageFile> map_storage_file(std::string const& file) { Result<MutableMappedStorageFile> map_mutable_storage_file(std::string const& file) { struct stat file_stat; if (stat(file.c_str(), &file_stat) < 0) { return ErrnoError() << "stat failed"; Loading Loading @@ -97,28 +120,6 @@ static Result<MutableMappedStorageFile> map_storage_file(std::string const& file return mapped_file; } namespace private_internal_api { /// Get mutable mapped file implementation. Result<MutableMappedStorageFile> get_mutable_mapped_file_impl( std::string const& pb_file, std::string const& container, StorageFileType file_type) { if (file_type != StorageFileType::flag_val && file_type != StorageFileType::flag_info) { return Error() << "Cannot create mutable mapped file for this file type"; } auto file_result = find_storage_file(pb_file, container, file_type); if (!file_result.ok()) { return Error() << file_result.error(); } return map_storage_file(*file_result); } } // namespace private internal api /// Get mutable mapped file Result<MutableMappedStorageFile> get_mutable_mapped_file( std::string const& container, Loading
tools/aconfig/aconfig_storage_write_api/include/aconfig_storage/aconfig_storage_write_api.hpp +4 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,10 @@ Result<MutableMappedStorageFile> get_mutable_mapped_file_impl( } // namespace private_internal_api /// Map a storage file Result<MutableMappedStorageFile> map_mutable_storage_file( std::string const& file); /// Get mapped writeable storage file Result<MutableMappedStorageFile> get_mutable_mapped_file( std::string const& container, Loading