Skip to content

Commit adf0ff0

Browse files
committed
fix: lint
1 parent da03915 commit adf0ff0

4 files changed

Lines changed: 38 additions & 38 deletions

File tree

src/types/cuckoo_filter_page.cc

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ rocksdb::Status CuckooPageSet::TryInsertInCandidateBuckets(uint16_t filter_index
6868
uint8_t fingerprint, bool *inserted) {
6969
*inserted = false;
7070
BucketRef bucket1, bucket2;
71-
auto s = EnsureCandidateBucketsLoaded(filter_index, num_buckets, bucket1_index, bucket2_index, &bucket1, &bucket2);
71+
auto s = ensureCandidateBucketsLoaded(filter_index, num_buckets, bucket1_index, bucket2_index, &bucket1, &bucket2);
7272
if (!s.ok()) return s;
7373

7474
size_t slot_idx = 0;
75-
if (TryInsertInBucketRef(bucket1, fingerprint, &slot_idx)) {
75+
if (tryInsertInBucketRef(bucket1, fingerprint, &slot_idx)) {
7676
*inserted = true;
7777
return rocksdb::Status::OK();
7878
}
79-
if (bucket1_index != bucket2_index && TryInsertInBucketRef(bucket2, fingerprint, &slot_idx)) {
79+
if (bucket1_index != bucket2_index && tryInsertInBucketRef(bucket2, fingerprint, &slot_idx)) {
8080
*inserted = true;
8181
}
8282
return rocksdb::Status::OK();
@@ -86,11 +86,11 @@ rocksdb::Status CuckooPageSet::TryInsertInBucket(uint16_t filter_index, uint32_t
8686
uint8_t fingerprint, bool *inserted) {
8787
*inserted = false;
8888
BucketRef bucket;
89-
auto s = EnsureBucketLoaded(filter_index, num_buckets, bucket_index, &bucket);
89+
auto s = ensureBucketLoaded(filter_index, num_buckets, bucket_index, &bucket);
9090
if (!s.ok()) return s;
9191

9292
size_t slot_idx = 0;
93-
*inserted = TryInsertInBucketRef(bucket, fingerprint, &slot_idx);
93+
*inserted = tryInsertInBucketRef(bucket, fingerprint, &slot_idx);
9494
return rocksdb::Status::OK();
9595
}
9696

@@ -99,9 +99,9 @@ rocksdb::Status CuckooPageSet::GetBucketSlot(uint16_t filter_index, uint32_t num
9999
if (slot_idx >= metadata_.bucket_size) return rocksdb::Status::InvalidArgument("invalid cuckoo filter bucket slot");
100100

101101
BucketRef bucket;
102-
auto s = EnsureBucketLoaded(filter_index, num_buckets, bucket_index, &bucket);
102+
auto s = ensureBucketLoaded(filter_index, num_buckets, bucket_index, &bucket);
103103
if (!s.ok()) return s;
104-
*fingerprint = GetBucketRefSlot(bucket, slot_idx);
104+
*fingerprint = getBucketRefSlot(bucket, slot_idx);
105105
return rocksdb::Status::OK();
106106
}
107107

@@ -110,9 +110,9 @@ rocksdb::Status CuckooPageSet::SetBucketSlot(uint16_t filter_index, uint32_t num
110110
if (slot_idx >= metadata_.bucket_size) return rocksdb::Status::InvalidArgument("invalid cuckoo filter bucket slot");
111111

112112
BucketRef bucket;
113-
auto s = EnsureBucketLoaded(filter_index, num_buckets, bucket_index, &bucket);
113+
auto s = ensureBucketLoaded(filter_index, num_buckets, bucket_index, &bucket);
114114
if (!s.ok()) return s;
115-
SetBucketRefSlot(bucket, slot_idx, fingerprint);
115+
setBucketRefSlot(bucket, slot_idx, fingerprint);
116116
return rocksdb::Status::OK();
117117
}
118118

@@ -125,7 +125,7 @@ rocksdb::Status CuckooPageSet::WriteBackDirtyPages(rocksdb::WriteBatchBase *batc
125125
return rocksdb::Status::OK();
126126
}
127127

128-
rocksdb::Status CuckooPageSet::ResolveBucketLocation(uint16_t filter_index, uint32_t num_buckets, uint32_t bucket_index,
128+
rocksdb::Status CuckooPageSet::resolveBucketLocation(uint16_t filter_index, uint32_t num_buckets, uint32_t bucket_index,
129129
BucketLocation *location) const {
130130
if (metadata_.bucket_size == 0 || num_buckets == 0 || bucket_index >= num_buckets) {
131131
return rocksdb::Status::Corruption("invalid cuckoo filter bucket location");
@@ -139,14 +139,14 @@ rocksdb::Status CuckooPageSet::ResolveBucketLocation(uint16_t filter_index, uint
139139
return rocksdb::Status::OK();
140140
}
141141

142-
rocksdb::Status CuckooPageSet::EnsureBucketLoaded(uint16_t filter_index, uint32_t num_buckets, uint32_t bucket_index,
142+
rocksdb::Status CuckooPageSet::ensureBucketLoaded(uint16_t filter_index, uint32_t num_buckets, uint32_t bucket_index,
143143
BucketRef *bucket) {
144144
BucketLocation location;
145-
auto s = ResolveBucketLocation(filter_index, num_buckets, bucket_index, &location);
145+
auto s = resolveBucketLocation(filter_index, num_buckets, bucket_index, &location);
146146
if (!s.ok()) return s;
147147

148148
PageEntry *page = nullptr;
149-
s = LoadPage(location, &page);
149+
s = loadPage(location, &page);
150150
if (!s.ok()) return s;
151151

152152
bucket->page = page;
@@ -155,21 +155,21 @@ rocksdb::Status CuckooPageSet::EnsureBucketLoaded(uint16_t filter_index, uint32_
155155
return rocksdb::Status::OK();
156156
}
157157

158-
rocksdb::Status CuckooPageSet::EnsureCandidateBucketsLoaded(uint16_t filter_index, uint32_t num_buckets,
158+
rocksdb::Status CuckooPageSet::ensureCandidateBucketsLoaded(uint16_t filter_index, uint32_t num_buckets,
159159
uint32_t bucket1_index, uint32_t bucket2_index,
160160
BucketRef *bucket1, BucketRef *bucket2) {
161161
BucketLocation location1, location2;
162-
auto s = ResolveBucketLocation(filter_index, num_buckets, bucket1_index, &location1);
162+
auto s = resolveBucketLocation(filter_index, num_buckets, bucket1_index, &location1);
163163
if (!s.ok()) return s;
164-
s = ResolveBucketLocation(filter_index, num_buckets, bucket2_index, &location2);
164+
s = resolveBucketLocation(filter_index, num_buckets, bucket2_index, &location2);
165165
if (!s.ok()) return s;
166166

167167
std::vector<BucketLocation> missing_locations;
168168
if (pages_.find(location1.page_key) == pages_.end()) missing_locations.push_back(location1);
169169
if (location2.page_key != location1.page_key && pages_.find(location2.page_key) == pages_.end()) {
170170
missing_locations.push_back(location2);
171171
}
172-
s = LoadPages(missing_locations);
172+
s = loadPages(missing_locations);
173173
if (!s.ok()) return s;
174174

175175
bucket1->page = &pages_.at(location1.page_key);
@@ -181,7 +181,7 @@ rocksdb::Status CuckooPageSet::EnsureCandidateBucketsLoaded(uint16_t filter_inde
181181
return rocksdb::Status::OK();
182182
}
183183

184-
rocksdb::Status CuckooPageSet::LoadPage(const BucketLocation &location, PageEntry **page) {
184+
rocksdb::Status CuckooPageSet::loadPage(const BucketLocation &location, PageEntry **page) {
185185
auto iter = pages_.find(location.page_key);
186186
if (iter != pages_.end()) {
187187
*page = &iter->second;
@@ -191,19 +191,19 @@ rocksdb::Status CuckooPageSet::LoadPage(const BucketLocation &location, PageEntr
191191
PageEntry page_entry;
192192
auto s = storage_->Get(ctx_, ctx_.GetReadOptions(), location.page_key, &page_entry.data);
193193
if (!s.ok() && !s.IsNotFound()) return s;
194-
s = NormalizePage(s, location.expected_page_size, &page_entry);
194+
s = normalizePage(s, location.expected_page_size, &page_entry);
195195
if (!s.ok()) return s;
196196

197197
auto result = pages_.emplace(location.page_key, std::move(page_entry));
198198
*page = &result.first->second;
199199
return rocksdb::Status::OK();
200200
}
201201

202-
rocksdb::Status CuckooPageSet::LoadPages(const std::vector<BucketLocation> &locations) {
202+
rocksdb::Status CuckooPageSet::loadPages(const std::vector<BucketLocation> &locations) {
203203
if (locations.empty()) return rocksdb::Status::OK();
204204
if (locations.size() == 1) {
205205
PageEntry *page = nullptr;
206-
return LoadPage(locations[0], &page);
206+
return loadPage(locations[0], &page);
207207
}
208208

209209
std::vector<rocksdb::Slice> keys;
@@ -218,14 +218,14 @@ rocksdb::Status CuckooPageSet::LoadPages(const std::vector<BucketLocation> &loca
218218
for (size_t i = 0; i < locations.size(); ++i) {
219219
PageEntry page_entry;
220220
if (statuses[i].ok()) page_entry.data.assign(values[i].data(), values[i].size());
221-
auto s = NormalizePage(statuses[i], locations[i].expected_page_size, &page_entry);
221+
auto s = normalizePage(statuses[i], locations[i].expected_page_size, &page_entry);
222222
if (!s.ok()) return s;
223223
pages_.emplace(locations[i].page_key, std::move(page_entry));
224224
}
225225
return rocksdb::Status::OK();
226226
}
227227

228-
rocksdb::Status CuckooPageSet::NormalizePage(const rocksdb::Status &status, uint32_t expected_size,
228+
rocksdb::Status CuckooPageSet::normalizePage(const rocksdb::Status &status, uint32_t expected_size,
229229
PageEntry *page) const {
230230
if (!status.ok() && !status.IsNotFound()) return status;
231231
if (status.IsNotFound()) page->data.clear();
@@ -234,7 +234,7 @@ rocksdb::Status CuckooPageSet::NormalizePage(const rocksdb::Status &status, uint
234234
return rocksdb::Status::OK();
235235
}
236236

237-
bool CuckooPageSet::TryInsertInBucketRef(const BucketRef &bucket, uint8_t fingerprint, size_t *slot_idx) {
237+
bool CuckooPageSet::tryInsertInBucketRef(const BucketRef &bucket, uint8_t fingerprint, size_t *slot_idx) {
238238
for (size_t i = 0; i < bucket.size; ++i) {
239239
size_t offset = bucket.offset + i;
240240
if (static_cast<uint8_t>(bucket.page->data[offset]) == 0) {
@@ -247,11 +247,11 @@ bool CuckooPageSet::TryInsertInBucketRef(const BucketRef &bucket, uint8_t finger
247247
return false;
248248
}
249249

250-
uint8_t CuckooPageSet::GetBucketRefSlot(const BucketRef &bucket, uint32_t slot_idx) const {
250+
uint8_t CuckooPageSet::getBucketRefSlot(const BucketRef &bucket, uint32_t slot_idx) const {
251251
return static_cast<uint8_t>(bucket.page->data[bucket.offset + slot_idx]);
252252
}
253253

254-
void CuckooPageSet::SetBucketRefSlot(const BucketRef &bucket, uint32_t slot_idx, uint8_t fingerprint) {
254+
void CuckooPageSet::setBucketRefSlot(const BucketRef &bucket, uint32_t slot_idx, uint8_t fingerprint) {
255255
bucket.page->data[bucket.offset + slot_idx] = static_cast<char>(fingerprint);
256256
bucket.page->is_dirty = true;
257257
}

src/types/cuckoo_filter_page.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,19 @@ class CuckooPageSet {
6666
uint32_t expected_page_size = 0;
6767
};
6868

69-
rocksdb::Status ResolveBucketLocation(uint16_t filter_index, uint32_t num_buckets, uint32_t bucket_index,
69+
rocksdb::Status resolveBucketLocation(uint16_t filter_index, uint32_t num_buckets, uint32_t bucket_index,
7070
BucketLocation *location) const;
71-
rocksdb::Status EnsureBucketLoaded(uint16_t filter_index, uint32_t num_buckets, uint32_t bucket_index,
71+
rocksdb::Status ensureBucketLoaded(uint16_t filter_index, uint32_t num_buckets, uint32_t bucket_index,
7272
BucketRef *bucket);
73-
rocksdb::Status EnsureCandidateBucketsLoaded(uint16_t filter_index, uint32_t num_buckets, uint32_t bucket1_index,
73+
rocksdb::Status ensureCandidateBucketsLoaded(uint16_t filter_index, uint32_t num_buckets, uint32_t bucket1_index,
7474
uint32_t bucket2_index, BucketRef *bucket1, BucketRef *bucket2);
75-
rocksdb::Status LoadPage(const BucketLocation &location, PageEntry **page);
76-
rocksdb::Status LoadPages(const std::vector<BucketLocation> &locations);
77-
rocksdb::Status NormalizePage(const rocksdb::Status &status, uint32_t expected_size, PageEntry *page) const;
75+
rocksdb::Status loadPage(const BucketLocation &location, PageEntry **page);
76+
rocksdb::Status loadPages(const std::vector<BucketLocation> &locations);
77+
rocksdb::Status normalizePage(const rocksdb::Status &status, uint32_t expected_size, PageEntry *page) const;
7878

79-
bool TryInsertInBucketRef(const BucketRef &bucket, uint8_t fingerprint, size_t *slot_idx);
80-
uint8_t GetBucketRefSlot(const BucketRef &bucket, uint32_t slot_idx) const;
81-
void SetBucketRefSlot(const BucketRef &bucket, uint32_t slot_idx, uint8_t fingerprint);
79+
bool tryInsertInBucketRef(const BucketRef &bucket, uint8_t fingerprint, size_t *slot_idx);
80+
uint8_t getBucketRefSlot(const BucketRef &bucket, uint32_t slot_idx) const;
81+
void setBucketRefSlot(const BucketRef &bucket, uint32_t slot_idx, uint8_t fingerprint);
8282

8383
engine::Storage *storage_ = nullptr;
8484
engine::Context &ctx_;

src/types/redis_cuckoo_chain.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ rocksdb::Status CuckooChain::getCuckooChainMetadata(engine::Context &ctx, const
3333
return Database::GetMetadata(ctx, {kRedisCuckooFilter}, ns_key, metadata);
3434
}
3535

36-
rocksdb::Status CuckooChain::ValidateMetadata(const CuckooChainMetadata &metadata) {
36+
rocksdb::Status CuckooChain::validateMetadata(const CuckooChainMetadata &metadata) {
3737
if (metadata.n_filters == 0) {
3838
return rocksdb::Status::Corruption("invalid metadata: n_filters is 0");
3939
}
@@ -166,7 +166,7 @@ rocksdb::Status CuckooChain::Add(engine::Context &ctx, const Slice &user_key, co
166166
}
167167
if (!s.ok() && !s.IsNotFound()) return s;
168168

169-
s = ValidateMetadata(metadata);
169+
s = validateMetadata(metadata);
170170
if (!s.ok()) return s;
171171

172172
// Calculate hash and fingerprint for the item

src/types/redis_cuckoo_chain.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class CuckooChain : public Database {
4949
// Get metadata for the cuckoo filter
5050
rocksdb::Status getCuckooChainMetadata(engine::Context &ctx, const Slice &ns_key, CuckooChainMetadata *metadata);
5151

52-
static rocksdb::Status ValidateMetadata(const CuckooChainMetadata &metadata);
52+
static rocksdb::Status validateMetadata(const CuckooChainMetadata &metadata);
5353

5454
// Kick-out insertion: try to insert fingerprint by evicting existing ones
5555
rocksdb::Status kickOutInsert(engine::Context &ctx, const Slice &ns_key, const CuckooChainMetadata &metadata,

0 commit comments

Comments
 (0)