1 #ifndef PACKAGEMANAGERINTERFACE_H_
2 #define PACKAGEMANAGERINTERFACE_H_
7 #include "libaktualizr/config.h"
15 class FlowControlToken;
22 using FetcherProgressCb = std::function<void(
const Uptane::Target&,
const std::string&,
unsigned int)>;
27 enum class TargetStatus {
45 const std::shared_ptr<INvStorage>& storage,
const std::shared_ptr<HttpInterface>& http)
46 : config(pconfig), storage_(storage), http_(http) {
50 virtual std::string name()
const = 0;
51 virtual Json::Value getInstalledPackages()
const = 0;
54 virtual void completeInstall()
const {
throw std::runtime_error(
"Unimplemented"); }
56 virtual void updateNotify() {}
59 virtual TargetStatus verifyTarget(
const Uptane::Target& target)
const;
60 virtual bool checkAvailableDiskSpace(
const uint64_t required_bytes)
const;
61 virtual boost::optional<std::pair<uintmax_t, std::string>> checkTargetFile(
const Uptane::Target& target)
const;
62 virtual std::ofstream createTargetFile(
const Uptane::Target& target);
63 virtual std::ofstream appendTargetFile(
const Uptane::Target& target);
64 virtual std::ifstream openTargetFile(
const Uptane::Target& target)
const;
66 virtual std::vector<Uptane::Target> getTargetFiles();
70 std::shared_ptr<INvStorage> storage_;
71 std::shared_ptr<HttpInterface> http_;
73 #endif // PACKAGEMANAGERINTERFACE_H_