4 #include <boost/filesystem.hpp>
5 #include <boost/optional.hpp>
9 #include "invstorage.h"
10 #include "sqlstorage_base.h"
12 extern const std::vector<std::string> libaktualizr_schema_migrations;
13 extern const std::vector<std::string> libaktualizr_schema_rollback_migrations;
14 extern const std::string libaktualizr_current_schema;
15 extern const int libaktualizr_current_schema_version;
17 class SQLTargetRHandle;
20 friend class SQLTargetWHandle;
21 friend class SQLTargetRHandle;
24 void storePrimaryKeys(
const std::string& public_key,
const std::string& private_key)
override;
25 bool loadPrimaryKeys(std::string* public_key, std::string* private_key)
const override;
26 bool loadPrimaryPublic(std::string* public_key)
const override;
27 bool loadPrimaryPrivate(std::string* private_key)
const override;
28 void clearPrimaryKeys()
override;
30 void saveSecondaryInfo(
const Uptane::EcuSerial& ecu_serial,
const std::string& sec_type,
34 bool loadSecondariesInfo(std::vector<SecondaryInfo>* secondaries)
const override;
36 void storeTlsCreds(
const std::string& ca,
const std::string& cert,
const std::string& pkey)
override;
37 void storeTlsCa(
const std::string& ca)
override;
38 void storeTlsCert(
const std::string& cert)
override;
39 void storeTlsPkey(
const std::string& pkey)
override;
40 bool loadTlsCreds(std::string* ca, std::string* cert, std::string* pkey)
const override;
41 void clearTlsCreds()
override;
42 bool loadTlsCa(std::string* ca)
const override;
43 bool loadTlsCert(std::string* cert)
const override;
44 bool loadTlsPkey(std::string* pkey)
const override;
51 void clearMetadata()
override;
54 bool loadAllDelegations(std::vector<std::pair<Uptane::Role, std::string>>&
data)
const override;
56 void clearDelegations()
override;
58 void storeDeviceId(
const std::string& device_id)
override;
59 bool loadDeviceId(std::string* device_id)
const override;
60 void clearDeviceId()
override;
61 void storeEcuSerials(
const EcuSerials& serials)
override;
62 bool loadEcuSerials(EcuSerials* serials)
const override;
63 void clearEcuSerials()
override;
64 void storeCachedEcuManifest(
const Uptane::EcuSerial& ecu_serial,
const std::string& manifest)
override;
65 bool loadCachedEcuManifest(
const Uptane::EcuSerial& ecu_serial, std::string* manifest)
const override;
67 bool loadMisconfiguredEcus(std::vector<MisconfiguredEcu>* ecus)
const override;
68 void clearMisconfiguredEcus()
override;
69 void storeEcuRegistered()
override;
70 bool loadEcuRegistered()
const override;
71 void clearEcuRegistered()
override;
72 void storeNeedReboot()
override;
73 bool loadNeedReboot(
bool* need_reboot)
const override;
74 void clearNeedReboot()
override;
75 void saveInstalledVersion(
const std::string& ecu_serial,
const Uptane::Target& target,
76 InstalledVersionUpdateMode update_mode)
override;
77 bool loadInstalledVersions(
const std::string& ecu_serial, boost::optional<Uptane::Target>* current_version,
78 boost::optional<Uptane::Target>* pending_version)
const override;
79 bool loadInstallationLog(
const std::string& ecu_serial, std::vector<Uptane::Target>* log,
80 bool only_installed)
const override;
81 bool hasPendingInstall()
override;
82 void getPendingEcus(std::vector<std::pair<Uptane::EcuSerial, Hash>>* pendingEcus)
override;
83 void clearInstalledVersions()
override;
86 bool loadEcuInstallationResults(
87 std::vector<std::pair<Uptane::EcuSerial, data::InstallationResult>>* results)
const override;
89 const std::string& correlation_id)
override;
90 bool storeDeviceInstallationRawReport(
const std::string& raw_report)
override;
92 std::string* correlation_id)
const override;
93 void saveEcuReportCounter(
const Uptane::EcuSerial& ecu_serial, int64_t counter)
override;
94 bool loadEcuReportCounter(std::vector<std::pair<Uptane::EcuSerial, int64_t>>* results)
const override;
95 void saveReportEvent(
const Json::Value& json_value)
override;
96 bool loadReportEvents(Json::Value* report_array, int64_t* id_max)
const override;
97 void deleteReportEvents(int64_t id_max)
override;
98 void clearInstallationResults()
override;
100 void storeDeviceDataHash(
const std::string& data_type,
const std::string& hash)
override;
101 bool loadDeviceDataHash(
const std::string& data_type, std::string* hash)
const override;
102 void clearDeviceData()
override;
104 void storeTargetFilename(
const std::string& targetname,
const std::string& filename)
const override;
105 std::string getTargetFilename(
const std::string& targetname)
const override;
106 std::vector<std::string> getAllTargetNames()
const override;
107 void deleteTargetInfo(
const std::string& targetname)
const override;
109 void cleanUp()
override;
110 StorageType type()
override {
return StorageType::kSqlite; };
116 #endif // SQLSTORAGE_H_