summaryrefslogtreecommitdiffstats
path: root/include/util
diff options
context:
space:
mode:
authorDouglas Rumbaugh <dbr4@psu.edu>2023-10-30 17:15:05 -0400
committerDouglas Rumbaugh <dbr4@psu.edu>2023-10-30 17:15:05 -0400
commitd2279e1b96d352a0af1d425dcaaf93e8a26a8d52 (patch)
tree4e8df98339ff5578deb8f8be46b9f6c3cc34cef4 /include/util
parent8ce1cb0eef7d5631f0f7788804845ddc8296ac6f (diff)
downloaddynamic-extension-d2279e1b96d352a0af1d425dcaaf93e8a26a8d52.tar.gz
General Comment + Consistency updates
Diffstat (limited to 'include/util')
-rw-r--r--include/util/Cursor.h4
-rw-r--r--include/util/bf_config.h20
-rw-r--r--include/util/types.h47
3 files changed, 47 insertions, 24 deletions
diff --git a/include/util/Cursor.h b/include/util/Cursor.h
index 1cf20e1..00afaab 100644
--- a/include/util/Cursor.h
+++ b/include/util/Cursor.h
@@ -1,11 +1,13 @@
/*
* include/util/Cursor.h
*
- * Copyright (C) 2023 Douglas Rumbaugh <drumbaugh@psu.edu>
+ * Copyright (C) 2023 Douglas B. Rumbaugh <drumbaugh@psu.edu>
* Dong Xie <dongx@psu.edu>
*
* All rights reserved. Published under the Modified BSD License.
*
+ * A simple record cursor type with associated methods for help in
+ * merging record sets when constructing shards.
*/
#pragma once
diff --git a/include/util/bf_config.h b/include/util/bf_config.h
index 2390643..4de465d 100644
--- a/include/util/bf_config.h
+++ b/include/util/bf_config.h
@@ -1,11 +1,17 @@
/*
* include/util/bf_config.h
*
- * Copyright (C) 2023 Douglas Rumbaugh <drumbaugh@psu.edu>
+ * Copyright (C) 2023 Douglas B. Rumbaugh <drumbaugh@psu.edu>
* Dong Xie <dongx@psu.edu>
*
* All rights reserved. Published under the Modified BSD License.
*
+ * Global parameters for configuring bloom filters used as auxiliary
+ * structures on shards within the framework. The bloom filters themselves
+ * can be found in
+ *
+ * $PROJECT_ROOT/external/psudb-common/cpp/include/psu-ds/BloomFilter.h
+ *
*/
#pragma once
@@ -13,13 +19,25 @@
namespace de {
+/* global variable for specifying bloom filter FPR */
static double BF_FPR = .01;
+
+/* global variable for specifying number of BF hash functions (k) */
static size_t BF_HASH_FUNCS = 7;
+/*
+ * Adjust the value of BF_FPR. The argument must be on the interval
+ * (0, 1), or the behavior of bloom filters is undefined.
+ */
static void BF_SET_FPR(double fpr) {
+
BF_FPR = fpr;
}
+/*
+ * Adjust the value of BF_HASH_FUNCS. The argument must be on the interval
+ * (0, INT64_MAX], or the behavior of bloom filters is undefined.
+ */
static void BF_SET_HASHFUNC(size_t func_cnt) {
BF_HASH_FUNCS = func_cnt;
}
diff --git a/include/util/types.h b/include/util/types.h
index 3010e78..b7f9607 100644
--- a/include/util/types.h
+++ b/include/util/types.h
@@ -1,11 +1,11 @@
/*
* include/util/types.h
*
- * Copyright (C) 2023 Douglas Rumbaugh <drumbaugh@psu.edu>
+ * Copyright (C) 2023 Douglas B. Rumbaugh <drumbaugh@psu.edu>
*
* All rights reserved. Published under the Modified BSD License.
*
- * A centralized header file for various datatypes used throughout the
+ * A centralized header file for various data types used throughout the
* code base. There are a few very specific types, such as header formats,
* that are defined within the header files that make direct use of them,
* but all generally usable, simple types are defined here.
@@ -22,33 +22,41 @@ namespace de {
using std::byte;
-// Represents a page offset within a specific file (physical or virtual)
+/* Represents a page offset within a specific file (physical or virtual) */
typedef uint32_t PageNum;
-// Byte offset within a page. Also used for lengths of records, etc.,
-// within the codebase. size_t isn't necessary, as the maximum offset
-// is only parm::PAGE_SIZE
+/*
+ * Byte offset within a page. Also used for lengths of records, etc.,
+ * within the codebase. size_t isn't necessary, as the maximum offset
+ * is only parm::PAGE_SIZE
+ */
typedef uint16_t PageOffset;
-// A unique identifier for a frame within a buffer or cache.
+/* A unique identifier for a frame within a buffer or cache */
typedef int32_t FrameId;
-// A unique timestamp for use in MVCC concurrency control. Currently stored in
-// record headers, but not used by anything.
+/*
+ * A unique timestamp for use in MVCC concurrency control. Currently stored in
+ * record headers, but not used by anything.
+ */
typedef uint32_t Timestamp;
const Timestamp TIMESTAMP_MIN = 0;
const Timestamp TIMESTAMP_MAX = UINT32_MAX;
-// Invalid values for various IDs. Used throughout the code base to indicate
-// uninitialized values and error conditions.
+/*
+ * 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_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
-// shard, and the shard_idx is the index with the level (always 0 in the
-// case of leveling). Note that the two vectors of levels are treated
-// as a contiguous index space.
+/*
+ * 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
+ * shard, and the shard_idx is the index with the level (always 0 in the
+ * case of leveling). Note that the two vectors of levels are treated
+ * as a contiguous index space.
+ */
struct ShardID {
ssize_t level_idx;
ssize_t shard_idx;
@@ -58,12 +66,7 @@ struct ShardID {
}
};
+/* A placeholder for an invalid shard--also used to indicate the mutable buffer */
const ShardID INVALID_SHID = {-1, -1};
-struct SampleRange {
- ShardID shid;
- size_t low;
- size_t high;
-};
-
}