You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Davi Arnaut <da...@haxent.com.br> on 2006/07/24 02:50:38 UTC

[patch 08/10] unify storage providers entry calls

Later on those will handle all HTTP specific caching nuances

Index: trunk/modules/cache/cache_storage.c
===================================================================
--- trunk.orig/modules/cache/cache_storage.c
+++ trunk/modules/cache/cache_storage.c
@@ -24,6 +24,30 @@ extern module AP_MODULE_DECLARE_DATA cac
 
 /* -------------------------------------------------------------- */
 
+apr_status_t cache_store_entity_headers(cache_request_rec *cache,
+                                        request_rec *r, cache_info *info)
+{
+    return cache->provider->store_headers(cache->handle, r, info);
+}
+
+apr_status_t cache_store_entity_body(cache_request_rec *cache, request_rec *r,
+                                     apr_bucket_brigade *bb)
+{
+    return cache->provider->store_body(cache->handle, r, bb);
+}
+
+apr_status_t cache_recall_entity_headers(const cache_provider *provider,
+                                         cache_handle_t *h, request_rec *r)
+{
+    return provider->recall_headers(h, r);
+}
+
+apr_status_t cache_recall_entity_body(cache_request_rec *cache,
+                                      apr_pool_t *pool, apr_bucket_brigade *bb)
+{
+    return cache->provider->recall_body(cache->handle, pool, bb);
+}
+
 /*
  * delete all URL entities from the cache
  *
@@ -311,7 +335,7 @@ int cache_select(request_rec *r)
         switch ((rv = list->provider->open_entity(h, r, key))) {
         case OK: {
 
-            if (list->provider->recall_headers(h, r) != APR_SUCCESS) {
+            if (cache_recall_entity_headers(list->provider, h, r) != APR_SUCCESS) {
                 /* TODO: Handle this error */
                 return DECLINED;
             }
Index: trunk/modules/cache/mod_cache.c
===================================================================
--- trunk.orig/modules/cache/mod_cache.c
+++ trunk/modules/cache/mod_cache.c
@@ -271,7 +271,7 @@ static int cache_out_filter(ap_filter_t 
     r->status = cache->handle->cache_obj->info.status;
 
     /* recall_headers() was called in cache_select() */
-    cache->provider->recall_body(cache->handle, r->pool, bb);
+    cache_recall_entity_body(cache, r->pool, bb);
 
     /* This filter is done once it has served up its content */
     ap_remove_output_filter(f);
@@ -676,7 +676,7 @@ static int cache_save_filter(ap_filter_t
         /* pass the brigades into the cache, then pass them
          * up the filter stack
          */
-        rv = cache->provider->store_body(cache->handle, r, in);
+        rv = cache_store_entity_body(cache, r, in);
         if (rv != APR_SUCCESS) {
             ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, r->server,
                          "cache: Cache provider's store_body failed!");
@@ -781,7 +781,7 @@ static int cache_save_filter(ap_filter_t
      * permissions problems or a read-only (re)mount. This must be handled
      * later.
      */
-    rv = cache->provider->store_headers(cache->handle, r, info);
+    rv = cache_store_entity_headers(cache, r, info);
 
     /* Did we just update the cached headers on a revalidated response?
      *
@@ -809,7 +809,7 @@ static int cache_save_filter(ap_filter_t
             APR_BRIGADE_INSERT_TAIL(bb, bkt);
         }
         else {
-            cache->provider->recall_body(cache->handle, r->pool, bb);
+            cache_recall_entity_body(cache, r->pool, bb);
         }
 
         cache->block_response = 1;
@@ -845,7 +845,7 @@ static int cache_save_filter(ap_filter_t
         return ap_pass_brigade(f->next, in);
     }
 
-    rv = cache->provider->store_body(cache->handle, r, in);
+    rv = cache_store_entity_body(cache, r, in);
     if (rv != APR_SUCCESS) {
         ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, r->server,
                      "cache: store_body failed");
Index: trunk/modules/cache/mod_cache.h
===================================================================
--- trunk.orig/modules/cache/mod_cache.h
+++ trunk/modules/cache/mod_cache.h
@@ -305,13 +305,11 @@ apr_status_t cache_generate_key_default(
  */
 const char* cache_create_key( request_rec*r );
 
-/*
-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_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);
-*/
+apr_status_t cache_store_entity_headers(cache_request_rec *cache, request_rec *r, cache_info *info);
+apr_status_t cache_store_entity_body(cache_request_rec *cache, request_rec *r, apr_bucket_brigade *bb);
+
+apr_status_t cache_recall_entity_headers(const cache_provider *provider, cache_handle_t *h, request_rec *r);
+apr_status_t cache_recall_entity_body(cache_request_rec *cache, apr_pool_t *pool, apr_bucket_brigade *bb);
 
 /* hooks */
 

--