[cleanup][device_info] While reading the code.
* Add comments for methods in device_info.h
* Remove obsolete TODOs and FIXMEs in the .cc
TEST=none (no code changes)
Change-Id: I530c539a14bbe7f1533354c85f2d102d8de94ae3
diff --git a/lib/device_info/device_info.cc b/lib/device_info/device_info.cc
index 218d910..ab44e30 100644
--- a/lib/device_info/device_info.cc
+++ b/lib/device_info/device_info.cc
@@ -40,7 +40,6 @@
// TODO(security): this is a temporary implementation. audit the revocability
// of this ID for syncing.
-// TODO(zbowling): refactor to use flatbuffer for storage
std::string LoadDeviceID(const std::string& user) {
std::string device_id;
@@ -48,7 +47,6 @@
files::CreateDirectory(kDeviceInfoDirectory);
}
- // FIXME(zbowling): this isn't scalable
std::string path = fxl::StringPrintf(kDeviceIDFile, user.c_str());
if (!files::ReadFileToString(path, &device_id)) {
diff --git a/lib/device_info/device_info.h b/lib/device_info/device_info.h
index bf7a39f..fde3c7a 100644
--- a/lib/device_info/device_info.h
+++ b/lib/device_info/device_info.h
@@ -9,10 +9,21 @@
namespace modular {
+// Reads the contents of /data/device/profile_config.json and returns the
+// result. If the file cannot be read, returns empty JSON-encoded object, "{}".
std::string LoadDeviceProfile();
+// Reads a device id, scoped to |user|, for this device. Generates and persists
+// one on the first call of LoadDeviceID() on this device for this |user|.
+//
+// Thread-hostile.
std::string LoadDeviceID(const std::string& user);
+// A wrapper around gethostname() which a) translates an error into the string
+// "fuchsia" and b) caches the output to a file scoped by |user| for future
+// calls.
+//
+// Thread-hostile.
std::string LoadDeviceName(const std::string& user);
} // namespace modular