init: use protobuf for serialization of persistent properties
I probably should have done this from the start... There's a shim to
convert my manually serialized format to protobuf, and since that has
not yet shipped, it'll be reverted in a short period of time.
Test: init unit tests
Test: upgrade from legacy and intermediate property formats successfully
Change-Id: Iad25f6c30d0b44d294230a53dd6876222d1c785b
diff --git a/init/persistent_properties.h b/init/persistent_properties.h
index d84d9db..5f4df85 100644
--- a/init/persistent_properties.h
+++ b/init/persistent_properties.h
@@ -18,22 +18,19 @@
#define _INIT_PERSISTENT_PROPERTIES_H
#include <string>
-#include <vector>
#include "result.h"
+#include "system/core/init/persistent_properties.pb.h"
namespace android {
namespace init {
-std::vector<std::pair<std::string, std::string>> LoadPersistentProperties();
+PersistentProperties LoadPersistentProperties();
void WritePersistentProperty(const std::string& name, const std::string& value);
// Exposed only for testing
-Result<std::vector<std::pair<std::string, std::string>>> LoadPersistentPropertyFile();
-std::string GenerateFileContents(
- const std::vector<std::pair<std::string, std::string>>& persistent_properties);
-Result<Success> WritePersistentPropertyFile(
- const std::vector<std::pair<std::string, std::string>>& persistent_properties);
+Result<PersistentProperties> LoadPersistentPropertyFile();
+Result<Success> WritePersistentPropertyFile(const PersistentProperties& persistent_properties);
extern std::string persistent_property_filename;
} // namespace init