Debian Codegraph @

docs/api_reference/C/repmgr_msg_dispatch.html

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6 <title>DB_ENV-&gt;repmgr_msg_dispatch()</title>
7 <link rel="stylesheet" href="apiReference.css" type="text/css" />
8 <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
9 <link rel="start" href="index.html" title="Berkeley DB C API Reference" />
10 <link rel="up" href="rep.html" title="Chapter 10.  Replication Methods" />
11 <link rel="prev" href="repmgrget_ack_policy.html" title="DB_ENV-&gt;repmgr_get_ack_policy()" />
12 <link rel="next" href="repmgrset_ack_policy.html" title="DB_ENV-&gt;repmgr_set_ack_policy()" />
13 </head>
14 <body>
15 <div xmlns="" class="navheader">
16 <div class="libver">
17 <p>Library Version 11.2.5.3</p>
18 </div>
19 <table width="100%" summary="Navigation header">
20 <tr>
21 <th colspan="3" align="center">DB_ENV-&gt;repmgr_msg_dispatch()</th>
22 </tr>
23 <tr>
24 <td width="20%" align="left"><a accesskey="p" href="repmgrget_ack_policy.html">Prev</a> </td>
25 <th width="60%" align="center">Chapter 10. 
26 Replication Methods
27 </th>
28 <td width="20%" align="right"> <a accesskey="n" href="repmgrset_ack_policy.html">Next</a></td>
29 </tr>
30 </table>
31 <hr />
32 </div>
33 <div class="sect1" lang="en" xml:lang="en">
34 <div class="titlepage">
35 <div>
36 <div>
37 <h2 class="title" style="clear: both"><a id="repmgr_msg_dispatch"></a>DB_ENV-&gt;repmgr_msg_dispatch()</h2>
38 </div>
39 </div>
40 </div>
41 <pre class="programlisting">#include &lt;db.h&gt;
42
43 int
44 DB_ENV-&gt;repmgr_msg_dispatch(DB_ENV *env,
45 void (*msg_dispatch_fcn) (DB_ENV *env, DB_CHANNEL *channel,
46 DBT *request, u_int32_t nrequest,
47 u_int32_t cb_flags),
48 u_int32_t flags); </pre>
49 <p>
50 Sets the message dispatch function. This function is responsible
51 for receiving messages sent from remote sites using either the
52 <a class="xref" href="dbchannel_send_msg.html" title="DB_CHANNEL-&gt;send_msg()">DB_CHANNEL-&gt;send_msg()</a>
53 or
54 <a class="xref" href="dbchannel_send_request.html" title="DB_CHANNEL-&gt;send_request()">DB_CHANNEL-&gt;send_request()</a>
55 methods. If the message received by this function was sent using the
56 <a class="xref" href="dbchannel_send_msg.html" title="DB_CHANNEL-&gt;send_msg()">DB_CHANNEL-&gt;send_msg()</a>
57 method then no response is required. If the message was sent using the
58 <a class="xref" href="dbchannel_send_request.html" title="DB_CHANNEL-&gt;send_request()">DB_CHANNEL-&gt;send_request()</a>
59 method, then this function must send a response using the
60 <a class="xref" href="dbchannel_send_msg.html" title="DB_CHANNEL-&gt;send_msg()">DB_CHANNEL-&gt;send_msg()</a>
61 method.
62 </p>
63 <p>
64 For best results, the
65 <code class="methodname">DB_ENV-&gt;repmgr_msg_dispatch()</code> method should
66 be called before the Replication Manager has been started.
67 </p>
68 <p>
69 The <code class="methodname">DB_ENV-&gt;repmgr_msg_dispatch()</code> <span>
70 <span>
71 method returns a non-zero error value on failure and 0 on success.
72 </span>
73
74 </span>
75 </p>
76 <div class="sect2" lang="en" xml:lang="en">
77 <div class="titlepage">
78 <div>
79 <div>
80 <h3 class="title"><a id="idp54386960"></a>Parameters</h3>
81 </div>
82 </div>
83 </div>
84 <div class="sect3" lang="en" xml:lang="en">
85 <div class="titlepage">
86 <div>
87 <div>
88 <h4 class="title"><a id="idp54386312"></a>msg_dispatch_fcn</h4>
89 </div>
90 </div>
91 </div>
92 <p>
93 This parameter is the application-specific function used
94 to handle messages sent over Replication Manager message
95 channels. It takes four parameters:
96 </p>
97 <div class="itemizedlist">
98 <ul type="disc">
99 <li>
100 <p>
101 <code class="literal">channel</code>
102 </p>
103 <p>
104 Provides the DB_CHANNEL to be used to send
105 a response back to the originator of the message.
106 If the message was sent by the remote site using
107 <a class="xref" href="dbchannel_send_request.html" title="DB_CHANNEL-&gt;send_request()">DB_CHANNEL-&gt;send_request()</a>
108 then this function should send a response back to
109 the originator using the channel provided on this
110 parameter. The message should be sent by calling
111 <a class="xref" href="dbchannel_send_msg.html" title="DB_CHANNEL-&gt;send_msg()">DB_CHANNEL-&gt;send_msg()</a>
112 exactly once.
113 </p>
114 <p>
115 This channel is valid only during the current
116 invocation of the dispatch function; it is
117 destroyed when the dispatch function returns. The
118 application may not save a copy of the pointer and
119 use it later elsewhere. Methods that do not make
120 sense in the context of a message dispatch
121 function (such as
122 <a class="xref" href="dbchannel_send_request.html" title="DB_CHANNEL-&gt;send_request()">DB_CHANNEL-&gt;send_request()</a>
123 and
124 <a class="xref" href="dbchannel_close.html" title="DB_CHANNEL-&gt;close()">DB_CHANNEL-&gt;close()</a>)
125 will be rejected with <code class="literal">EINVAL</code>.
126 </p>
127 </li>
128 <li>
129 <p>
130 <code class="literal">request</code>
131 </p>
132 <p>
133 Array of DBTs containing the message
134 received from the remote site.
135 </p>
136 </li>
137 <li>
138 <p>
139 <code class="literal">nrequest</code>
140 </p>
141 <p>
142 Specifies the number of elements in the
143 <code class="literal">request</code> array.
144 </p>
145 </li>
146 <li>
147 <p>
148 <code class="literal">cb_flags</code>
149 </p>
150 <p>
151 This flag is
152 <code class="literal">DB_REPMGR_NEED_RESPONSE</code> if the
153 message requires a response. Otherwise, it is
154 <code class="literal">0</code>.
155 </p>
156 </li>
157 </ul>
158 </div>
159 <p>
160 This function does not return a value. If the function
161 encounters an error, you can reflect the error back to
162 the originator of the message by formatting an error
163 message of your own design into the response.
164 </p>
165 </div>
166 <div class="sect3" lang="en" xml:lang="en">
167 <div class="titlepage">
168 <div>
169 <div>
170 <h4 class="title"><a id="idp54398704"></a>flags</h4>
171 </div>
172 </div>
173 </div>
174 <p>
175 This parameter is currently unused, and must be
176 set to 0.
177 </p>
178 </div>
179 </div>
180 <div class="sect2" lang="en" xml:lang="en">
181 <div class="titlepage">
182 <div>
183 <div>
184 <h3 class="title"><a id="idp54393096"></a>Errors</h3>
185 </div>
186 </div>
187 </div>
188 <p>
189 The <code class="methodname">DB_ENV-&gt;repmgr_msg_dispatch()</code>
190 <span>
191 <span>
192 method may fail and return one of the following non-zero errors:
193 </span>
194
195 </span>
196 </p>
197 <div class="sect3" lang="en" xml:lang="en">
198 <div class="titlepage">
199 <div>
200 <div>
201 <h4 class="title"><a id="idp54403584"></a>EINVAL</h4>
202 </div>
203 </div>
204 </div>
205 <p>
206 If this method is called from a Base API application,
207 or if an invalid flag value or parameter was specified.
208 </p>
209 </div>
210 </div>
211 <div class="sect2" lang="en" xml:lang="en">
212 <div class="titlepage">
213 <div>
214 <div>
215 <h3 class="title"><a id="idp54402504"></a>Class</h3>
216 </div>
217 </div>
218 </div>
219 <p>
220 <a class="link" href="env.html" title="Chapter 5.  The DB_ENV Handle">DB_ENV</a>
221 </p>
222 </div>
223 <div class="sect2" lang="en" xml:lang="en">
224 <div class="titlepage">
225 <div>
226 <div>
227 <h3 class="title"><a id="idp54399352"></a>See Also</h3>
228 </div>
229 </div>
230 </div>
231 <p>
232 <a class="xref" href="rep.html#replist" title="Replication and Related Methods">Replication and Related Methods</a>
233 </p>
234 </div>
235 </div>
236 <div class="navfooter">
237 <hr />
238 <table width="100%" summary="Navigation footer">
239 <tr>
240 <td width="40%" align="left"><a accesskey="p" href="repmgrget_ack_policy.html">Prev</a> </td>
241 <td width="20%" align="center">
242 <a accesskey="u" href="rep.html">Up</a>
243 </td>
244 <td width="40%" align="right"> <a accesskey="n" href="repmgrset_ack_policy.html">Next</a></td>
245 </tr>
246 <tr>
247 <td width="40%" align="left" valign="top">DB_ENV-&gt;repmgr_get_ack_policy() </td>
248 <td width="20%" align="center">
249 <a accesskey="h" href="index.html">Home</a>
250 </td>
251 <td width="40%" align="right" valign="top"> DB_ENV-&gt;repmgr_set_ack_policy()</td>
252 </tr>
253 </table>
254 </div>
255 </body>
256 </html>