节点在线、应用在线、配置在线使用令牌查询
大石头 authored at 2021-12-16 19:49:30
799.00 B
Stardust
// SPDX-License-Identifier: MIT
#pragma once

#include <functional>
#include <string>

namespace staragent::service {

struct InstallOptions
{
    std::string ConfigPath;
    std::string InstallDir;
    std::string DataDir;
    std::string ServiceUser;
    std::string Server;
};

struct Result
{
    bool Success = false;
    std::string Message;
};

Result Install(const InstallOptions& options);
Result Uninstall();
Result Start();
Result Stop();
std::string Status();

// Runs body under the platform service manager. Returns -1 when the process
// was not launched by the service manager (the caller should run in console
// mode), otherwise the body's exit code.
int RunAsService(const std::function<int()>& body, const std::function<void()>& request_stop);

} // namespace staragent::service