Does anyone have any objections to adding this capability??

-----Original Message-----
From: Greg Stein [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, October 28, 2001 10:28 PM
To: [EMAIL PROTECTED]
Cc: Kevin Mallory
Subject: Re: Request for Patch to 1.3.x


On Wed, Oct 03, 2001 at 11:19:34AM -0700, Kevin Mallory wrote:
>...

[ patch allows custom caching mechanisms ]

>...
> The patch simply adds a new callback (the 'filter callback') into the

>handling in buff.c's routine writev_it_all() and buff_write().
>  
> When not registered, there is no performance impact to users. This 
> filter callback makes it possible for SpiderCache to correctly 
> intercept the request as it is being processed, thus allowing our 
> product to perform dynamic page caching.

+1 on including this patch.

I see no bad effects, and it has definite utility.

Cheers,
-g


>...
> *** orig_buff.c       Tue Aug 21 17:45:34 2001
> --- spidercache_buff.c        Tue Aug 21 17:45:35 2001
> ***************
> *** 356,361 ****
> --- 356,365 ----
>   {
>       int rv;
>   
> +     if (fb->filter_callback != NULL) {
> +         fb->filter_callback(fb, buf, nbyte);
> +     }
> +    
>   #if defined(WIN32) || defined(NETWARE)
>       if (fb->flags & B_SOCKET) {
>       rv = sendwithtimeout(fb->fd, buf, nbyte, 0);
> ***************
> *** 438,443 ****
> --- 442,450 ----
>                      (size_t) SF_UNBOUND, 1, SF_WRITE);
>   #endif
>   
> +     fb->callback_data = NULL;
> +     fb->filter_callback = NULL;
> + 
>       return fb;
>   }
>   
> ***************
> *** 1077,1082 ****
> --- 1084,1095 ----
>   static int writev_it_all(BUFF *fb, struct iovec *vec, int nvec)
>   {
>       int i, rv;
> +     
> +     if (fb->filter_callback != NULL) {
> +         for (i = 0; i < nvec; i++) {
> +             fb->filter_callback(fb, vec[i].iov_base,
vec[i].iov_len);
> +         }
> +     }
>   
>       /* while it's nice an easy to build the vector and crud, it's
painful
>        * to deal with a partial writev()


> *** orig_buff.h       Tue Aug 21 17:45:34 2001
> --- spidercache_buff.h        Tue Aug 21 17:45:35 2001
> ***************
> *** 129,134 ****
> --- 129,138 ----
>       Sfio_t *sf_in;
>       Sfio_t *sf_out;
>   #endif
> + 
> +     void *callback_data;
> +     void (*filter_callback)(BUFF *, const void *, int );
> +     
>   };
>   
>   #ifdef B_SFIO


-- 
Greg Stein, http://www.lyra.org/

Reply via email to