diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-04-21 16:23:35 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-04-21 16:47:22 +0300 |
commit | b5f2337ad45d26941bf533741d8bff1238d59b5d (patch) | |
tree | 878a65c333272ceb198ec0d8e871e431f8015f7a /src/vmod_dbrw.vcc | |
parent | 5ee1409fc878cd65dd224ec5f709507e37e9ed5d (diff) | |
download | vmod-dbrw-b5f2337ad45d26941bf533741d8bff1238d59b5d.tar.gz vmod-dbrw-b5f2337ad45d26941bf533741d8bff1238d59b5d.tar.bz2 |
Rewrite SQL configuration support.
Multiple configurations can be provided, by calling dbrw.config from
branches of a conditional VCL statement. The only requirement is that
exactly one dbrw.config is executed within a single HTTP session. This
allows the user to select rewrite data from various databases depending
on some conditions.
Open SQL connections are stored in a pool and reused as needed. So far
no limit on the number of connections is imposed. This is a TODO.
Connections remain open during the lifetime of the module (i.e. for as
long as varnish is not restarted).
* src/dbrw.h (dbrw_config): New members: param_str, magic and list.
(dbrw_connection): New members: magic, busy, list.
* src/vmod_dbrw.c (dbrw_connection_get)
(dbrw_connection_release): New functions.
(dbrw_event): Install atexit function.
(vmod_config): Keep a pool of configurations.
(dbrw_sethdr) [VARNISHVERSION]: Remove leftover code.
(vmod_rewrite): Rewrite.
* src/vmod_dbrw.vcc (config, rewrite): Mark as PRIV_TASK.
* doc/vmod-dbrw.3: Update docs.
* doc/vmod-dbrw.texi: Update docs.
* configure.ac: Raise version number
Diffstat (limited to 'src/vmod_dbrw.vcc')
-rw-r--r-- | src/vmod_dbrw.vcc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/vmod_dbrw.vcc b/src/vmod_dbrw.vcc index 827ff4f..9a15af1 100644 --- a/src/vmod_dbrw.vcc +++ b/src/vmod_dbrw.vcc @@ -1,5 +1,5 @@ # This file is part of vmod-dbrw -# Copyright (C) 2013-2014 Sergey Poznyakoff +# Copyright (C) 2013-2016 Sergey Poznyakoff # # Vmod-dbrw is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -39,12 +39,12 @@ httpd server, and that they are stored in an SQL database, which makes them easily manageable. $Event dbrw_event -$Function VOID config(PRIV_VCL, STRING, STRING, STRING) +$Function VOID config(PRIV_TASK, STRING, STRING, STRING) Description Configures the module and provides it with the data necessary to connect and use the database. It is normally called - from the **vcl_init** subroutine. + from the **vcl_recv** subroutine. Example :: @@ -57,7 +57,7 @@ Example AND url='$url'"}); -$Function STRING rewrite(PRIV_VCL, STRING) +$Function STRING rewrite(PRIV_TASK, STRING) Description Rewrites its argument using the database configured in the previous |