Revert D8932114: [sonar] Add state tracking plumbing

Differential Revision:
D8932114

Original commit changeset: fb03babfe92b

fbshipit-source-id: a6a372a4115d69b5419a8c9924b333e7c163497b
This commit is contained in:
Daniel Abramowitz
2018-08-03 08:18:26 -07:00
committed by Facebook Github Bot
parent e82fd6371d
commit 410e6d14c8
11 changed files with 0 additions and 259 deletions

View File

@@ -1,54 +0,0 @@
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
*/
#include "SonarState.h"
#include "SonarStateUpdateListener.h"
#include "SonarStep.h"
/* Class responsible for collecting state updates and combining them into a
* view of the current state of the sonar client. */
SonarState::SonarState() {
stateUpdates = "";
}
void SonarState::setUpdateListener(
std::shared_ptr<SonarStateUpdateListener> listener) {
mListener = listener;
}
void SonarState::started(std::string step) {
stateUpdates = stateUpdates + "[Started] " + step + "\n";
if (mListener) {
mListener->onUpdate();
}
}
void SonarState::success(std::string step) {
stateUpdates = stateUpdates + "[Success] " + step + "\n";
if (mListener) {
mListener->onUpdate();
}
}
void SonarState::failed(std::string step, std::string errorMessage) {
stateUpdates = stateUpdates + "[Failed] " + step + "\n";
if (mListener) {
mListener->onUpdate();
}
}
// TODO: Currently returns string, but should really provide a better
// representation of the current state so the UI can show it in a more intuitive
// way
std::string SonarState::getState() {
return stateUpdates;
}
std::shared_ptr<SonarStep> SonarState::start(std::string step_name) {
started(step_name);
return std::make_shared<SonarStep>(step_name, this);
}