You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jp...@apache.org on 2015/05/18 18:34:53 UTC

trafficserver git commit: TS-3580: make CacheProcessor::open_read_internal a local static

Repository: trafficserver
Updated Branches:
  refs/heads/master 8f297be45 -> 4b60d644c


TS-3580: make CacheProcessor::open_read_internal a local static

This is another small step towwards allowing the Cache interface
to primarily in cache keys rather than URLs.


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/4b60d644
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/4b60d644
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/4b60d644

Branch: refs/heads/master
Commit: 4b60d644c6565d79eb6b3a77c04380e837a1b041
Parents: 8f297be
Author: James Peach <jp...@apache.org>
Authored: Sun May 3 12:00:18 2015 -0700
Committer: James Peach <jp...@apache.org>
Committed: Mon May 18 09:14:07 2015 -0700

----------------------------------------------------------------------
 iocore/cache/Cache.cc  | 53 ++++++++++++++++++++++-----------------------
 iocore/cache/I_Cache.h |  3 ---
 2 files changed, 26 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/4b60d644/iocore/cache/Cache.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc
index 2de1a66..6dc13e5 100644
--- a/iocore/cache/Cache.cc
+++ b/iocore/cache/Cache.cc
@@ -263,6 +263,32 @@ cache_stats_bytes_used_cb(const char *name, RecDataT data_type, RecData *data, R
   return 1;
 }
 
+#ifdef CLUSTER_CACHE
+static Action *
+open_read_internal(int opcode, Continuation *cont, MIOBuffer *buf, CacheURL *url, CacheHTTPHdr *request,
+                   CacheLookupHttpConfig *params, CacheKey *key, time_t pin_in_cache, CacheFragType frag_type, char *hostname,
+                   int host_len)
+{
+  INK_MD5 url_md5;
+  if ((opcode == CACHE_OPEN_READ_LONG) || (opcode == CACHE_OPEN_READ_BUFFER_LONG)) {
+    Cache::generate_key(&url_md5, url);
+  } else {
+    url_md5 = *key;
+  }
+  ClusterMachine *m = cluster_machine_at_depth(cache_hash(url_md5));
+
+  if (m) {
+    return Cluster_read(m, opcode, cont, buf, url, request, params, key, pin_in_cache, frag_type, hostname, host_len);
+  } else {
+    if ((opcode == CACHE_OPEN_READ_LONG) || (opcode == CACHE_OPEN_READ_BUFFER_LONG)) {
+      return caches[frag_type]->open_read(cont, &url_md5, request, params, frag_type, hostname, host_len);
+    } else {
+      return caches[frag_type]->open_read(cont, key, frag_type, hostname, host_len);
+    }
+  }
+}
+#endif
+
 static int
 validate_rww(int new_value)
 {
@@ -1259,33 +1285,6 @@ CacheProcessor::lookup(Continuation *cont, CacheURL *url, bool cluster_cache_loc
 
 #endif
 
-
-#ifdef CLUSTER_CACHE
-Action *
-CacheProcessor::open_read_internal(int opcode, Continuation *cont, MIOBuffer *buf, CacheURL *url, CacheHTTPHdr *request,
-                                   CacheLookupHttpConfig *params, CacheKey *key, time_t pin_in_cache, CacheFragType frag_type,
-                                   char *hostname, int host_len)
-{
-  INK_MD5 url_md5;
-  if ((opcode == CACHE_OPEN_READ_LONG) || (opcode == CACHE_OPEN_READ_BUFFER_LONG)) {
-    Cache::generate_key(&url_md5, url);
-  } else {
-    url_md5 = *key;
-  }
-  ClusterMachine *m = cluster_machine_at_depth(cache_hash(url_md5));
-
-  if (m) {
-    return Cluster_read(m, opcode, cont, buf, url, request, params, key, pin_in_cache, frag_type, hostname, host_len);
-  } else {
-    if ((opcode == CACHE_OPEN_READ_LONG) || (opcode == CACHE_OPEN_READ_BUFFER_LONG)) {
-      return caches[frag_type]->open_read(cont, &url_md5, request, params, frag_type, hostname, host_len);
-    } else {
-      return caches[frag_type]->open_read(cont, key, frag_type, hostname, host_len);
-    }
-  }
-}
-#endif
-
 #ifdef CLUSTER_CACHE
 Action *
 CacheProcessor::link(Continuation *cont, CacheKey *from, CacheKey *to, bool cluster_cache_local, CacheFragType type, char *hostname,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/4b60d644/iocore/cache/I_Cache.h
----------------------------------------------------------------------
diff --git a/iocore/cache/I_Cache.h b/iocore/cache/I_Cache.h
index 56b2060..4c4cfe8 100644
--- a/iocore/cache/I_Cache.h
+++ b/iocore/cache/I_Cache.h
@@ -96,9 +96,6 @@ struct CacheProcessor : public Processor {
   Action *open_write(Continuation *cont, int expected_size, CacheURL *url, bool cluster_cache_local, CacheHTTPHdr *request,
                      CacheHTTPInfo *old_info, time_t pin_in_cache = (time_t)0, CacheFragType frag_type = CACHE_FRAG_TYPE_HTTP);
   Action *remove(Continuation *cont, CacheURL *url, bool cluster_cache_local, CacheFragType frag_type = CACHE_FRAG_TYPE_HTTP);
-
-  Action *open_read_internal(int, Continuation *, MIOBuffer *, CacheURL *, CacheHTTPHdr *, CacheLookupHttpConfig *, CacheKey *,
-                             time_t, CacheFragType type, char *hostname, int host_len);
 #endif
   Action *link(Continuation *cont, CacheKey *from, CacheKey *to, bool cluster_cache_local,
                CacheFragType frag_type = CACHE_FRAG_TYPE_HTTP, char *hostname = 0, int host_len = 0);