2019-04-21 03:58:24 +08:00
|
|
|
#pragma once
|
|
|
|
#if defined(NO_INTELLISENSE) && !defined(FDBSERVER_EXEC_HELPER_ACTOR_G_H)
|
2021-03-11 02:06:03 +08:00
|
|
|
#define FDBSERVER_EXEC_HELPER_ACTOR_G_H
|
|
|
|
#include "fdbserver/FDBExecHelper.actor.g.h"
|
2019-04-21 03:58:24 +08:00
|
|
|
#elif !defined(FDBSERVER_EXEC_HELPER_ACTOR_H)
|
2021-03-11 02:06:03 +08:00
|
|
|
#define FDBSERVER_EXEC_HELPER_ACTOR_H
|
2019-04-21 03:58:24 +08:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
|
|
|
#include "flow/Arena.h"
|
|
|
|
#include "flow/flow.h"
|
|
|
|
#include "flow/actorcompiler.h"
|
2019-06-20 02:20:44 +08:00
|
|
|
#include "fdbclient/FDBTypes.h"
|
2019-04-21 03:58:24 +08:00
|
|
|
|
|
|
|
// execute/snapshot command takes two arguments: <param1> <param2>
|
|
|
|
// param1 - represents the command type/name
|
|
|
|
// param2 - takes a binary path followed by a set of arguments in the following
|
|
|
|
// format <binary-path>:<key1=val1>,<key2=val2>...
|
|
|
|
// this class will abstract the format and give functions to get various pieces
|
|
|
|
// of information
|
|
|
|
class ExecCmdValueString {
|
|
|
|
public: // ctor & dtor
|
|
|
|
ExecCmdValueString() {}
|
|
|
|
explicit ExecCmdValueString(StringRef cmdValueString);
|
|
|
|
|
|
|
|
public: // interfaces
|
2020-12-27 13:51:58 +08:00
|
|
|
StringRef getBinaryPath() const;
|
|
|
|
VectorRef<StringRef> getBinaryArgs() const;
|
2019-04-21 03:58:24 +08:00
|
|
|
void setCmdValueString(StringRef cmdValueString);
|
2020-12-27 13:51:58 +08:00
|
|
|
StringRef getCmdValueString(void) const;
|
2019-04-21 03:58:24 +08:00
|
|
|
|
|
|
|
public: // helper functions
|
2020-12-27 13:51:58 +08:00
|
|
|
void dbgPrint() const;
|
2019-04-21 03:58:24 +08:00
|
|
|
|
|
|
|
private: // functions
|
|
|
|
void parseCmdValue();
|
|
|
|
|
|
|
|
private: // data
|
|
|
|
Standalone<StringRef> cmdValueString;
|
|
|
|
Standalone<VectorRef<StringRef>> binaryArgs;
|
|
|
|
StringRef binaryPath;
|
|
|
|
};
|
|
|
|
|
|
|
|
// FIXME: move this function to a common location
|
|
|
|
// spawns a process pointed by `binPath` and the arguments provided at `paramList`,
|
|
|
|
// if the process spawned takes more than `maxWaitTime` then it will be killed
|
|
|
|
// if isSync is set to true then the process will be synchronously executed
|
2019-07-16 02:33:40 +08:00
|
|
|
// if async and in simulator then delay spawning the process to max of maxSimDelayTime
|
2021-03-11 02:06:03 +08:00
|
|
|
ACTOR Future<int> spawnProcess(std::string binPath,
|
|
|
|
std::vector<std::string> paramList,
|
|
|
|
double maxWaitTime,
|
|
|
|
bool isSync,
|
|
|
|
double maxSimDelayTime);
|
2019-04-21 03:58:24 +08:00
|
|
|
|
|
|
|
// helper to run all the work related to running the exec command
|
2019-08-29 01:52:56 +08:00
|
|
|
ACTOR Future<int> execHelper(ExecCmdValueString* execArg, UID snapUID, std::string folder, std::string role);
|
2019-04-21 03:58:24 +08:00
|
|
|
|
2019-06-20 02:20:44 +08:00
|
|
|
// set the data version for the specified storage server UID
|
|
|
|
void setDataVersion(UID uid, Version version);
|
|
|
|
// set the data durable version for the specified storage server UID
|
|
|
|
void setDataDurableVersion(UID uid, Version version);
|
|
|
|
// print the version info all the storages servers on this node
|
|
|
|
void printStorageVersionInfo();
|
|
|
|
|
2019-06-27 04:33:19 +08:00
|
|
|
#include "flow/unactorcompiler.h"
|
2019-04-21 03:58:24 +08:00
|
|
|
#endif
|