Rename SonarState* to FlipperState*

Summary: Part of sonar to flipper rename

Reviewed By: passy

Differential Revision: D9919821

fbshipit-source-id: a44a2a04d5463750f884f8bf1328e02d56593e82
This commit is contained in:
John Knox
2018-09-24 05:53:51 -07:00
committed by Facebook Github Bot
parent 1d2793f701
commit c1295b1bc9
13 changed files with 42 additions and 42 deletions

View File

@@ -0,0 +1,58 @@
/*
* 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.
*
*/
#pragma once
#include <memory>
#include <string>
#include <vector>
#include <map>
class SonarStep;
class FlipperStateUpdateListener;
namespace facebook {
namespace flipper {
enum State { success, in_progress, failed };
class StateElement {
public:
StateElement(std::string name, State state): name_(name), state_(state) {};
std::string name_;
State state_;
};
}
}
class FlipperState {
friend SonarStep;
public:
FlipperState();
void setUpdateListener(std::shared_ptr<FlipperStateUpdateListener>);
std::string getState();
std::vector<facebook::flipper::StateElement> getStateElements();
/* To record a state update, call start() with the name of the step to get a
SonarStep object. Call complete on this to register it successful,
the absense of the completion call when it is destructed will register as a
step failure. */
std::shared_ptr<SonarStep> start(std::string step);
private:
void success(std::string);
void failed(std::string, std::string);
void started(std::string);
std::shared_ptr<FlipperStateUpdateListener> mListener = nullptr;
std::string log;
std::vector<std::string> insertOrder;
std::map<std::string, facebook::flipper::State> stateMap;
};