diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2014-11-01 16:28:19 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2014-11-01 16:34:10 +0200 |
commit | fffbbfb089847644e2b0281faba2fa892df4f8b9 (patch) | |
tree | 83899ca03d92bdb4100c413904c83385ca0c7d6c /src/vmod.vcc | |
parent | c16de06862f9b2106dcb7810fc20856689ef2aa6 (diff) | |
download | vmod-binlog-fffbbfb089847644e2b0281faba2fa892df4f8b9.tar.gz vmod-binlog-fffbbfb089847644e2b0281faba2fa892df4f8b9.tar.bz2 |
Support for VCL 4.0
* configure.ac: Version 1.0.91
Detect varnish version and set variables and conditionals accordingly.
* NEWS: Update.
* src/.gitignore: Update.
* src/Makefile.am: Always build vcc_if.c and vcc_if.h. Don't
distribute them.
* src/binlog.c: Use VCL data type. Define them for VCL 3.0.
(vmod_init): Fix premature memory deallocation.
* src/vmod.vcc: Rewrite in VCL 4.0 syntax.
* tests/atlocal.in (ret_vcl_recv): New variable.
* tests/test01.at (vcl_recv): Return $ret_vcl_recv.
* tests/test02.at: Likewise.
Diffstat (limited to 'src/vmod.vcc')
-rw-r--r-- | src/vmod.vcc | 111 |
1 files changed, 103 insertions, 8 deletions
diff --git a/src/vmod.vcc b/src/vmod.vcc index 45da354..b090797 100644 --- a/src/vmod.vcc +++ b/src/vmod.vcc | |||
@@ -1,8 +1,103 @@ | |||
1 | Module binlog | 1 | # This file is part of vmod-binlog |
2 | Init module_init | 2 | # Copyright (C) 2013-2014 Sergey Poznyakoff |
3 | Function VOID init(PRIV_VCL, STRING, STRING, STRING) | 3 | # |
4 | Function VOID start(PRIV_VCL) | 4 | # Vmod-binlog is free software; you can redistribute it and/or modify |
5 | Function VOID commit(PRIV_VCL) | 5 | # it under the terms of the GNU General Public License as published by |
6 | Function VOID pack(PRIV_VCL, STRING) | 6 | # the Free Software Foundation; either version 3, or (at your option) |
7 | Function VOID sync(PRIV_VCL) | 7 | # any later version. |
8 | Function VOID close(PRIV_VCL) | 8 | # |
9 | # Vmod-binlog is distributed in the hope that it will be useful, | ||
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | # GNU General Public License for more details. | ||
13 | # | ||
14 | # You should have received a copy of the GNU General Public License | ||
15 | # along with vmod-binlog. If not, see <http://www.gnu.org/licenses/>. | ||
16 | |||
17 | $Module binlog 3 Binary Log File Support | ||
18 | |||
19 | COLOPHON | ||
20 | ======== | ||
21 | This document provides a short description of the **vmod-binlog** module. | ||
22 | For a detailed documentation, please see the vmod-binlog(3) manual page. | ||
23 | |||
24 | You will find documentation sources in subdirectory **doc** of the | ||
25 | **vmod-binlog** source tree. | ||
26 | |||
27 | DESCRIPTION | ||
28 | =========== | ||
29 | This module adds binary log files support to Varnish Cache. | ||
30 | |||
31 | Binary log file consists of an arbitrary number of equally sized | ||
32 | records. Each record contains a UNIX timestamp in binary form and | ||
33 | user-defined data. The file begins with a header containing auxiliary | ||
34 | information. | ||
35 | |||
36 | Binary log files are rotated at preconfigured time intervals. In order | ||
37 | to speed up searches, their names follow the strftime(3) pattern: | ||
38 | |||
39 | %Y%m%dT%H%M%S.log | ||
40 | |||
41 | Binary logs can be viewed using the binlogcat(1) and binlogsel(1) utilities. | ||
42 | |||
43 | $Init module_init | ||
44 | $Function VOID init(PRIV_VCL, STRING, STRING, STRING) | ||
45 | |||
46 | Description | ||
47 | Initializes binary log engine. | ||
48 | Example | ||
49 | :: | ||
50 | |||
51 | binlog.init("/var/lib/varnish/binlog", "LZ[64]L", | ||
52 | "size=1G;index=1;umask=027;roundts=1;debug=2"); | ||
53 | |||
54 | |||
55 | $Function VOID start(PRIV_VCL) | ||
56 | |||
57 | Description | ||
58 | Initialize new binary record. It should be followed by one or | ||
59 | more calls to **binlog.pack** and a final call to **binlog.commit**. | ||
60 | Example | ||
61 | :: | ||
62 | binlog.start(); | ||
63 | |||
64 | $Function VOID pack(PRIV_VCL, STRING) | ||
65 | |||
66 | Description | ||
67 | Pack next data item into the binary log record. The item is | ||
68 | converted according to the second argument of **binlog.init**. | ||
69 | The conversion specifier is selected using the ordinal number | ||
70 | of this **pack** call after the latest **binlog.start**. | ||
71 | |||
72 | $Function VOID commit(PRIV_VCL) | ||
73 | |||
74 | Description | ||
75 | Finalize the binary log record and commit it. Any uninitialized | ||
76 | fields will be set to 0. | ||
77 | |||
78 | Example | ||
79 | :: | ||
80 | |||
81 | binlog.start(); | ||
82 | binlog.pack(http.X-Id); | ||
83 | binlog.pack(http.req.url); | ||
84 | binlog.pack(http.X-Node); | ||
85 | binlog.commit(); | ||
86 | |||
87 | $Function VOID sync(PRIV_VCL) | ||
88 | |||
89 | Description | ||
90 | Synchronize the binary log with the disk file. | ||
91 | |||
92 | $Function VOID close(PRIV_VCL) | ||
93 | |||
94 | Description | ||
95 | Close the log. This is supposed to be called from **vcl_fini**. | ||
96 | |||
97 | SEE ALSO | ||
98 | ======== | ||
99 | |||
100 | * binlogcat(1) | ||
101 | * binlogsel(1) | ||
102 | * vcl(7) | ||
103 | * varnishd(1) | ||