This is an automated email from the ASF dual-hosted git repository. masaori pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push: new 9d93106ef9 Cleanup: Rename key_to_vol (#11018) 9d93106ef9 is described below commit 9d93106ef93371284fa13772c7dd37cbf1c8fd7a Author: Masaori Koshiba <masa...@apache.org> AuthorDate: Tue Jan 30 22:08:10 2024 +0900 Cleanup: Rename key_to_vol (#11018) --- doc/developer-guide/cache-architecture/architecture.en.rst | 2 +- .../cache-architecture/cache-initialization.en.rst | 2 +- doc/developer-guide/cache-architecture/data-structures.en.rst | 2 +- src/iocore/cache/Cache.cc | 8 ++++---- src/iocore/cache/CacheRead.cc | 4 ++-- src/iocore/cache/CacheTest.cc | 2 +- src/iocore/cache/CacheWrite.cc | 4 ++-- src/iocore/cache/P_CacheInternal.h | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/doc/developer-guide/cache-architecture/architecture.en.rst b/doc/developer-guide/cache-architecture/architecture.en.rst index 476ff58341..67d0b7c85d 100644 --- a/doc/developer-guide/cache-architecture/architecture.en.rst +++ b/doc/developer-guide/cache-architecture/architecture.en.rst @@ -779,7 +779,7 @@ The basic steps to a cache lookup are: #. The cache stripe is determined (based on the cache key). The :term:`cache key` is used as a hash key in to an array of :cpp:class:`Stripe` instances by - :func:`Cache::key_to_vol`. The construction and arrangement of this array is the essence of how + :func:`Cache::key_to_stripe`. The construction and arrangement of this array is the essence of how volumes are assigned. #. The cache stripe directory :ref:`is probed <cache-directory-probe>` using the diff --git a/doc/developer-guide/cache-architecture/cache-initialization.en.rst b/doc/developer-guide/cache-architecture/cache-initialization.en.rst index ea26ed47d4..f475853c0e 100644 --- a/doc/developer-guide/cache-architecture/cache-initialization.en.rst +++ b/doc/developer-guide/cache-architecture/cache-initialization.en.rst @@ -146,7 +146,7 @@ changed to purple and green respectively. If the blue stripe were added back tho only those would revert to blue. This is because for each stripe the node sequence as generated by the pseudo random number generator depends only the properties of the stripes. -At runtime stripe selection is done by :func:`Cache::key_to_vol` which selects the +At runtime stripe selection is done by :func:`Cache::key_to_stripe` which selects the :class:`CacheHostRecord` instance then picks the stripe assignment slot in the array which determines the stripe for the object. diff --git a/doc/developer-guide/cache-architecture/data-structures.en.rst b/doc/developer-guide/cache-architecture/data-structures.en.rst index e3c3fc00fa..c52f64296c 100644 --- a/doc/developer-guide/cache-architecture/data-structures.en.rst +++ b/doc/developer-guide/cache-architecture/data-structures.en.rst @@ -462,7 +462,7 @@ Data Structures A generic class:`CacheHostRecord` that contains all cache volumes that are not explicitly assigned in :file:`hosting.config`. - .. function:: Stripe * key_to_vol(const char * key, const char * host, int host_len) + .. function:: Stripe * key_to_stripe(CryptoHash * key, const char * host, int host_len) Compute the stripe (:code:`Stripe *`) for a cache :arg:`key` and :arg:`host`. The :arg:`host` is used to find the appropriate :class:`CacheHostRecord` instance. From there the stripe diff --git a/src/iocore/cache/Cache.cc b/src/iocore/cache/Cache.cc index 225b1e6237..5811a0577f 100644 --- a/src/iocore/cache/Cache.cc +++ b/src/iocore/cache/Cache.cc @@ -1225,7 +1225,7 @@ Cache::lookup(Continuation *cont, const CacheKey *key, CacheFragType type, const return ACTION_RESULT_DONE; } - Stripe *stripe = key_to_vol(key, hostname, host_len); + Stripe *stripe = key_to_stripe(key, hostname, host_len); CacheVC *c = new_CacheVC(cont); SET_CONTINUATION_HANDLER(c, &CacheVC::openReadStartHead); c->vio.op = VIO::READ; @@ -1262,7 +1262,7 @@ Cache::remove(Continuation *cont, const CacheKey *key, CacheFragType type, const CACHE_TRY_LOCK(lock, cont->mutex, this_ethread()); ink_assert(lock.is_locked()); - Stripe *stripe = key_to_vol(key, hostname, host_len); + Stripe *stripe = key_to_stripe(key, hostname, host_len); // coverity[var_decl] Dir result; dir_clear(&result); // initialized here, set result empty so we can recognize missed lock @@ -1808,9 +1808,9 @@ rebuild_host_table(Cache *cache) } } -// if generic_host_rec.vols == nullptr, what do we do??? +// if generic_host_rec.stripes == nullptr, what do we do??? Stripe * -Cache::key_to_vol(const CacheKey *key, const char *hostname, int host_len) +Cache::key_to_stripe(const CacheKey *key, const char *hostname, int host_len) { ReplaceablePtr<CacheHostTable>::ScopedReader hosttable(&this->hosttable); diff --git a/src/iocore/cache/CacheRead.cc b/src/iocore/cache/CacheRead.cc index c96588fa43..a17471ee34 100644 --- a/src/iocore/cache/CacheRead.cc +++ b/src/iocore/cache/CacheRead.cc @@ -47,7 +47,7 @@ Cache::open_read(Continuation *cont, const CacheKey *key, CacheFragType type, co } ink_assert(caches[type] == this); - Stripe *stripe = key_to_vol(key, hostname, host_len); + Stripe *stripe = key_to_stripe(key, hostname, host_len); Dir result, *last_collision = nullptr; ProxyMutex *mutex = cont->mutex.get(); OpenDirEntry *od = nullptr; @@ -115,7 +115,7 @@ Cache::open_read(Continuation *cont, const CacheKey *key, CacheHTTPHdr *request, } ink_assert(caches[type] == this); - Stripe *stripe = key_to_vol(key, hostname, host_len); + Stripe *stripe = key_to_stripe(key, hostname, host_len); Dir result, *last_collision = nullptr; ProxyMutex *mutex = cont->mutex.get(); OpenDirEntry *od = nullptr; diff --git a/src/iocore/cache/CacheTest.cc b/src/iocore/cache/CacheTest.cc index ac471818a4..f3f72520ac 100644 --- a/src/iocore/cache/CacheTest.cc +++ b/src/iocore/cache/CacheTest.cc @@ -550,7 +550,7 @@ test_RamCache(RegressionTest *t, RamCache *cache, const char *name, int64_t cach { bool pass = true; CacheKey key; - Stripe *stripe = theCache->key_to_vol(&key, "example.com", sizeof("example.com") - 1); + Stripe *stripe = theCache->key_to_stripe(&key, "example.com", sizeof("example.com") - 1); std::vector<Ptr<IOBufferData>> data; cache->init(cache_size, stripe); diff --git a/src/iocore/cache/CacheWrite.cc b/src/iocore/cache/CacheWrite.cc index 4039ad8076..f948c5a31f 100644 --- a/src/iocore/cache/CacheWrite.cc +++ b/src/iocore/cache/CacheWrite.cc @@ -1558,7 +1558,7 @@ Cache::open_write(Continuation *cont, const CacheKey *key, CacheFragType frag_ty SCOPED_MUTEX_LOCK(lock, c->mutex, this_ethread()); c->vio.op = VIO::WRITE; c->op_type = static_cast<int>(CacheOpType::Write); - c->stripe = key_to_vol(key, hostname, host_len); + c->stripe = key_to_stripe(key, hostname, host_len); Stripe *stripe = c->stripe; Metrics::Gauge::increment(cache_rsb.status[c->op_type].active); Metrics::Gauge::increment(stripe->cache_vol->vol_rsb.status[c->op_type].active); @@ -1636,7 +1636,7 @@ Cache::open_write(Continuation *cont, const CacheKey *key, CacheHTTPInfo *info, } while (DIR_MASK_TAG(c->key.slice32(2)) == DIR_MASK_TAG(c->first_key.slice32(2))); c->earliest_key = c->key; c->frag_type = CACHE_FRAG_TYPE_HTTP; - c->stripe = key_to_vol(key, hostname, host_len); + c->stripe = key_to_stripe(key, hostname, host_len); Stripe *stripe = c->stripe; c->info = info; if (c->info && (uintptr_t)info != CACHE_ALLOW_MULTIPLE_WRITES) { diff --git a/src/iocore/cache/P_CacheInternal.h b/src/iocore/cache/P_CacheInternal.h index 8879ff80aa..ad31b8bb79 100644 --- a/src/iocore/cache/P_CacheInternal.h +++ b/src/iocore/cache/P_CacheInternal.h @@ -583,7 +583,7 @@ struct Cache { int open_done(); - Stripe *key_to_vol(const CacheKey *key, const char *hostname, int host_len); + Stripe *key_to_stripe(const CacheKey *key, const char *hostname, int host_len); Cache() {} };