-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathNotifyF.tars
More file actions
118 lines (104 loc) · 2.53 KB
/
NotifyF.tars
File metadata and controls
118 lines (104 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/**
* 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.
*/
module tars
{
/**
* notify信息的键值
*/
struct NotifyKey
{
1 require string name; //为app+servername 例如:Comm.BindServer
2 require string ip; //ip
3 require int page;
};
/**
* 上报信息的单条内容
*/
struct NotifyItem
{
1 require string sTimeStamp;
2 require string sServerId;
3 require int iLevel;
4 require string sMessage;
};
/**
* 上报的信息分页记录
*/
struct NotifyInfo
{
1 require int nextpage;
2 require vector<NotifyItem> notifyItems;
};
/**
* 定义上报信息的等级
*/
enum NOTIFYLEVEL
{
NOTIFYNORMAL,
NOTIFYWARN,
NOTIFYERROR,
};
/*
*上报类型
*/
enum ReportType
{
REPORT,
NOTIFY
};
/*
*上报notify信息的数据结构
*/
struct ReportInfo
{
1 require ReportType eType;
2 require string sApp;
3 require string sSet;
4 require string sContainer;
5 require string sServer;
6 require string sMessage;
7 optional string sThreadId;
8 optional NOTIFYLEVEL eLevel;
};
interface Notify
{
/**
* 框架上报的信息, 保存于数据库中
* @param sServerName, server name
* @param sThreadId, server current thread id
* @param sMessage, message
**/
void reportServer(string sServerName, string sThreadId, string sMessage);
/**
* 业务上报的信息, 用于报警
* @param sServerName, server name
* @param level, notify level
* @param sMessage, message
**/
void notifyServer(string sServerName, NOTIFYLEVEL level, string sMessage);
/**
* 获取上报信息
* @param sServerName, server name
* @param out , notify info detail
* @return int 0=success, others=failed
**/
int getNotifyInfo(NotifyKey stKey, out NotifyInfo stInfo);
/*
*上报框架信息以及业务告警信息
*/
void reportNotifyInfo(ReportInfo info);
};
};