Module: sip-router
Branch: janakj/flatstore
Commit: c4bddb54e21e2a78adf2910951e03ab359f71aa0
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c4bddb5…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Mon Jun 23 17:29:11 2008 +0000
- missing READMEs added
---
modules/db_flatstore/README | 95 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 95 insertions(+), 0 deletions(-)
diff --git a/modules/db_flatstore/README b/modules/db_flatstore/README
new file mode 100644
index 0000000..715c2c3
--- /dev/null
+++ b/modules/db_flatstore/README
@@ -0,0 +1,95 @@
+1. Flatstore Module
+
+Jan Janak
+
+ FhG FOKUS
+ <jan(a)iptel.org>
+
+ Copyright � 2004, 2005 FhG FOKUS
+ Revision History
+ Revision $Revision$ $Date$
+ __________________________________________________________________
+
+ 1.1. Overview
+
+ 1.1.1. Rotating Log Files
+
+ 1.2. Parameters
+
+ 1.2.1. flush (integer)
+
+1.1. Overview
+
+ Flatstore is one of so-called SER database modules. It does not export
+ any functions executable from the configuration scripts, but it exports
+ a subset of functions from the database API and thus other module can
+ use it instead of, for example, mysql module.
+
+ The module does not export all functions of the database API, it
+ supports only one function, insert. The module is limited but very
+ fast. It is especially suitable for storing accounting information on
+ sites with extremely high traffic. If MySQL is too slow or if you get a
+ huge amount of accounting data then you can consider using this module.
+ Note that the acc module is the only module that was tested with
+ flastore.
+
+ The format of the files produced by this module is plain text. Each
+ line consists of several fields, fields are separated by | character.
+ New information is always appended at the end of the file, searching,
+ deleting and updating of existing data is not supported by the module.
+
+ The acc module can be configured to use flatstore module as database
+ backend using the db_url_parameter:
+modparam("acc", "db_url", "flatstore:/var/log/acc")
+
+ This configuration options tells acc module that it should use the
+ flatstore module and the flatstore module should create all files in
+ /var/log/acc directory. The directory must exist and SER processes must
+ have permissions to create files in that directory.
+
+ Name of files in that directory will follow the following pattern:
+<table_name>_<process_name>.log
+
+ For example, entries writen by SER process 8 into acc table would be
+ written in file acc_8.log. For each table there will be several files,
+ one file for every SER process that wrote some data into that table.
+ The main reason why there are several files for each table is that it
+ is much faster to have one file per process, because it does not
+ require any locking and thus SER processes will not block each other.
+ To get the complete data for a table you can simply concatenate the
+ contents of files with the same table name but different process id.
+
+1.1.1. Rotating Log Files
+
+ There is a new SER FIFO interface command called flat_rotate. When SER
+ receives the command then it will close and reopen all files used by
+ flatstore module. The rotation itself has to be done by another
+ application (such as logrotate). Follow these steps to rotate files
+ generated by flatstore module:
+ * Rename the files that you want to rotate:
+cd /var/log/acc
+mv acc_1.log acc_1.log.20050605
+mv acc_2.log acc_2.log.20050605
+mv acc_4.log acc_3.log.20050605
+...
+ Note that at this point SER will still be writing all data into the
+ renamed files.
+ * Send SER the fifo command to close and reopen the renamed files:
+serctl fifo flat_rotate
+ This will force SER to close the renamed files and open new ones
+ with original names, such as acc_1.log. New files will be open at
+ the point when SER has some data to write. It is normal that the
+ files will be not created immediately if there is no traffic on the
+ proxy server.
+ * Move the renamed files somewhere else and process them.
+
+1.2. Parameters
+
+ Revision History
+ Revision $Revision$ $Date$
+
+1.2.1. flush (integer)
+
+ Enable or disable flushing after each write.
+
+ Default value is 1.
Module: sip-router
Branch: janakj/flatstore
Commit: 531b59fc6e9ff1749cd29789a786dd8d328cab66
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=531b59f…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Sun Feb 15 18:02:28 2009 +0100
Merge commit 'cvs/head' into flatstore
* commit 'cvs/head': (25 commits)
- a set of minimalistic config files for testing purposes
- adding missing end of doxygen group
- missing READMEs added
- headers moved within the doxygen section
- removed unneeded libs, thanks to Marcus Better <marcus(a)better.se>
- support for flatstore uris with relative pathnames (they are
- wrong array index fixed
- minor bug fixes
- new version of flatstore module for new db api in SER 2.1
- various warning fixes
- "strlen(flat_escape) > 1" fix
- DB_FLOAT support
- export param types adjusted to PARAM_STR/STRING & PARAM_INT
- added record delimiter and escape char params
- converted to the new management interface
- module interface exended with list of management functions
- documents are now valid (apart from xmlns:xi problem which would require
- DTDs and stylesheets will be downloaded from the network if they are
- improved documentation system
- fixed memory leak in flat_reopen_connection, reported by
...
---
Module: sip-router
Branch: janakj/flatstore
Commit: ecbabeb09b1a7dd1f8e7fe21d91217d27ba0cefe
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=ecbabeb…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Fri Oct 8 19:18:35 2004 +0000
Very simple module that implement very fast inserts. Each process opens
its own file (no locking, distinguished by the number of the ser child),
only inserts are supported, the data is stored in plaintext files.
The main purpose of the module is to implement very fast accounting without
relying on a backend database.
---
Module: sip-router
Branch: janakj/flatstore
Commit: 49e970a2fa65972f72f4962db3230fb71f9215af
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=49e970a…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Sat Oct 9 14:45:03 2004 +0000
- Missing files added
- Misleading comment changed
---
modules/db_flatstore/flat_fifo.c | 71 ++++++++++++++++++++++++++++++++++
modules/db_flatstore/flat_fifo.h | 40 +++++++++++++++++++
modules/db_flatstore/flatstore_mod.c | 2 +-
3 files changed, 112 insertions(+), 1 deletions(-)
diff --git a/modules/db_flatstore/flat_fifo.c b/modules/db_flatstore/flat_fifo.c
new file mode 100644
index 0000000..bd273a6
--- /dev/null
+++ b/modules/db_flatstore/flat_fifo.c
@@ -0,0 +1,71 @@
+/*
+ * $Id$
+ *
+ * Flatstore module FIFO interface
+ *
+ * Copyright (C) 2004 FhG Fokus
+ *
+ * This file is part of ser, a free SIP server.
+ *
+ * ser is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version
+ *
+ * For a license to use the ser software under conditions
+ * other than those described here, or to purchase support for this
+ * software, please contact iptel.org by e-mail at the following addresses:
+ * info(a)iptel.org
+ *
+ * ser is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "../../dprint.h"
+#include "../../fifo_server.h"
+#include "flatstore_mod.h"
+#include "flat_fifo.h"
+
+
+#define FLAT_ROTATE "flat_rotate"
+#define FLAT_ROTATE_LEN (sizeof(FLAT_ROTATE) - 1)
+
+
+static int flat_rotate_cmd(FILE* pipe, char* response_file);
+
+
+/*
+ * Initialize the FIFO interface
+ */
+int init_flat_fifo(void)
+{
+ if (register_fifo_cmd(flat_rotate_cmd, FLAT_ROTATE, 0) < 0) {
+ LOG(L_CRIT, "flatstore: Cannot register flat_rotate\n");
+ return -1;
+ }
+
+ return 0;
+}
+
+
+static int flat_rotate_cmd(FILE* pipe, char* response_file)
+{
+ FILE* reply_file;
+
+ reply_file = open_reply_pipe(response_file);
+ if (reply_file == 0) {
+ LOG(L_ERR, "flat_rotate_cmd: File not open\n");
+ return -1;
+ }
+
+ *flat_rotate = time(0);
+ fputs( "200 OK\n", reply_file);
+ fclose(reply_file);
+ return 1;
+}
diff --git a/modules/db_flatstore/flat_fifo.h b/modules/db_flatstore/flat_fifo.h
new file mode 100644
index 0000000..e746574
--- /dev/null
+++ b/modules/db_flatstore/flat_fifo.h
@@ -0,0 +1,40 @@
+/*
+ * $Id$
+ *
+ * Flatstore module FIFO interface
+ *
+ * Copyright (C) 2004 FhG Fokus
+ *
+ * This file is part of ser, a free SIP server.
+ *
+ * ser is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version
+ *
+ * For a license to use the ser software under conditions
+ * other than those described here, or to purchase support for this
+ * software, please contact iptel.org by e-mail at the following addresses:
+ * info(a)iptel.org
+ *
+ * ser is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef _FLAT_FIFO_H
+#define _FLAT_FIFO_H
+
+/*
+ * Initialize the FIFO interface
+ */
+int init_flat_fifo(void);
+
+
+#endif /* _FLAT_FIFO_H */
+
diff --git a/modules/db_flatstore/flatstore_mod.c b/modules/db_flatstore/flatstore_mod.c
index d281992..68813cb 100644
--- a/modules/db_flatstore/flatstore_mod.c
+++ b/modules/db_flatstore/flatstore_mod.c
@@ -115,7 +115,7 @@ static int mod_init(void)
/* Initialize fifo interface */
if (init_flat_fifo() < 0) {
- LOG(L_ERR, "usrloc/fifo initialization failed\n");
+ LOG(L_ERR, "flatstore: FIFO initialization failed\n");
return -1;
}