mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-21 00:03:45 +08:00
params: remove persistent params (#21975)
* cleanup constructors * remove persistent_param * remove test_persist_params_put_and_get old-commit-hash: 3b752a307f167ad536eb53cceac76f7034f2faf9
This commit is contained in:
@@ -228,15 +228,13 @@ std::unordered_map<std::string, uint32_t> keys = {
|
||||
|
||||
} // namespace
|
||||
|
||||
Params::Params(bool persistent_param) : Params(persistent_param ? Path::persistent_params() : Path::params()) {}
|
||||
Params::Params() : params_path(Path::params()) {
|
||||
static std::once_flag once_flag;
|
||||
std::call_once(once_flag, ensure_params_path, params_path);
|
||||
}
|
||||
|
||||
std::once_flag default_params_path_ensured;
|
||||
Params::Params(const std::string &path) : params_path(path) {
|
||||
if (path == Path::params()) {
|
||||
std::call_once(default_params_path_ensured, ensure_params_path, path);
|
||||
} else {
|
||||
ensure_params_path(path);
|
||||
}
|
||||
ensure_params_path(params_path);
|
||||
}
|
||||
|
||||
bool Params::checkKey(const std::string &key) {
|
||||
|
||||
@@ -17,11 +17,8 @@ enum ParamKeyType {
|
||||
};
|
||||
|
||||
class Params {
|
||||
private:
|
||||
std::string params_path;
|
||||
|
||||
public:
|
||||
Params(bool persistent_param = false);
|
||||
Params();
|
||||
Params(const std::string &path);
|
||||
|
||||
bool checkKey(const std::string &key);
|
||||
@@ -78,4 +75,7 @@ public:
|
||||
inline int putBool(const std::string &key, bool val) {
|
||||
return putBool(key.c_str(), val);
|
||||
}
|
||||
|
||||
private:
|
||||
const std::string params_path;
|
||||
};
|
||||
|
||||
@@ -29,9 +29,6 @@ inline std::string log_root() {
|
||||
inline std::string params() {
|
||||
return Hardware::PC() ? HOME + "/.comma/params" : "/data/params";
|
||||
}
|
||||
inline std::string persistent_params() {
|
||||
return Hardware::PC() ? HOME + "/.comma/params" : "/persist/comma/params";
|
||||
}
|
||||
inline std::string rsa_file() {
|
||||
return Hardware::PC() ? HOME + "/.comma/persist/comma/id_rsa" : "/persist/comma/id_rsa";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user