You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by je...@apache.org on 2004/08/03 10:20:22 UTC

cvs commit: httpd-2.0/modules/experimental cache_storage.c mod_cache.c mod_cache.h mod_disk_cache.c mod_mem_cache.c

jerenkrantz    2004/08/03 01:20:22

  Modified:    modules/experimental cache_storage.c mod_cache.c mod_cache.h
                        mod_disk_cache.c mod_mem_cache.c
  Log:
  Avoid confusion when reading mod_cache code.  write_ and read_ often imply
  network code; store_ and recall_ are more understandable prefixes in this
  context.
  
  Reviewed by:	Roy Fielding, Cliff Woolley
  
  Revision  Changes    Path
  1.35      +13 -9     httpd-2.0/modules/experimental/cache_storage.c
  
  Index: cache_storage.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/experimental/cache_storage.c,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -u -r1.34 -r1.35
  --- cache_storage.c	9 Feb 2004 20:29:18 -0000	1.34
  +++ cache_storage.c	3 Aug 2004 08:20:21 -0000	1.35
  @@ -145,7 +145,7 @@
           case OK: {
               char *vary = NULL;
               const char *varyhdr = NULL;
  -            if (cache_read_entity_headers(h, r) != APR_SUCCESS) {
  +            if (cache_recall_entity_headers(h, r) != APR_SUCCESS) {
                   /* TODO: Handle this error */
                   return DECLINED;
               }
  @@ -222,24 +222,26 @@
       return DECLINED;
   }
   
  -apr_status_t cache_write_entity_headers(cache_handle_t *h, 
  +apr_status_t cache_store_entity_headers(cache_handle_t *h, 
                                           request_rec *r, 
                                           cache_info *info)
   {
  -    return (h->write_headers(h, r, info));
  +    return (h->store_headers(h, r, info));
   }
  -apr_status_t cache_write_entity_body(cache_handle_t *h, request_rec *r, apr_bucket_brigade *b) 
  +
  +apr_status_t cache_store_entity_body(cache_handle_t *h, request_rec *r,
  +                                     apr_bucket_brigade *b) 
   {
  -    return (h->write_body(h, r, b));
  +    return (h->store_body(h, r, b));
   }
   
  -apr_status_t cache_read_entity_headers(cache_handle_t *h, request_rec *r)
  +apr_status_t cache_recall_entity_headers(cache_handle_t *h, request_rec *r)
   {
       apr_status_t rv;
       cache_info *info = &(h->cache_obj->info);
   
       /* Build the header table from info in the info struct */
  -    rv = h->read_headers(h, r);
  +    rv = h->recall_headers(h, r);
       if (rv != APR_SUCCESS) {
           return rv;
       }
  @@ -248,9 +250,11 @@
   
       return APR_SUCCESS;
   }
  -apr_status_t cache_read_entity_body(cache_handle_t *h, apr_pool_t *p, apr_bucket_brigade *b) 
  +
  +apr_status_t cache_recall_entity_body(cache_handle_t *h, apr_pool_t *p,
  +                                    apr_bucket_brigade *b)
   {
  -    return (h->read_body(h, p, b));
  +    return (h->recall_body(h, p, b));
   }
   
   apr_status_t cache_generate_key_default( request_rec *r, apr_pool_t*p, char**key ) 
  
  
  
  1.87      +5 -5      httpd-2.0/modules/experimental/mod_cache.c
  
  Index: mod_cache.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/experimental/mod_cache.c,v
  retrieving revision 1.86
  retrieving revision 1.87
  diff -u -u -r1.86 -r1.87
  --- mod_cache.c	2 Aug 2004 17:39:09 -0000	1.86
  +++ mod_cache.c	3 Aug 2004 08:20:21 -0000	1.87
  @@ -260,8 +260,8 @@
       ap_log_error(APLOG_MARK, APLOG_DEBUG, APR_SUCCESS, r->server,
                    "cache: running CACHE_OUT filter");
   
  -    /* cache_read_entity_headers() was called in cache_select_url() */
  -    cache_read_entity_body(cache->handle, r->pool, bb);
  +    /* cache_recall_entity_headers() was called in cache_select_url() */
  +    cache_recall_entity_body(cache->handle, r->pool, bb);
   
       /* This filter is done once it has served up its content */
       ap_remove_output_filter(f);
  @@ -369,7 +369,7 @@
           /* pass the brigades into the cache, then pass them
            * up the filter stack
            */
  -        rv = cache_write_entity_body(cache->handle, r, in);
  +        rv = cache_store_entity_body(cache->handle, r, in);
           if (rv != APR_SUCCESS) {
               ap_remove_output_filter(f);
           }
  @@ -708,9 +708,9 @@
       /*
        * Write away header information to cache.
        */
  -    rv = cache_write_entity_headers(cache->handle, r, info);
  +    rv = cache_store_entity_headers(cache->handle, r, info);
       if (rv == APR_SUCCESS) {
  -        rv = cache_write_entity_body(cache->handle, r, in);
  +        rv = cache_store_entity_body(cache->handle, r, in);
       }
       if (rv != APR_SUCCESS) {
           ap_remove_output_filter(f);
  
  
  
  1.47      +8 -8      httpd-2.0/modules/experimental/mod_cache.h
  
  Index: mod_cache.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/experimental/mod_cache.h,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -u -r1.46 -r1.47
  --- mod_cache.h	2 Aug 2004 17:27:08 -0000	1.46
  +++ mod_cache.h	3 Aug 2004 08:20:21 -0000	1.47
  @@ -178,10 +178,10 @@
   struct cache_handle {
       cache_object_t *cache_obj;
       int (*remove_entity) (cache_handle_t *h);
  -    apr_status_t (*write_headers)(cache_handle_t *h, request_rec *r, cache_info *i);
  -    apr_status_t (*write_body)(cache_handle_t *h, request_rec *r, apr_bucket_brigade *b);
  -    apr_status_t (*read_headers) (cache_handle_t *h, request_rec *r);
  -    apr_status_t (*read_body) (cache_handle_t *h, apr_pool_t *p, apr_bucket_brigade *bb); 
  +    apr_status_t (*store_headers)(cache_handle_t *h, request_rec *r, cache_info *i);
  +    apr_status_t (*store_body)(cache_handle_t *h, request_rec *r, apr_bucket_brigade *b);
  +    apr_status_t (*recall_headers) (cache_handle_t *h, request_rec *r);
  +    apr_status_t (*recall_body) (cache_handle_t *h, apr_pool_t *p, apr_bucket_brigade *bb); 
       apr_table_t *req_hdrs;   /* These are the original request headers */
   };
   
  @@ -242,11 +242,11 @@
    */
   const char* cache_create_key( request_rec*r );
   
  -apr_status_t cache_write_entity_headers(cache_handle_t *h, request_rec *r, cache_info *info);
  -apr_status_t cache_write_entity_body(cache_handle_t *h, request_rec *r, apr_bucket_brigade *bb);
  +apr_status_t cache_store_entity_headers(cache_handle_t *h, request_rec *r, cache_info *info);
  +apr_status_t cache_store_entity_body(cache_handle_t *h, request_rec *r, apr_bucket_brigade *bb);
   
  -apr_status_t cache_read_entity_headers(cache_handle_t *h, request_rec *r);
  -apr_status_t cache_read_entity_body(cache_handle_t *h, apr_pool_t *p, apr_bucket_brigade *bb);
  +apr_status_t cache_recall_entity_headers(cache_handle_t *h, request_rec *r);
  +apr_status_t cache_recall_entity_body(cache_handle_t *h, apr_pool_t *p, apr_bucket_brigade *bb);
   
   
   /* hooks */
  
  
  
  1.55      +20 -20    httpd-2.0/modules/experimental/mod_disk_cache.c
  
  Index: mod_disk_cache.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/experimental/mod_disk_cache.c,v
  retrieving revision 1.54
  retrieving revision 1.55
  diff -u -u -r1.54 -r1.55
  --- mod_disk_cache.c	2 Aug 2004 18:39:09 -0000	1.54
  +++ mod_disk_cache.c	3 Aug 2004 08:20:21 -0000	1.55
  @@ -78,10 +78,10 @@
   
   /* Forward declarations */
   static int remove_entity(cache_handle_t *h);
  -static apr_status_t write_headers(cache_handle_t *h, request_rec *r, cache_info *i);
  -static apr_status_t write_body(cache_handle_t *h, request_rec *r, apr_bucket_brigade *b);
  -static apr_status_t read_headers(cache_handle_t *h, request_rec *r);
  -static apr_status_t read_body(cache_handle_t *h, apr_pool_t *p, apr_bucket_brigade *bb);
  +static apr_status_t store_headers(cache_handle_t *h, request_rec *r, cache_info *i);
  +static apr_status_t store_body(cache_handle_t *h, request_rec *r, apr_bucket_brigade *b);
  +static apr_status_t recall_headers(cache_handle_t *h, request_rec *r);
  +static apr_status_t recall_body(cache_handle_t *h, apr_pool_t *p, apr_bucket_brigade *bb);
   
   /*
    * Local static functions
  @@ -186,7 +186,7 @@
    * file for an ap_cache_el, this state information will be read
    * and written transparent to clients of this module
    */
  -static int file_cache_read_mydata(apr_file_t *fd, cache_info *info,
  +static int file_cache_recall_mydata(apr_file_t *fd, cache_info *info,
                                     disk_cache_object_t *dobj)
   {
       apr_status_t rv;
  @@ -243,7 +243,7 @@
       return APR_SUCCESS;
   }
   
  -static int file_cache_write_mydata(apr_file_t *fd , cache_handle_t *h, request_rec *r)
  +static int file_cache_store_mydata(apr_file_t *fd , cache_handle_t *h, request_rec *r)
   {
       apr_status_t rc;
       char *buf;
  @@ -337,10 +337,10 @@
       if (rv == APR_SUCCESS) {
           /* Populate the cache handle */
           h->cache_obj = obj;
  -        h->read_body = &read_body;
  -        h->read_headers = &read_headers;
  -        h->write_body = &write_body;
  -        h->write_headers = &write_headers;
  +        h->recall_body = &recall_body;
  +        h->recall_headers = &recall_headers;
  +        h->store_body = &store_body;
  +        h->store_headers = &store_headers;
           h->remove_entity = &remove_entity;
   
           ap_log_error(APLOG_MARK, APLOG_INFO, 0, r->server,
  @@ -430,17 +430,17 @@
       }
   
       /* Read the bytes to setup the cache_info fields */
  -    rc = file_cache_read_mydata(hfd, info, dobj);
  +    rc = file_cache_recall_mydata(hfd, info, dobj);
       if (rc != APR_SUCCESS) {
           /* XXX log message */
           return DECLINED;
       }
   
       /* Initialize the cache_handle callback functions */
  -    h->read_body = &read_body;
  -    h->read_headers = &read_headers;
  -    h->write_body = &write_body;
  -    h->write_headers = &write_headers;
  +    h->recall_body = &recall_body;
  +    h->recall_headers = &recall_headers;
  +    h->store_body = &store_body;
  +    h->store_headers = &store_headers;
       h->remove_entity = &remove_entity;
   
       ap_log_error(APLOG_MARK, APLOG_INFO, 0, r->server,
  @@ -462,7 +462,7 @@
    * @@@: XXX: FIXME: currently the headers are passed thru un-merged.
    * Is that okay, or should they be collapsed where possible?
    */
  -static apr_status_t read_headers(cache_handle_t *h, request_rec *r)
  +static apr_status_t recall_headers(cache_handle_t *h, request_rec *r)
   {
       apr_status_t rv;
       char urlbuff[1034];
  @@ -523,7 +523,7 @@
       return APR_SUCCESS;
   }
   
  -static apr_status_t read_body(cache_handle_t *h, apr_pool_t *p, apr_bucket_brigade *bb)
  +static apr_status_t recall_body(cache_handle_t *h, apr_pool_t *p, apr_bucket_brigade *bb)
   {
       apr_bucket *e;
       disk_cache_object_t *dobj = (disk_cache_object_t*) h->cache_obj->vobj;
  @@ -537,7 +537,7 @@
       return APR_SUCCESS;
   }
   
  -static apr_status_t write_headers(cache_handle_t *h, request_rec *r, cache_info *info)
  +static apr_status_t store_headers(cache_handle_t *h, request_rec *r, cache_info *info)
   {
       disk_cache_conf *conf = ap_get_module_config(r->server->module_config,
                                                    &disk_cache_module);
  @@ -578,7 +578,7 @@
           hfd = dobj->hfd;
           dobj->name = h->cache_obj->key;
   
  -        file_cache_write_mydata(dobj->hfd, h, r);
  +        file_cache_store_mydata(dobj->hfd, h, r);
   
           if (r->headers_out) {
               int i;
  @@ -645,7 +645,7 @@
       return APR_SUCCESS;
   }
   
  -static apr_status_t write_body(cache_handle_t *h, request_rec *r, apr_bucket_brigade *b)
  +static apr_status_t store_body(cache_handle_t *h, request_rec *r, apr_bucket_brigade *b)
   {
       apr_bucket *e;
       apr_status_t rv;
  
  
  
  1.111     +18 -18    httpd-2.0/modules/experimental/mod_mem_cache.c
  
  Index: mod_mem_cache.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/experimental/mod_mem_cache.c,v
  retrieving revision 1.110
  retrieving revision 1.111
  diff -u -u -r1.110 -r1.111
  --- mod_mem_cache.c	2 Aug 2004 17:18:15 -0000	1.110
  +++ mod_mem_cache.c	3 Aug 2004 08:20:21 -0000	1.111
  @@ -89,10 +89,10 @@
   
   /* Forward declarations */
   static int remove_entity(cache_handle_t *h);
  -static apr_status_t write_headers(cache_handle_t *h, request_rec *r, cache_info *i);
  -static apr_status_t write_body(cache_handle_t *h, request_rec *r, apr_bucket_brigade *b);
  -static apr_status_t read_headers(cache_handle_t *h, request_rec *r);
  -static apr_status_t read_body(cache_handle_t *h, apr_pool_t *p, apr_bucket_brigade *bb);
  +static apr_status_t store_headers(cache_handle_t *h, request_rec *r, cache_info *i);
  +static apr_status_t store_body(cache_handle_t *h, request_rec *r, apr_bucket_brigade *b);
  +static apr_status_t recall_headers(cache_handle_t *h, request_rec *r);
  +static apr_status_t recall_body(cache_handle_t *h, apr_pool_t *p, apr_bucket_brigade *bb);
   
   static void cleanup_cache_object(cache_object_t *obj);
   
  @@ -372,7 +372,7 @@
       if (len == -1) {
           /* Caching a streaming response. Assume the response is
            * less than or equal to max_streaming_buffer_size. We will
  -         * correct all the cache size counters in write_body once
  +         * correct all the cache size counters in store_body once
            * we know exactly know how much we are caching.
            */
           len = sconf->max_streaming_buffer_size;
  @@ -471,10 +471,10 @@
   
       /* Populate the cache handle */
       h->cache_obj = obj;
  -    h->read_body = &read_body;
  -    h->read_headers = &read_headers;
  -    h->write_body = &write_body;
  -    h->write_headers = &write_headers;
  +    h->recall_body = &recall_body;
  +    h->recall_headers = &recall_headers;
  +    h->store_body = &store_body;
  +    h->store_headers = &store_headers;
       h->remove_entity = &remove_entity;
   
       return OK;
  @@ -526,13 +526,13 @@
       }
   
       /* Initialize the cache_handle */
  -    h->read_body = &read_body;
  -    h->read_headers = &read_headers;
  -    h->write_body = &write_body;
  -    h->write_headers = &write_headers;
  +    h->recall_body = &recall_body;
  +    h->recall_headers = &recall_headers;
  +    h->store_body = &store_body;
  +    h->store_headers = &store_headers;
       h->remove_entity = &remove_entity;
       h->cache_obj = obj;
  -    h->req_hdrs = NULL;  /* Pick these up in read_headers() */
  +    h->req_hdrs = NULL;  /* Pick these up in recall_headers() */
       return OK;
   }
   
  @@ -665,7 +665,7 @@
       return OK;
   }
   
  -static apr_status_t read_headers(cache_handle_t *h, request_rec *r) 
  +static apr_status_t recall_headers(cache_handle_t *h, request_rec *r) 
   {
       int rc;
       mem_cache_object_t *mobj = (mem_cache_object_t*) h->cache_obj->vobj;
  @@ -700,7 +700,7 @@
       return rc;
   }
   
  -static apr_status_t read_body(cache_handle_t *h, apr_pool_t *p, apr_bucket_brigade *bb) 
  +static apr_status_t recall_body(cache_handle_t *h, apr_pool_t *p, apr_bucket_brigade *bb) 
   {
       apr_bucket *b;
       mem_cache_object_t *mobj = (mem_cache_object_t*) h->cache_obj->vobj;
  @@ -723,7 +723,7 @@
   }
   
   
  -static apr_status_t write_headers(cache_handle_t *h, request_rec *r, cache_info *info)
  +static apr_status_t store_headers(cache_handle_t *h, request_rec *r, cache_info *info)
   {
       cache_object_t *obj = h->cache_obj;
       mem_cache_object_t *mobj = (mem_cache_object_t*) obj->vobj;
  @@ -820,7 +820,7 @@
       return APR_SUCCESS;
   }
   
  -static apr_status_t write_body(cache_handle_t *h, request_rec *r, apr_bucket_brigade *b) 
  +static apr_status_t store_body(cache_handle_t *h, request_rec *r, apr_bucket_brigade *b) 
   {
       apr_status_t rv;
       cache_object_t *obj = h->cache_obj;