You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by pq...@apache.org on 2008/12/27 08:05:18 UTC
svn commit: r729611 - /httpd/mod_mbox/trunk/module-2.0/mod_mbox_sitemap.c
Author: pquerna
Date: Fri Dec 26 23:05:18 2008
New Revision: 729611
URL: http://svn.apache.org/viewvc?rev=729611&view=rev
Log:
Add a basic way to staticly hash partitions into the sitemaps.
Modified:
httpd/mod_mbox/trunk/module-2.0/mod_mbox_sitemap.c
Modified: httpd/mod_mbox/trunk/module-2.0/mod_mbox_sitemap.c
URL: http://svn.apache.org/viewvc/httpd/mod_mbox/trunk/module-2.0/mod_mbox_sitemap.c?rev=729611&r1=729610&r2=729611&view=diff
==============================================================================
--- httpd/mod_mbox/trunk/module-2.0/mod_mbox_sitemap.c (original)
+++ httpd/mod_mbox/trunk/module-2.0/mod_mbox_sitemap.c Fri Dec 26 23:05:18 2008
@@ -24,7 +24,9 @@
#include "mod_mbox.h"
static void mbox2sitemap(request_rec *r, const char *mboxfile,
- mbox_cache_info *mli)
+ mbox_cache_info *mli,
+ int partition,
+ int partmax)
{
char *filename;
char *origfilename;
@@ -46,8 +48,30 @@
char dstr[100];
apr_size_t dlen;
apr_time_exp_t extime;
+ apr_ssize_t hlen;
+ unsigned int hrv;
m = (Message *) head->value;
+
+ if (!m || !m->msgID) {
+ head = head->next;
+ apr_pool_clear(tpool);
+ continue;
+ }
+
+ hlen = APR_HASH_KEY_STRING;
+
+ hrv = apr_hashfunc_default(m->msgID, &hlen);
+
+ if (partmax) {
+ int v = hrv % partmax;
+ if (v != partition) {
+ head = head->next;
+ apr_pool_clear(tpool);
+ continue;
+ }
+ }
+
ap_rputs("<url>\n", r);
ap_rprintf(r, "<loc>%s%s/%s</loc>\n",
@@ -70,18 +94,37 @@
mbox_file_t *fi;
apr_array_header_t *files;
int i;
+ int partition = 0;
+ int partmax = 0;
+ const char *p;
files = mbox_fetch_boxes_list(r, mli, r->filename);
if (!files) {
return;
}
+ if (r->args) {
+ p = strstr(r->args, "part=");
+ if (p) {
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "mbox: part=%s", p+5);
+ partition = atoi(p + 5);
+ }
+
+ p = strstr(r->args, "pmax=");
+ if (p) {
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "mbox: pmax=%s", p+5);
+ partmax = atoi(p + 5);
+ }
+ }
+
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "mbox: partition=%d pmax=%d args=%s", partition, partmax, r->args);
+
fi = (mbox_file_t *) files->elts;
for (i = 0; i < files->nelts; i++) {
if (!fi[i].count) {
continue;
}
- mbox2sitemap(r, fi[i].filename, mli);
+ mbox2sitemap(r, fi[i].filename, mli, partition, partmax);
}
}