/usr/share/doc/monotone/html/Event-Notifications-and-Triggers.html is in monotone-doc 1.1-9.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>monotone documentation: Event Notifications and Triggers</title>
<meta name="description" content="monotone documentation: Event Notifications and Triggers">
<meta name="keywords" content="monotone documentation: Event Notifications and Triggers">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="General-Index.html#General-Index" rel="index" title="General Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Hooks.html#Hooks" rel="up" title="Hooks">
<link href="User-Defaults.html#User-Defaults" rel="next" title="User Defaults">
<link href="Common-Data-Types.html#Common-Data-Types" rel="prev" title="Common Data Types">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
<link rel="stylesheet" type="text/css" href="texinfo.css">
</head>
<body lang="en">
<a name="Event-Notifications-and-Triggers"></a>
<div class="header">
<p>
Next: <a href="User-Defaults.html#User-Defaults" accesskey="n" rel="next">User Defaults</a>, Previous: <a href="Common-Data-Types.html#Common-Data-Types" accesskey="p" rel="prev">Common Data Types</a>, Up: <a href="Hooks.html#Hooks" accesskey="u" rel="up">Hooks</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="General-Index.html#General-Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Event-Notifications-and-Triggers-1"></a>
<h4 class="subsection">6.1.2 Event Notifications and Triggers</h4>
<p>There are a number of hooks that are called when noteworthy events
occur, such as commits or new revisions arriving over the network. These
hooks can be used to feed the events into external notification systems,
such as generating email.
</p>
<p>By default, these hooks are undefined, so no special external actions
are taken.
</p>
<p>Hooks are presented not in alphabetic order; they are grouped by
function, and then by the order they are typically called by monotone.
</p>
<dl compact="compact">
<dt><code>note_commit (<var>new_id</var>, <var>revision</var>, <var>certs</var>)</code>
<a name="index-note_005fcommit-_0028new_005fid_002c-revision_002c-certs_0029"></a>
</dt>
<dd>
<p>Called by monotone after the revsion <var>new_id</var> is
committed. <var>revision</var> is the text of the revision, what would be
given by <code>mtn automate get_revision <var>new_id</var></code>. <var>certs</var>
is a Lua table containing the set of certificate names and values
committed along with this version.
</p>
<p>There is no default definition for this hook.
</p>
<p>Note that since the <var>certs</var> table does not contain cryptographic
or trust information, and only contains one entry per cert name, it is
an incomplete source of information about the committed version. This
hook is only intended as an aid for integrating monotone with informal
commit-notification systems such as mailing lists or news services. It
should not perform any security-critical operations.
</p>
</dd>
<dt><code>note_netsync_start (<var>session_id</var>, <var>my_role</var>, <var>sync_type</var>, <var>remote_host</var>, <var>remote_key</var>, <var>includes</var>, <var>excludes</var>)</code>
<a name="index-note_005fnetsync_005fstart-_0028session_005fid_002c-my_005frole_002c-sync_005ftype_002c-remote_005fhost_002c-remote_005fkey_002c-includes_002c-excludes_0029"></a>
</dt>
<dd>
<p>Called by monotone just after a netsync session is started, before any
of the other netsync notification hooks are called.
</p>
<p>The arguments are:
</p>
<dl compact="compact">
<dt><var>session_id</var></dt>
<dd><p>Identifies the current netsync session in case several are happening
at the same time (only possible on a server).
</p>
</dd>
<dt><var>my_role</var></dt>
<dd>
<p>One of "client" or "server".
</p>
</dd>
<dt><var>sync_type</var></dt>
<dd>
<p>One of "sync", "push", or "pull".
</p>
</dd>
<dt><var>remote_host</var></dt>
<dd>
<p>The network address of the remote host. At the client, this will be the name
it was told to connect to; at the server, this will use the numerical IP address
the connection was received from.
</p>
</dd>
<dt><var>remote_key</var></dt>
<dd>
<p>The identity of the key being used by the other end of the connection. The fields may
be empty at the server if the key used by the client is not present at the server.
</p>
</dd>
<dt><var>includes</var></dt>
<dt><var>excludes</var></dt>
<dd>
<p>The include and exclude patterns used by the client.
</p>
</dd>
</dl>
</dd>
<dt><code>note_netsync_revision_received (<var>new_id</var>, <var>revision</var>, <var>certs</var>, <var>session_id</var>)</code>
<a name="index-note_005fnetsync_005frevision_005freceived-_0028new_005fid_002c-revision_002c-certs_002c-session_005fid_0029"></a>
</dt>
<dt><code>note_netsync_revision_sent (<var>rev_id</var>, <var>revision</var>, <var>certs</var>, <var>session_id</var>)</code>
<a name="index-note_005fnetsync_005frevision_005fsent-_0028rev_005fid_002c-revision_002c-certs_002c-session_005fid_0029"></a>
</dt>
<dd>
<p>Called after the revision <var>new_id</var> is received or sent through
netsync.
</p>
<p>There are no default definitions for these hooks.
</p>
<p>Arguments:
</p>
<dl compact="compact">
<dt><var>new_id</var></dt>
<dd><p>The revision id.
</p>
</dd>
<dt><var>revision</var></dt>
<dd><p>The text of the revision; what would be given
by <code>mtn automate get_revision <var>new_id</var></code>.
</p>
</dd>
<dt><var>certs</var></dt>
<dd><p>A Lua table containing one subtable for each cert attached to the revision
<var>new_id</var>. These subtables have fields named "key", "name", and
"value", containing the identity of the signing key for the cert, the name of the cert,
and the value of the cert.
</p>
</dd>
<dt><var>session_id</var></dt>
<dd><p>Identifies the current netsync session.
</p>
</dd>
</dl>
</dd>
<dt><code>note_netsync_cert_received (<var>rev_id</var>, <var>key_identity</var>, <var>name</var>, <var>value</var>, <var>session_id</var>)</code>
<a name="index-note_005fnetsync_005fcert_005freceived-_0028rev_005fid_002c-key_005fidentity_002c-name_002c-value_002c-session_005fid_0029"></a>
</dt>
<dt><code>note_netsync_cert_sent (<var>rev_id</var>, <var>key_identity</var>, <var>name</var>, <var>value</var>, <var>session_id</var>)</code>
<a name="index-note_005fnetsync_005fcert_005fsent-_0028rev_005fid_002c-key_005fidentity_002c-name_002c-value_002c-session_005fid_0029"></a>
</dt>
<dd>
<p>Called by monotone after a cert is received (or sent) through netsync,
if the revision that the cert is attached to was not also received (or
sent) in the same netsync operation.
</p>
<p>There is no default definition for this hook.
</p>
<p>Arguments:
</p>
<dl compact="compact">
<dt><var>rev_id</var></dt>
<dd><p>The revision id that the cert is attached to.
</p>
</dd>
<dt><var>key_identity</var></dt>
<dd><p>The key that the cert is signed with; see <var><a href="Common-Data-Types.html#key_005fidentity">key_identity</a></var>.
</p>
</dd>
<dt><var>name</var></dt>
<dd><p>The name of the cert.
</p>
</dd>
<dt><var>value</var></dt>
<dd><p>The cert value.
</p>
</dd>
<dt><var>session_id</var></dt>
<dd><p>Identifies the netsync session.
</p></dd>
</dl>
</dd>
<dt><code>note_netsync_pubkey_received (<var>key_identity</var>, <var>session_id</var>)</code>
<a name="index-note_005fnetsync_005fpubkey_005freceived-_0028key_005fidentity_002c-session_005fid_0029"></a>
</dt>
<dt><code>note_netsync_pubkey_sent (<var>key_identity</var>, <var>session_id</var>)</code>
<a name="index-note_005fnetsync_005fpubkey_005fsent-_0028key_005fidentity_002c-session_005fid_0029"></a>
</dt>
<dd>
<p>Called by monotone after a pubkey is received or sent through netsync.
</p>
<p>There is no default definition for this hook.
</p>
<p>Arguments:
</p>
<dl compact="compact">
<dt><var>key_identity</var></dt>
<dd><p>The identity of the key received; see <var><a href="Common-Data-Types.html#key_005fidentity">key_identity</a></var>.
</p>
</dd>
<dt><var>session_id</var></dt>
<dd><p>Identifies the current netsync session.
</p>
</dd>
</dl>
</dd>
<dt><code>note_netsync_end (<var>session_id</var>, <var>status</var>, <var>bytes_in</var>, <var>bytes_out</var>, <var>certs_in</var>, <var>certs_out</var>, <var>revs_in</var>, <var>revs_out</var>, <var>keys_in</var>, <var>keys_out</var>)</code>
<a name="index-note_005fnetsync_005fend-_0028session_005fid_002c-status_002c-bytes_005fin_002c-bytes_005fout_002c-certs_005fin_002c-certs_005fout_002c-revs_005fin_002c-revs_005fout_002c-keys_005fin_002c-keys_005fout_0029"></a>
</dt>
<dd>
<p>Called by monotone after a netsync session ends. This hook would
usually be used for post-netsync purposes, like collecting all the
data from all other netsync notification hooks, make some nice output
from them and finally send the result somewhere. It could also be
used to prepare parallel databases with all the data to be displayed
through something like viewmtn.
</p>
<p>Arguments:
</p>
<dl compact="compact">
<dt><var>session_id</var></dt>
<dd><p>Identifies the current netsync session.
</p>
</dd>
<dt><var>status</var></dt>
<dd><p>A three digit integer that tells whether there was an error,
and if so what kind of error it was:
</p>
<dl compact="compact">
<dt><strong>200</strong></dt>
<dd><p>No error, connection successful.
</p>
</dd>
<dt><strong>211</strong></dt>
<dd><p>The connection was interrupted after some data may have been transferred.
</p>
</dd>
<dt><strong>212</strong></dt>
<dd><p>The connection was interrupted before any data could be transferred.
</p>
</dd>
<dt><strong>412</strong></dt>
<dd><p>The request is not permitted.
</p>
</dd>
<dt><strong>422</strong></dt>
<dd><p>The client tried to use a key that the server doesn’t know about.
</p>
</dd>
<dt><strong>432</strong></dt>
<dd><p>The client and server have different epochs for a branch.
</p>
</dd>
<dt><strong>512</strong></dt>
<dd><p>Protocol error (source/sink confusion).
</p>
</dd>
<dt><strong>521</strong></dt>
<dd><p>Protocol error (packet received at a time when it doesn’t make sense).
</p>
</dd>
<dt><strong>532</strong></dt>
<dd><p>The client did not identify itself correctly. (Possible replay attack?)
</p>
</dd>
</dl>
<p>In general, 2xx means there was no error, 4xx means there was a permissions
error, and 5xx means there was a protocol error. xx1 means some data may
have been transferred, xx2 means no data was transferred, and xx0 means all
data was transferred.
</p>
</dd>
<dt><var>bytes_in</var></dt>
<dt><var>bytes_out</var></dt>
<dd><p>The number of bytes received/sent during the session.
</p>
</dd>
<dt><var>certs_in</var></dt>
<dt><var>certs_out</var></dt>
<dd><p>The number of certs received/sent during the session.
</p>
</dd>
<dt><var>revs_in</var></dt>
<dt><var>revs_out</var></dt>
<dd><p>The number of revisions received/sent during the session.
</p>
</dd>
<dt><var>keys_in</var></dt>
<dt><var>keys_out</var></dt>
<dd><p>The number of keys received/sent during the session.
</p>
</dd>
</dl>
</dd>
<dt><code>note_mtn_startup (...)</code>
<a name="index-note_005fmtn_005fstartup-_0028_002e_002e_002e_0029"></a>
</dt>
<dd>
<p>Called by monotone when it is first started, after all command
completion and option processing, before the command starts executing.
</p>
<p>There is no default definition of this hook.
</p>
<p>One use of this hook is to monitor usage of monotone, for user
interface testing.
</p>
<p>The arguments to the hook are the command line arguments to monotone,
without the initial <code>mtn</code> command. They can be accessed
through the lua <var>arg</var> variable as in this example:
</p>
<div class="smallexample">
<pre class="smallexample">function note_mtn_startup(...)
print("Beginning note_mtn_startup")
for i = 1,arg.n do
print(arg[i])
end
print("Ending note_mtn_startup")
end
</pre></div>
</dd>
</dl>
<hr>
<div class="header">
<p>
Next: <a href="User-Defaults.html#User-Defaults" accesskey="n" rel="next">User Defaults</a>, Previous: <a href="Common-Data-Types.html#Common-Data-Types" accesskey="p" rel="prev">Common Data Types</a>, Up: <a href="Hooks.html#Hooks" accesskey="u" rel="up">Hooks</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="General-Index.html#General-Index" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>
|