|
|
/**
|
|||
|
|
* Tencent is pleased to support the open source community by making Tars available.
|
|||
|
|
*
|
|||
|
|
* Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved.
|
|||
|
|
*
|
|||
|
|
* Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
|
|||
|
|
* in compliance with the License. You may obtain a copy of the License at
|
|||
|
|
*
|
|||
|
|
* https://opensource.org/licenses/BSD-3-Clause
|
|||
|
|
*
|
|||
|
|
* Unless required by applicable law or agreed to in writing, software distributed
|
|||
|
|
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|||
|
|
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|||
|
|
* specific language governing permissions and limitations under the License.
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
#include "NodeDescriptor.tars"
|
|||
|
|
#include "RegistryDescriptor.tars"
|
|||
|
|
module tars
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
interface Node
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 销毁指定服务
|
|||
|
|
* @param application 服务所属应用名
|
|||
|
|
* @param serverName 服务名
|
|||
|
|
* @return int 0成功 其它失败
|
|||
|
|
*/
|
|||
|
|
int destroyServer(string application,string serverName, out string result);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* patch指定服务
|
|||
|
|
* @param application 服务所属应用名
|
|||
|
|
* @param serverName 服务名
|
|||
|
|
* @param appDistrib 在patch server 上的app目录
|
|||
|
|
* @param shutdown 是否要求服务状态为disactive
|
|||
|
|
* @return int 0成功 其它失败
|
|||
|
|
*/
|
|||
|
|
// int patch(string application, string serverName, bool shutDown,string patchServer, out string result);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 增强的发布接口
|
|||
|
|
* pushRequest 插入发布请求到队列
|
|||
|
|
* @param req 发布请求
|
|||
|
|
* @return int 0成功 其它失败
|
|||
|
|
*/
|
|||
|
|
int patchPro(PatchRequest req, out string result);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 预发布将指定版本的tgz拉取到本地
|
|||
|
|
*
|
|||
|
|
*/
|
|||
|
|
// int preparePatchPro(PreparePatchRequest req, out string result);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 发布服务进度
|
|||
|
|
* @param application 服务所属应用名
|
|||
|
|
* @param serverName 服务名
|
|||
|
|
* @out tPatchInfo下载信息
|
|||
|
|
* @return int
|
|||
|
|
*/
|
|||
|
|
// int getPreparePatchPercent(string application,string serverName,out PreparePatchInfo prepareInfo);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* patch指定文件路径
|
|||
|
|
* @param srcFile 文件或者路径在patch服务器上的目录
|
|||
|
|
* @param dstFile 文件或者路径在node服务器上存放的目录
|
|||
|
|
* @param patchServer patch服务器
|
|||
|
|
* @return int 0成功 其它失败
|
|||
|
|
*/
|
|||
|
|
// int patchSubborn(string patchServer, string application, string serverName, string srcFile, string dstFile, out string result);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 下载指定文件
|
|||
|
|
* @param application 服务所属应用名
|
|||
|
|
* @param serverName 服务名
|
|||
|
|
* @param file 文件名
|
|||
|
|
* @param out result 失败说明
|
|||
|
|
* @return int 0成功 非0失败
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
int addFile(string application, string serverName, string file,out string result);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 获取node名称
|
|||
|
|
* @return string
|
|||
|
|
*/
|
|||
|
|
string getName();
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 获取node上负载
|
|||
|
|
* @return LoadInfo
|
|||
|
|
*/
|
|||
|
|
LoadInfo getLoad();
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 关闭node
|
|||
|
|
* @return int
|
|||
|
|
*/
|
|||
|
|
int shutdown(out string result);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 关闭node上所有服务
|
|||
|
|
* @return int
|
|||
|
|
*/
|
|||
|
|
int stopAllServers(out string result);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 载入指定服务
|
|||
|
|
* @param application 服务所属应用名
|
|||
|
|
* @param serverName 服务名
|
|||
|
|
* @return int
|
|||
|
|
*/
|
|||
|
|
int loadServer(string application, string serverName, out string result);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 启动指定服务
|
|||
|
|
* @param application 服务所属应用名
|
|||
|
|
* @param serverName 服务名
|
|||
|
|
* @return int
|
|||
|
|
*/
|
|||
|
|
int startServer(string application,string serverName, out string result);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 停止指定服务
|
|||
|
|
* @param application 服务所属应用名
|
|||
|
|
* @param serverName 服务名
|
|||
|
|
* @return int
|
|||
|
|
*/
|
|||
|
|
int stopServer(string application,string serverName, out string result);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 重启指定服务
|
|||
|
|
* @param application 服务所属应用名
|
|||
|
|
* @param serverName 服务名
|
|||
|
|
* @return int
|
|||
|
|
*/
|
|||
|
|
// int restartServer(string application,string serverName, out string result);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 通知服务
|
|||
|
|
* @return int
|
|||
|
|
*/
|
|||
|
|
int notifyServer(string application, string serverName, string command, out string result);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 获取指定服务pid进程号
|
|||
|
|
* @param application 服务所属应用名
|
|||
|
|
* @param serverName 服务名
|
|||
|
|
* @return int
|
|||
|
|
*/
|
|||
|
|
int getServerPid(string application,string serverName, out string result);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 获取指定服务registry设置的状态
|
|||
|
|
* @param application 服务所属应用名
|
|||
|
|
* @param serverName 服务名
|
|||
|
|
* @return int
|
|||
|
|
*/
|
|||
|
|
ServerState getSettingState(string application,string serverName, out string result);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 获取指定服务状态
|
|||
|
|
* @param application 服务所属应用名
|
|||
|
|
* @param serverName 服务名
|
|||
|
|
* @return ServerState
|
|||
|
|
*/
|
|||
|
|
ServerState getState(string application,string serverName, out string result);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 获取指定服务在node信息
|
|||
|
|
* @param application 服务所属应用名
|
|||
|
|
* @param serverName 服务名
|
|||
|
|
* @return ServerState
|
|||
|
|
*/
|
|||
|
|
int getStateInfo(string application,string serverName,out ServerStateInfo info,out string result);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 同步服务状态
|
|||
|
|
* @param application 服务所属应用名
|
|||
|
|
* @param serverName 服务名
|
|||
|
|
* @return int
|
|||
|
|
*/
|
|||
|
|
int synState(string application,string serverName, out string result);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 发布服务进度
|
|||
|
|
* @param application 服务所属应用名
|
|||
|
|
* @param serverName 服务名
|
|||
|
|
* @out tPatchInfo下载信息
|
|||
|
|
* @return int
|
|||
|
|
*/
|
|||
|
|
int getPatchPercent(string application,string serverName,out PatchInfo tPatchInfo);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
*备份和删除cache的共享内存
|
|||
|
|
*@param sFullCacheName cache服务全名
|
|||
|
|
*@param sBackupPath 备份路径
|
|||
|
|
*@param sKey 共享内存的key值,如果为空则通过路径和‘D’生成
|
|||
|
|
*@return int
|
|||
|
|
*/
|
|||
|
|
int delCache(string sFullCacheName,string sBackupPath, string sKey, out string result);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 获取机器没有使用的共享内存的key列表,每台机器最多分配256个key, -1分配失败
|
|||
|
|
*/
|
|||
|
|
int getUnusedShmKeys(int count, out vector<int> shm_keys);
|
|||
|
|
|
|||
|
|
/*
|
|||
|
|
* 重新获取部署在该节点的服务配置文件
|
|||
|
|
*/
|
|||
|
|
// int reloadServerConf(string application,string serverName, out string result);
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
};
|
|||
|
|
|