trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpe...@apache.org
Subject trafficserver git commit: TS-3581: remove unused parameters from Cache::remove()
Date Mon, 18 May 2015 17:10:13 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/master 4b60d644c -> 5bea4c448


TS-3581: remove unused parameters from Cache::remove()

A number of the parameters to Cache::remove() are never actually
used. We can simplify the code and make it easier to understand by
removing these.


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

Branch: refs/heads/master
Commit: 5bea4c4484edb5b1a7930245227d3c3a95b70fbb
Parents: 4b60d64
Author: James Peach <jpeach@apache.org>
Authored: Fri Apr 10 16:06:01 2015 -0700
Committer: James Peach <jpeach@apache.org>
Committed: Mon May 18 10:06:16 2015 -0700

----------------------------------------------------------------------
 CHANGES                                 |  2 ++
 iocore/cache/Cache.cc                   | 13 ++++++-------
 iocore/cache/CacheVol.cc                |  2 +-
 iocore/cache/I_Cache.h                  |  3 +--
 iocore/cache/P_CacheInternal.h          |  2 +-
 iocore/cluster/ClusterCache.cc          |  3 +--
 iocore/cluster/P_ClusterCacheInternal.h |  4 ++--
 iocore/cluster/P_ClusterInline.h        |  6 ++----
 proxy/InkAPI.cc                         |  2 +-
 9 files changed, 17 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5bea4c44/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 86254e0..7eb1e0d 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 6.0.0
 
+  *) [TS-3581] Remove unused parameters from Cache::remove().
+
   *) [TS-3568] We can now assume unordered_map is always available, just need
    to detect the appropriate compiler flags. This modifies the AC module too
    only check for unordered_map though, since otherwise we'd never get the

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5bea4c44/iocore/cache/Cache.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc
index 6dc13e5..bb20397 100644
--- a/iocore/cache/Cache.cc
+++ b/iocore/cache/Cache.cc
@@ -1247,7 +1247,7 @@ CacheProcessor::open_write(Continuation *cont, CacheKey *key, bool cluster_cache
 
 Action *
 CacheProcessor::remove(Continuation *cont, CacheKey *key, bool cluster_cache_local ATS_UNUSED,
CacheFragType frag_type,
-                       bool rm_user_agents, bool rm_link, char *hostname, int host_len)
+                       const char *hostname, int host_len)
 {
   Debug("cache_remove", "[CacheProcessor::remove] Issuing cache delete for %u", cache_hash(*key));
 #ifdef CLUSTER_CACHE
@@ -1255,11 +1255,11 @@ CacheProcessor::remove(Continuation *cont, CacheKey *key, bool cluster_cache_loc
     ClusterMachine *m = cluster_machine_at_depth(cache_hash(*key));
 
     if (m) {
-      return Cluster_remove(m, cont, key, rm_user_agents, rm_link, frag_type, hostname, host_len);
+      return Cluster_remove(m, cont, key, frag_type, hostname, host_len);
     }
   }
 #endif
-  return caches[frag_type]->remove(cont, key, frag_type, rm_user_agents, rm_link, hostname,
host_len);
+  return caches[frag_type]->remove(cont, key, frag_type, hostname, host_len);
 }
 
 #if 0
@@ -3101,8 +3101,7 @@ Lfree:
 }
 
 Action *
-Cache::remove(Continuation *cont, const CacheKey *key, CacheFragType type, bool /* user_agents
ATS_UNUSED */,
-              bool /* link ATS_UNUSED */, const char *hostname, int host_len)
+Cache::remove(Continuation *cont, const CacheKey *key, CacheFragType type, const char *hostname,
int host_len)
 {
   if (!CacheProcessor::IsCacheReady(type)) {
     if (cont)
@@ -3839,12 +3838,12 @@ CacheProcessor::remove(Continuation *cont, CacheURL *url, bool cluster_cache_loc
 #ifdef CLUSTER_CACHE
   if (cache_clustering_enabled > 0 && !cluster_cache_local) {
     // Remove from cluster
-    return remove(cont, &id, cluster_cache_local, frag_type, true, false, const_cast<char
*>(hostname), len);
+    return remove(cont, &id, cluster_cache_local, frag_type, hostname, len);
   }
 #endif
 
   // Remove from local cache only.
-  return caches[frag_type]->remove(cont, &id, frag_type, true, false, const_cast<char
*>(hostname), len);
+  return caches[frag_type]->remove(cont, &id, frag_type, hostname, len);
 }
 
 CacheDisk *

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5bea4c44/iocore/cache/CacheVol.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CacheVol.cc b/iocore/cache/CacheVol.cc
index daf9fab..f9047f3 100644
--- a/iocore/cache/CacheVol.cc
+++ b/iocore/cache/CacheVol.cc
@@ -304,7 +304,7 @@ CacheVC::scanObject(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED
*/)
         ink_assert(hostinfo_copied);
         SET_HANDLER(&CacheVC::scanRemoveDone);
         // force remove even if there is a writer
-        cacheProcessor.remove(this, &doc->first_key, true, CACHE_FRAG_TYPE_HTTP, true,
false, (char *)hname, hlen);
+        cacheProcessor.remove(this, &doc->first_key, true, CACHE_FRAG_TYPE_HTTP, hname,
hlen);
         return EVENT_CONT;
       } else {
         offset = (char *)doc - buf->data();

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5bea4c44/iocore/cache/I_Cache.h
----------------------------------------------------------------------
diff --git a/iocore/cache/I_Cache.h b/iocore/cache/I_Cache.h
index 4c4cfe8..50b3185 100644
--- a/iocore/cache/I_Cache.h
+++ b/iocore/cache/I_Cache.h
@@ -84,8 +84,7 @@ struct CacheProcessor : public Processor {
                                 CacheFragType frag_type = CACHE_FRAG_TYPE_NONE, int expected_size
= CACHE_EXPECTED_SIZE,
                                 int options = 0, time_t pin_in_cache = (time_t)0, char *hostname
= 0, int host_len = 0);
   inkcoreapi Action *remove(Continuation *cont, CacheKey *key, bool cluster_cache_local,
-                            CacheFragType frag_type = CACHE_FRAG_TYPE_NONE, bool rm_user_agents
= true, bool rm_link = false,
-                            char *hostname = 0, int host_len = 0);
+                            CacheFragType frag_type = CACHE_FRAG_TYPE_NONE, const char *hostname
= 0, int host_len = 0);
   Action *scan(Continuation *cont, char *hostname = 0, int host_len = 0, int KB_per_second
= SCAN_KB_PER_SECOND);
 #ifdef HTTP_CACHE
   Action *lookup(Continuation *cont, CacheURL *url, bool cluster_cache_local, bool local_only
= false,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5bea4c44/iocore/cache/P_CacheInternal.h
----------------------------------------------------------------------
diff --git a/iocore/cache/P_CacheInternal.h b/iocore/cache/P_CacheInternal.h
index f4de6c5..35942b3 100644
--- a/iocore/cache/P_CacheInternal.h
+++ b/iocore/cache/P_CacheInternal.h
@@ -1028,7 +1028,7 @@ struct Cache {
   inkcoreapi Action *open_write(Continuation *cont, const CacheKey *key, CacheFragType frag_type,
int options = 0,
                                 time_t pin_in_cache = (time_t)0, const char *hostname = 0,
int host_len = 0);
   inkcoreapi Action *remove(Continuation *cont, const CacheKey *key, CacheFragType type =
CACHE_FRAG_TYPE_HTTP,
-                            bool user_agents = true, bool link = false, const char *hostname
= 0, int host_len = 0);
+                            const char *hostname = 0, int host_len = 0);
   Action *scan(Continuation *cont, const char *hostname = 0, int host_len = 0, int KB_per_second
= 2500);
 
 #ifdef HTTP_CACHE

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5bea4c44/iocore/cluster/ClusterCache.cc
----------------------------------------------------------------------
diff --git a/iocore/cluster/ClusterCache.cc b/iocore/cluster/ClusterCache.cc
index 198d8e1..6c8d424 100644
--- a/iocore/cluster/ClusterCache.cc
+++ b/iocore/cluster/ClusterCache.cc
@@ -1316,8 +1316,7 @@ cache_op_ClusterFunction(ClusterHandler *ch, void *data, int len)
     }
 
     Cache *call_cache = caches[c->frag_type];
-    Action *a = call_cache->remove(c, &key, c->frag_type, !!(c->cfl_flags &
CFL_REMOVE_USER_AGENTS),
-                                   !!(c->cfl_flags & CFL_REMOVE_LINK), hostname, host_len);
+    Action *a = call_cache->remove(c, &key, c->frag_type, hostname, host_len);
     if (a != ACTION_RESULT_DONE) {
       c->cache_action = a;
     }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5bea4c44/iocore/cluster/P_ClusterCacheInternal.h
----------------------------------------------------------------------
diff --git a/iocore/cluster/P_ClusterCacheInternal.h b/iocore/cluster/P_ClusterCacheInternal.h
index 503acb0..eb7d5cd 100644
--- a/iocore/cluster/P_ClusterCacheInternal.h
+++ b/iocore/cluster/P_ClusterCacheInternal.h
@@ -324,8 +324,8 @@ struct CacheContinuation : public Continuation {
 // Bit definitions for cfl_flags.
 // Note: Limited to 16 bits
 #define CFL_OVERWRITE_ON_WRITE (1 << 1)
-#define CFL_REMOVE_USER_AGENTS (1 << 2)
-#define CFL_REMOVE_LINK (1 << 3)
+#define CFL_REMOVE_USER_AGENTS (1 << 2) // Historical, now unused
+#define CFL_REMOVE_LINK (1 << 3)        // Historical, now unused
 #define CFL_LOPENWRITE_HAVE_OLDINFO (1 << 4)
 #define CFL_ALLOW_MULTIPLE_WRITES (1 << 5)
 #define CFL_MAX (1 << 15)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5bea4c44/iocore/cluster/P_ClusterInline.h
----------------------------------------------------------------------
diff --git a/iocore/cluster/P_ClusterInline.h b/iocore/cluster/P_ClusterInline.h
index 246f65d..ed97c36 100644
--- a/iocore/cluster/P_ClusterInline.h
+++ b/iocore/cluster/P_ClusterInline.h
@@ -343,8 +343,7 @@ err_exit:
 }
 
 inline Action *
-Cluster_remove(ClusterMachine *m, Continuation *cont, CacheKey *key, bool rm_user_agents,
bool rm_link, CacheFragType frag_type,
-               char *hostname, int host_len)
+Cluster_remove(ClusterMachine *m, Continuation *cont, CacheKey *key, CacheFragType frag_type,
const char *hostname, int host_len)
 {
   if (clusterProcessor.disable_remote_cluster_ops(m)) {
     Action a;
@@ -368,9 +367,8 @@ Cluster_remove(ClusterMachine *m, Continuation *cont, CacheKey *key, bool
rm_use
 
     // Setup args for remote update
     CacheOpArgs_General updateArgs;
+    ink_zero(updateArgs);
     updateArgs.url_md5 = key;
-    updateArgs.cfl_flags |= (rm_user_agents ? CFL_REMOVE_USER_AGENTS : 0);
-    updateArgs.cfl_flags |= (rm_link ? CFL_REMOVE_LINK : 0);
     updateArgs.frag_type = frag_type;
     return CacheContinuation::do_op(cont, m, (void *)&updateArgs, CACHE_REMOVE, msg,
(flen + len));
   } else {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5bea4c44/proxy/InkAPI.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index 4a1c78c..8bca4bf 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -6709,7 +6709,7 @@ TSCacheRemove(TSCont contp, TSCacheKey key)
   CacheInfo *info = (CacheInfo *)key;
   INKContInternal *i = (INKContInternal *)contp;
 
-  return (TSAction)cacheProcessor.remove(i, &info->cache_key, true, info->frag_type,
true, false, info->hostname, info->len);
+  return (TSAction)cacheProcessor.remove(i, &info->cache_key, true, info->frag_type,
info->hostname, info->len);
 }
 
 TSAction


Mime
View raw message