1/*
2 * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License, version 2.0,
6 * as published by the Free Software Foundation.
7 *
8 * This program is also distributed with certain software (including
9 * but not limited to OpenSSL) that is licensed under separate terms,
10 * as designated in a particular file or component or in included license
11 * documentation.  The authors of MySQL hereby grant you an additional
12 * permission to link the program and your derivative works with the
13 * separately licensed software that they have included with MySQL.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU General Public License, version 2.0, for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
23 */
24
25// tell protobuf 3.0 to use protobuf 2.x rules
26syntax = "proto2";
27
28import "mysqlx.proto"; // comment_out_if PROTOBUF_LITE
29
30// ifdef PROTOBUF_LITE: option optimize_for = LITE_RUNTIME;
31
32// Notices
33//
34// A notice
35//
36// * is sent from the server to the client
37// * may be global or relate to the current message sequence
38package Mysqlx.Notice;
39option java_package = "com.mysql.cj.x.protobuf";
40
41import "mysqlx_datatypes.proto";
42
43// Common Frame for all Notices
44//
45// ===================================================== =====
46// .type                                                 value
47// ===================================================== =====
48// :protobuf:msg:`Mysqlx.Notice::Warning`                1
49// :protobuf:msg:`Mysqlx.Notice::SessionVariableChanged` 2
50// :protobuf:msg:`Mysqlx.Notice::SessionStateChanged`    3
51// ===================================================== =====
52//
53// :param type: the type of the payload
54// :param payload: the payload of the notification
55// :param scope: global or local notification
56//
57message Frame {
58  enum Scope {
59    GLOBAL = 1;
60    LOCAL = 2;
61  };
62  enum Type {
63    WARNING = 1;
64    SESSION_VARIABLE_CHANGED = 2;
65    SESSION_STATE_CHANGED = 3;
66    GROUP_REPLICATION_STATE_CHANGED = 4;
67    SERVER_HELLO = 5;
68  };
69  required uint32 type = 1;
70  optional Scope  scope = 2 [ default = GLOBAL ];
71  optional bytes payload = 3;
72
73  option (server_message_id) = NOTICE; // comment_out_if PROTOBUF_LITE
74}
75
76// Server-side warnings and notes
77//
78// ``.scope`` == ``local``
79//   ``.level``, ``.code`` and ``.msg`` map the content of
80//
81//   .. code-block:: sql
82//
83//     SHOW WARNINGS
84//
85// ``.scope`` == ``global``
86//   (undefined) will be used for global, unstructured messages like:
87//
88//   * server is shutting down
89//   * a node disconnected from group
90//   * schema or table dropped
91//
92// ========================================== =======================
93// :protobuf:msg:`Mysqlx.Notice::Frame` field value
94// ========================================== =======================
95// ``.type``                                  1
96// ``.scope``                                 ``local`` or ``global``
97// ========================================== =======================
98//
99// :param level: warning level: Note or Warning
100// :param code: warning code
101// :param msg: warning message
102message Warning {
103  enum Level {
104    NOTE = 1;
105    WARNING = 2;
106    ERROR = 3;
107  };
108  optional Level  level = 1 [ default = WARNING ];
109  required uint32 code = 2;
110  required string msg = 3;
111}
112
113// Notify clients about changes to the current session variables
114//
115// Every change to a variable that is accessible through:
116//
117// .. code-block:: sql
118//
119//   SHOW SESSION VARIABLES
120//
121// ========================================== =========
122// :protobuf:msg:`Mysqlx.Notice::Frame` field value
123// ========================================== =========
124// ``.type``                                  2
125// ``.scope``                                 ``local``
126// ========================================== =========
127//
128// :param namespace: namespace that param belongs to
129// :param param: name of the variable
130// :param value: the changed value of param
131message SessionVariableChanged {
132  required string param = 1;
133  optional Mysqlx.Datatypes.Scalar value = 2;
134}
135
136
137// Notify clients about changes to the internal session state
138//
139// ========================================== =========
140// :protobuf:msg:`Mysqlx.Notice::Frame` field value
141// ========================================== =========
142// ``.type``                                  3
143// ``.scope``                                 ``local``
144// ========================================== =========
145//
146// :param param: parameter key
147// :param value: updated value
148message SessionStateChanged {
149  enum Parameter {
150     CURRENT_SCHEMA = 1;
151     ACCOUNT_EXPIRED = 2;
152     GENERATED_INSERT_ID = 3;
153     ROWS_AFFECTED = 4;
154     ROWS_FOUND = 5;
155     ROWS_MATCHED = 6;
156     TRX_COMMITTED = 7;
157     TRX_ROLLEDBACK = 9;
158     PRODUCED_MESSAGE = 10;
159     CLIENT_ID_ASSIGNED = 11;
160     GENERATED_DOCUMENT_IDS = 12;
161     // .. more to be added
162  }
163  required Parameter param = 1;
164  repeated Mysqlx.Datatypes.Scalar value = 2;
165}
166
167// Notify clients about group replication state changes
168//
169// ========================================== ==========
170// :protobuf:msg:`Mysqlx.Notice::Frame` field value
171// ========================================== ==========
172// ``.type``                                  4
173// ``.scope``                                 ``global``
174// ========================================== ==========
175//
176// :param type: type of group replication event
177// :param view_id: view identifier
178message GroupReplicationStateChanged {
179  enum Type {
180    MEMBERSHIP_QUORUM_LOSS = 1;
181    MEMBERSHIP_VIEW_CHANGE = 2;
182    MEMBER_ROLE_CHANGE = 3;
183    MEMBER_STATE_CHANGE = 4;
184  }
185  required uint32 type = 1;
186
187  optional string view_id = 2;
188}
189
190// Notify clients about connection to X Protocol server
191//
192// ========================================== ==========
193// :protobuf:msg:`Mysqlx.Notice::Frame` field value
194// ========================================== ==========
195// ``.type``                                  5
196// ``.scope``                                 ``global``
197// ========================================== ==========
198//
199message ServerHello {
200}
201
202