Coverage Report

Created: 2026-05-31 07:45

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/rocksdb/cache/cache_helpers.cc
Line
Count
Source
1
//  Copyright (c) Meta Platforms, Inc. and affiliates.
2
//  This source code is licensed under both the GPLv2 (found in the
3
//  COPYING file in the root directory) and Apache 2.0 License
4
//  (found in the LICENSE.Apache file in the root directory).
5
6
#include "cache/cache_helpers.h"
7
8
namespace ROCKSDB_NAMESPACE {
9
10
21.0k
void ReleaseCacheHandleCleanup(void* arg1, void* arg2) {
11
21.0k
  Cache* const cache = static_cast<Cache*>(arg1);
12
21.0k
  assert(cache);
13
14
21.0k
  Cache::Handle* const cache_handle = static_cast<Cache::Handle*>(arg2);
15
21.0k
  assert(cache_handle);
16
17
21.0k
  cache->Release(cache_handle);
18
21.0k
}
19
20
Status WarmInCache(Cache* cache, const Slice& key, const Slice& saved,
21
                   Cache::CreateContext* create_context,
22
                   const Cache::CacheItemHelper* helper,
23
0
                   Cache::Priority priority, size_t* out_charge) {
24
0
  assert(helper);
25
0
  assert(helper->create_cb);
26
0
  Cache::ObjectPtr value;
27
0
  size_t charge;
28
0
  Status st = helper->create_cb(saved, CompressionType::kNoCompression,
29
0
                                CacheTier::kVolatileTier, create_context,
30
0
                                cache->memory_allocator(), &value, &charge);
31
0
  if (st.ok()) {
32
0
    st =
33
0
        cache->Insert(key, value, helper, charge, /*handle*/ nullptr, priority);
34
0
    if (out_charge) {
35
0
      *out_charge = charge;
36
0
    }
37
0
  }
38
0
  return st;
39
0
}
40
41
}  // namespace ROCKSDB_NAMESPACE