summaryrefslogtreecommitdiffstats
path: root/include/util
diff options
context:
space:
mode:
authorDouglas Rumbaugh <dbr4@psu.edu>2023-05-08 13:30:20 -0400
committerDouglas Rumbaugh <dbr4@psu.edu>2023-05-08 13:30:20 -0400
commit5b1960ccbdda1a99ccd22638bb4721ee5c4c3331 (patch)
tree5cae945f9c3e2713f091dccfb93108d186639711 /include/util
parent4c2e16fee80d1f2370d37b67b06f0c09cfa8d66d (diff)
downloaddynamic-extension-5b1960ccbdda1a99ccd22638bb4721ee5c4c3331.tar.gz
Record.h: Renamed record_t to Record for POSIX compliance.
Required for compliance with POSIX B.2.12. The other _t types, key_t, val_t, header_t, etc. will be revised later when switching over to a templated version of this code.
Diffstat (limited to 'include/util')
-rw-r--r--include/util/Cursor.h14
-rw-r--r--include/util/Record.h (renamed from include/util/record.h)10
-rw-r--r--include/util/internal_record.h2
3 files changed, 13 insertions, 13 deletions
diff --git a/include/util/Cursor.h b/include/util/Cursor.h
index 3f5f20f..2879830 100644
--- a/include/util/Cursor.h
+++ b/include/util/Cursor.h
@@ -10,13 +10,13 @@
#pragma once
#include "util/base.h"
-#include "util/record.h"
+#include "util/Record.h"
#include "io/PagedFile.h"
namespace de {
struct Cursor {
- record_t *ptr;
- const record_t *end;
+ Record *ptr;
+ const Record *end;
size_t cur_rec_idx;
size_t rec_cnt;
@@ -45,8 +45,8 @@ inline static bool advance_cursor(Cursor *cur, PagedFileIterator *iter = nullptr
if (cur->ptr >= cur->end) {
if (iter && iter->next()) {
- cur->ptr = (record_t*)iter->get_item();
- cur->end = cur->ptr + (PAGE_SIZE / sizeof(record_t));
+ cur->ptr = (Record*)iter->get_item();
+ cur->end = cur->ptr + (PAGE_SIZE / sizeof(Record));
return true;
}
@@ -63,12 +63,12 @@ inline static bool advance_cursor(Cursor *cur, PagedFileIterator *iter = nullptr
* largest is processed.
*/
inline static Cursor *get_next(std::vector<Cursor> &cursors, Cursor *current=&g_empty_cursor) {
- const record_t *min_rec = nullptr;
+ const Record *min_rec = nullptr;
Cursor *result = &g_empty_cursor;
for (size_t i=0; i< cursors.size(); i++) {
if (cursors[i] == g_empty_cursor) continue;
- const record_t *rec = (&cursors[i] == current) ? cursors[i].ptr + 1 : cursors[i].ptr;
+ const Record *rec = (&cursors[i] == current) ? cursors[i].ptr + 1 : cursors[i].ptr;
if (rec >= cursors[i].end) continue;
if (min_rec == nullptr) {
diff --git a/include/util/record.h b/include/util/Record.h
index 0ba0f97..7e64959 100644
--- a/include/util/record.h
+++ b/include/util/Record.h
@@ -20,7 +20,7 @@ typedef uint64_t key_t;
typedef uint32_t value_t;
typedef uint64_t weight_t;
-struct record_t {
+struct Record {
key_t key;
value_t value;
hdr_t header;
@@ -42,11 +42,11 @@ struct record_t {
return header & 1;
}
- inline int match(const record_t* other) const {
+ inline int match(const Record* other) const {
return key == other->key && value == other->value;
}
- inline bool operator<(const record_t& other) const {
+ inline bool operator<(const Record& other) const {
return key < other.key || (key == other.key && value < other.value);
}
@@ -55,9 +55,9 @@ struct record_t {
}
};
-static_assert(sizeof(record_t) == 24, "Record is not 24 bytes long.");
+static_assert(sizeof(Record) == 24, "Record is not 24 bytes long.");
-static bool memtable_record_cmp(const record_t& a, const record_t& b) {
+static bool memtable_record_cmp(const Record& a, const Record& b) {
return (a.key < b.key) || (a.key == b.key && a.value < b.value)
|| (a.key == b.key && a.value == b.value && a.header < b.header);
}
diff --git a/include/util/internal_record.h b/include/util/internal_record.h
index d898b8b..003cddb 100644
--- a/include/util/internal_record.h
+++ b/include/util/internal_record.h
@@ -9,7 +9,7 @@
#pragma once
#pragma once
-#include "util/record.h"
+#include "util/Record.h"
#include "util/types.h"
/*