summaryrefslogtreecommitdiffstats
path: root/include/util/types.h
diff options
context:
space:
mode:
authorDouglas B. Rumbaugh <dbr4@psu.edu>2024-02-09 14:06:59 -0500
committerGitHub <noreply@github.com>2024-02-09 14:06:59 -0500
commitbc0f3cca3a5b495fcae1d3ad8d09e6d714da5d30 (patch)
tree66333c55feb0ea8875a50e6dc07c8535d241bf1c /include/util/types.h
parent076e104b8672924c3d80cd1da2fdb5ebee1766ac (diff)
parent46885246313358a3b606eca139b20280e96db10e (diff)
downloaddynamic-extension-bc0f3cca3a5b495fcae1d3ad8d09e6d714da5d30.tar.gz
Merge pull request #1 from dbrumbaugh/new-buffer
Initial Concurrency Implementation
Diffstat (limited to 'include/util/types.h')
-rw-r--r--include/util/types.h59
1 files changed, 31 insertions, 28 deletions
diff --git a/include/util/types.h b/include/util/types.h
index 3010e78..a13bd95 100644
--- a/include/util/types.h
+++ b/include/util/types.h
@@ -1,54 +1,62 @@
/*
* 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.
+ * Distributed 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.
*
+ * Many of these types were used in the Practical Dynamic Extension for
+ * Sampling Indexes work, particularly for external storage and buffer
+ * pool systems. They aren't used now, but we're leaving them here to use
+ * them in the future, when we add this functionality into this system too.
*/
#pragma once
-#include <cstdlib>
#include <cstdint>
-#include <cstddef>
-#include <string>
+#include <cstdlib>
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;
-};
-
}