virthttp  0.0
libvirt http interface
Enumerations | Functions
depends.hpp File Reference
#include <vector>
#include <rapidjson/document.h>
#include "json_utils.hpp"
#include "utils.hpp"

Go to the source code of this file.

Enumerations

enum  DependsOutcome { DependsOutcome::SUCCESS, DependsOutcome::FAILURE, DependsOutcome::SKIPPED }
 

Functions

bool check_depends (const rapidjson::Value &depends_json, std::vector< DependsOutcome > &outcomes, JsonRes &json_res) noexcept
 
template<typename Hdl >
void handle_depends (const rapidjson::Value &json_req, JsonRes &json_res, Hdl &&hdl)
 

Enumeration Type Documentation

enum DependsOutcome
strong

Possible outcomes of a dependent action

Enumerator
SUCCESS 
FAILURE 
SKIPPED 

Function Documentation

bool check_depends ( const rapidjson::Value &  depends_json,
std::vector< DependsOutcome > &  outcomes,
JsonRes json_res 
)
noexcept

Checks the dependency status of an action

Parameters
[in]depends_json(possibly) dependent action
[in]outcomesthe current stack of previously obtained outcomes
[in]json_resthe response body, as JSON
Returns
true if the dependency chain is holding, false if broken
template<typename Hdl >
void handle_depends ( const rapidjson::Value &  json_req,
JsonRes json_res,
Hdl &&  hdl 
)

Calls an action handler on all actions which dependency chain is holding

Template Parameters
Hdl(deduced)
Parameters
[in]json_reqthe JSON array of actions to be performed
[in]json_resthe response body, as JSON
[in]hdlthe action handler; callable of signature DependsOutcome(const rapidjson::Value&)