From 3931c2b7faab3460f9fc3849ff3bdf9241052565 Mon Sep 17 00:00:00 2001 From: Douglas Rumbaugh Date: Wed, 7 Jun 2023 12:54:16 -0400 Subject: General header/file cleanup --- include/ds/BitArray.h | 2 +- include/ds/BloomFilter.h | 2 - include/ds/PriorityQueue.h | 3 -- include/framework/InternalLevel.h | 2 - include/shard/WIRS.h | 2 +- include/shard/WSS.h | 2 +- include/util/internal_record.h | 96 --------------------------------------- include/util/types.h | 4 +- 8 files changed, 5 insertions(+), 108 deletions(-) delete mode 100644 include/util/internal_record.h (limited to 'include') diff --git a/include/ds/BitArray.h b/include/ds/BitArray.h index 2d785f4..586561b 100644 --- a/include/ds/BitArray.h +++ b/include/ds/BitArray.h @@ -1,5 +1,5 @@ /* - * include/ds/BloomFilter.h + * include/ds/BitArray.h * * Copyright (C) 2023 Dong Xie * diff --git a/include/ds/BloomFilter.h b/include/ds/BloomFilter.h index 3d218cd..f7e1c08 100644 --- a/include/ds/BloomFilter.h +++ b/include/ds/BloomFilter.h @@ -13,8 +13,6 @@ #include "ds/BitArray.h" #include "util/hash.h" -#include "util/base.h" -#include "framework/RecordInterface.h" namespace de { diff --git a/include/ds/PriorityQueue.h b/include/ds/PriorityQueue.h index 0468fa4..a1bfd0a 100644 --- a/include/ds/PriorityQueue.h +++ b/include/ds/PriorityQueue.h @@ -12,8 +12,6 @@ #include #include -#include "framework/RecordInterface.h" - namespace de { template @@ -22,7 +20,6 @@ struct queue_record { size_t version; }; - template class PriorityQueue { public: diff --git a/include/framework/InternalLevel.h b/include/framework/InternalLevel.h index 3f41655..ac013c0 100644 --- a/include/framework/InternalLevel.h +++ b/include/framework/InternalLevel.h @@ -13,12 +13,10 @@ #include #include "util/types.h" -#include "util/bf_config.h" #include "framework/ShardInterface.h" #include "framework/QueryInterface.h" #include "framework/RecordInterface.h" #include "framework/MutableBuffer.h" -#include "ds/BloomFilter.h" namespace de { diff --git a/include/shard/WIRS.h b/include/shard/WIRS.h index ab72129..5c651af 100644 --- a/include/shard/WIRS.h +++ b/include/shard/WIRS.h @@ -1,8 +1,8 @@ /* - {s.get_tombstone_count()} -> std::convertible_to; * include/shard/WIRS.h * * Copyright (C) 2023 Dong Xie + * Douglas Rumbaugh * * All rights reserved. Published under the Modified BSD License. * diff --git a/include/shard/WSS.h b/include/shard/WSS.h index 9300932..aa6ebf0 100644 --- a/include/shard/WSS.h +++ b/include/shard/WSS.h @@ -1,8 +1,8 @@ /* - {s.get_tombstone_count()} -> std::convertible_to; * include/shard/WSS.h * * Copyright (C) 2023 Dong Xie + * Douglas Rumbaugh * * All rights reserved. Published under the Modified BSD License. * diff --git a/include/util/internal_record.h b/include/util/internal_record.h deleted file mode 100644 index 003cddb..0000000 --- a/include/util/internal_record.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * include/util/internal_record.h - * - * Copyright (C) 2023 Douglas Rumbaugh - * - * All rights reserved. Published under the Modified BSD License. - * - */ -#pragma once -#pragma once - -#include "util/Record.h" -#include "util/types.h" - -/* - * Utility functions for use in handling internal nodes within an ISAM - * tree. - */ - -namespace de { - -struct ISAMTreeInternalNodeHeader { - PageNum next_sibling; // INVALID_PNUM this is the last node on a level - PageNum prev_sibling; // INVALID_PNUM if this is the first node on a level - size_t leaf_rec_cnt; // number of records in leaf nodes under this node - size_t internal_rec_cnt; // number of internal records in this node -}; - -/* - * The total (aligned) size of an ISAMTreeInternalNodeHeader object. - */ -static constexpr PageOffset ISAMTreeInternalNodeHeaderSize = MAXALIGN(sizeof(ISAMTreeInternalNodeHeader)); - -/* - * The number of bytes occupied by an ISAM tree internal record, including alignment bytes. - */ -static constexpr size_t internal_record_size = sizeof(key_t) + MAXALIGN(sizeof(PageNum)); - -/* - * The maximum number of internal records that can be stored in an internal - * node, accounting for alignment and the node header. - */ -static constexpr size_t internal_records_per_page = (PAGE_SIZE - ISAMTreeInternalNodeHeaderSize) / internal_record_size; - -/* - * Format an internal record, starting in the first byte of buffer, with the - * specified key and target page number. If either buffer or key refer to - * memory regions of insufficient size, the results are undefined. - */ -static inline void build_internal_record(char *buffer, const char *key, PageNum target_page) { - memcpy(buffer, key, sizeof(key_t)); - memcpy(buffer + sizeof(key_t), &target_page, sizeof(PageNum)); -} - -/* - * Return the idx'th internal record within an internal node. - * internal_page_buffer must refer to the first byte of a page containing a - * full internal node, including the header. The returned value is undefined if - * idx is greater than or equal to the number of internal records within the - * node. - */ -static inline char *get_internal_record(char *internal_page_buffer, size_t idx) { - return internal_page_buffer + ISAMTreeInternalNodeHeaderSize + internal_record_size * idx; -} - -/* - * Return a pointer to the key contained within an internal record, pointed - * to by buffer. Buffer must point to the beginning of a valid internal record, - * or the result of this function is undefined. - */ -static inline const char *get_internal_key(const char *buffer) { - return buffer; -} - -/* - * Return the Page Number (value) of an internal record, pointed to by buffer. - * Buffer must point to the beginning of a valid internal record, or the result - * of this function is undefined. - */ -static inline PageNum get_internal_value(const char *buffer) { - return *((PageNum *) (buffer + sizeof(key_t))); -} - -/* - * Return a pointer to the header of an ISAM Tree internal node, referred to by - * buffer. If buffer contains multiple nodes, a specific node can be requested - * using the idx parameter, otherwise the header of the first node will be returned. - * Buffer must point to the beginning of a valid ISAM Tree internal node, and idx - * must be less than the number of internal nodes within the buffer, or the - * returned value is undefined. - */ -static inline ISAMTreeInternalNodeHeader *get_header(char *buffer, size_t idx=0) { - return (ISAMTreeInternalNodeHeader *) get_page(buffer, idx); -} - -} diff --git a/include/util/types.h b/include/util/types.h index 63da3fa..de5e379 100644 --- a/include/util/types.h +++ b/include/util/types.h @@ -44,7 +44,7 @@ const Timestamp TIMESTAMP_MAX = UINT32_MAX; // Invalid values for various IDs. Used throughout the code base to indicate // uninitialized values and error conditions. const PageNum INVALID_PNUM = 0; -const FrameId INVALID_Fshid = -1; +const FrameId INVALID_FRID = -1; // An ID for a given shard within the index. The level_idx is the index // in the memory_levels and disk_levels vectors corresponding to the @@ -63,7 +63,7 @@ struct ShardID { const ShardID INVALID_SHID = {-1, -1}; struct SampleRange { - ShardID run_id; + ShardID shid; size_t low; size_t high; }; -- cgit v1.2.3