#include <manifest_parser/utils/logging.h>
-#include <boost/bind.hpp>
-
+#include <algorithm>
#include <list>
#include <memory>
#include <string>
#include <utility>
#include "common/archive_info.h"
+#include "common/history_logger.h"
#include "common/pkgmgr_interface.h"
#include "common/pkgmgr_signal.h"
#include "common/step/step.h"
* the lists of steps and runs each of the step in the configured
* order.
*/
-class AppInstaller {
+class AppInstaller : public Step::IStepErrorSignal {
public:
/** Enumeration of possible returned Results */
enum class Result {
/** virtual desctructor */
virtual ~AppInstaller();
+ /** error handler for sending error signal */
+ void on_error(Step::Status result, const std::string& error) override;
+
/**
* \brief Adds new step to installer by specified type
* Type of template parameter is used to create requested step
void AddStep(Args&&... args) {
std::unique_ptr<Step> step(
new StepT(context_.get(), std::forward<Args>(args)...));
- step->on_error.connect(
- boost::bind(&AppInstaller::HandleStepError, this, _1, _2));
+ step->connect(this);
steps_.emplace_back(std::move(step));
}
void AddStepAtIndex(unsigned int index, Args&&... args) {
std::unique_ptr<Step> step(
new StepT(context_.get(), std::forward<Args>(args)...));
- step->on_error.connect(
- boost::bind(&AppInstaller::HandleStepError, this, _1, _2));
+ step->connect(this);
std::list<std::unique_ptr<Step>> tmpList;
tmpList.emplace_back(std::move(step));
auto it = steps_.begin();
std::unique_ptr<Step> step(
new StepT(context_.get(), std::forward<Args>(args)...));
- step->on_error.connect(
- boost::bind(&AppInstaller::HandleStepError, this, _1, _2));
+ step->connect(this);
*it = std::move(step);
}
std::unique_ptr<Step> step(
new StepT(context_.get(), std::forward<Args>(args)...));
- step->on_error.connect(
- boost::bind(&AppInstaller::HandleStepError, this, _1, _2));
+ step->connect(this);
steps_.insert(it, std::move(step));
}
std::unique_ptr<Step> step(
new StepT(context_.get(), std::forward<Args>(args)...));
- step->on_error.connect(
- boost::bind(&AppInstaller::HandleStepError, this, _1, _2));
+ step->connect(this);
steps_.insert(++it, std::move(step));
}
std::list<std::unique_ptr<Step>>::iterator it_;
// data used to send signal
- std::unique_ptr<PkgmgrSignal> pi_;
+ std::unique_ptr<PkgmgrSignal> ps_;
+ bool SendStartIfNotSent(bool is_skippable);
void SendProgress(int progress);
void SendFinished(Step::Status status);
Step::Status SafeExecute(std::unique_ptr<Step> const& step_ptr,
Step::Status (Step::*method)(),
std::string name);
void HandleStepError(Step::Status result, const std::string& error);
+ std::string GetPackageVersion();
std::shared_ptr<utils::FileLogBackend> failure_logger_;
Step::Status status_;
Result result_;
- void LogHistory(bool success);
int index_;
+ HistoryLogger history_logger_;
friend class InstallerRunner;