|
taco-db
0.1.0
|
This file contains all the basic definitions in TDB. More...
#include "config.h"#include <cstdlib>#include <memory>#include <iostream>#include <fstream>#include <cstring>#include <cstddef>#include <cstdint>#include <cstdio>#include <cctype>#include <new>#include <string>#include <vector>#include <utility>#include <functional>#include <limits>#include "base/atomics.h"#include <absl/base/macros.h>#include <absl/memory/memory.h>#include <absl/strings/string_view.h>#include <absl/strings/str_cat.h>#include "base/logging.h"#include "utils/misc.h"#include "base/datum.h"#include "base/fmgr.h"Go to the source code of this file.
Classes | |
| struct | AlignedAllocImpl::FreeMem |
| struct | AlignedAllocImpl::aligned_allocator< alignment, T > |
| struct | AlignedAllocImpl::aligned_allocator< alignment, T >::rebind< U > |
Namespaces | |
| AlignedAllocImpl | |
| taco | |
Macros | |
| #define | ASSERT(...) |
| #define | FIELDOFFSET_FORMAT "%hd" |
| #define | FIELDID_FORMAT "%hd" |
| #define | OID_FORMAT "%u" |
| #define | FILEID_FORMAT "%u" |
| #define | PAGENUMBER_FORMAT "0x%08X" |
| #define | SLOTID_FORMAT "%hu" |
| #define | BUFFERID_FORMAT "%lu" |
| #define | SHORTALIGN(LEN) TYPEALIGN(2, (LEN)) |
| #define | INTALIGN(LEN) TYPEALIGN(4, (LEN)) |
| #define | LONGALIGN(LEN) TYPEALIGN(8, (LEN)) |
| #define | DOUBLEALIGN(LEN) TYPEALIGN(8, (LEN)) |
| #define | MAXALIGN(LEN) TYPEALIGN(8, (LEN)) |
| #define | CACHELINEALIGN(LEN) TYPEALIGN(CACHELINE_SIZE, (LEN)) |
| #define | MAXALIGN_OF 8 |
| #define | SHORTALIGN_DOWN(LEN) TYPEALIGN_DOWN(2, (LEN)) |
| #define | INTALIGN_DOWN(LEN) TYPEALIGN_DOWN(4, (LEN)) |
| #define | LONGALIGN_DOWN(LEN) TYPEALIGN_DOWN(8, (LEN)) |
| #define | DOUBLEALIGN_DOWN(LEN) TYPEALIGN_DOWN(8, (LEN)) |
| #define | MAXALIGN_DOWN(LEN) TYPEALIGN_DOWN(8, (LEN)) |
| #define | BUFFERALIGN_DOWN(LEN) TYPEALIGN_DOWN(CACHELINE_SIZE, (LEN)) |
| #define | RETURN_IF(...) |
| RETURN_IF(<cond> [, <optional_expr>]);. More... | |
| #define | FLEXIBLE_ARRAY_MEMBER -1 |
| Disallow FAM by declaring a negative-length array. More... | |
Typedefs | |
| typedef std::unique_ptr< void, AlignedAllocImpl::FreeMem > | unique_malloced_ptr |
| using | maxaligned_char_buf = std::vector< char, AlignedAllocImpl::aligned_allocator< 8, char > > |
| typedef uint32_t | taco::Oid |
| typedef int16_t | taco::FieldOffset |
| typedef int16_t | taco::FieldId |
| typedef uint32_t | taco::PageNumber |
| typedef uint64_t | taco::BufferId |
| typedef uint32_t | taco::FileId |
| The file ID. More... | |
| typedef uint16_t | taco::SlotId |
| typedef uint8_t | taco::IdxType |
| The index type, see index/idxtyps.h. More... | |
| typedef uint8_t | taco::OpType |
| The operator type, see expr/optypes.h. More... | |
| typedef uint8_t | taco::AggType |
| The aggregation type, see catalog/aggtyp.h. More... | |
Functions | |
| template<class T , class U > | |
| static std::shared_ptr< T > | reinterpret_pointer_cast (const std::shared_ptr< U > &p) |
| template<class T > | |
| constexpr T | taco::TYPEALIGN (uint64_t ALIGNVAL, T LEN) |
| These alignment macros are derived from PostgreSQL. More... | |
| unique_malloced_ptr | unique_aligned_alloc (size_t alignment, size_t size) |
| Wraps an aligned_alloced'd memory space in a std::unique_ptr. More... | |
| unique_malloced_ptr | wrap_malloc (void *ptr) |
| unique_malloced_ptr | unique_malloc (size_t size) |
| template<class T > | |
| constexpr T | taco::TYPEALIGN_DOWN (uint64_t ALIGNVAL, T LEN) |
| template<class T , class U > | |
| bool | taco::AddWithCheck (T &left, U right) |
| template<class T > | |
| std::enable_if<!std::is_same< typename std::decay< T >::type, absl::string_view >::value, T && >::type | cast_as_string (T &&t) |
| template<class T > | |
| std::enable_if< std::is_same< typename std::decay< T >::type, absl::string_view >::value, std::string >::type | cast_as_string (T t) |
Variables | |
| constexpr const size_t | CACHELINE_SIZE = L1_CACHELINE_SIZE |
| constexpr const size_t | PAGE_SIZE = CONFIG_PAGE_SIZE |
| constexpr Oid | taco::InvalidOid = 0 |
| constexpr FieldId | taco::InvalidFieldId = 0x7fff |
| constexpr FieldId | taco::MaxNumRegularFieldId = 0x7fff |
| constexpr int | taco::PageNumberBits = 32 |
| constexpr int | taco::FieldOffsetBits = logn_ceil(PAGE_SIZE) |
| constexpr FieldOffset | taco::MaxFieldOffset = (1 << FieldOffsetBits) - 1 |
| constexpr PageNumber | taco::INVALID_PID = 0 |
| The invalid page number. More... | |
| constexpr PageNumber | taco::RESERVED_PID = ~(PageNumber) 0 |
| An invalid page number reserved for file manager internal use. More... | |
| constexpr PageNumber | taco::MaxPageNumber |
| The maximum valid page number. More... | |
| constexpr SlotId | taco::INVALID_SID = 0 |
| The invalid slot ID. More... | |
| constexpr SlotId | taco::MinSlotId = 1 |
| The minimum valid slot ID. More... | |
| constexpr SlotId | taco::MaxSlotId = (~(SlotId) 0) - 1 |
| The maximum valid slot ID. More... | |
| constexpr BufferId | taco::INVALID_BUFID = ~(BufferId) 0 |
| constexpr Oid | taco::MaxOid = std::numeric_limits<Oid>::max() - 1 |
| The largest valid Oid. More... | |
This file contains all the basic definitions in TDB.
TDB is a C++11 project and we try to avoid any non-standard code that relies on compiler extensions, e.g., we try to avoid flexible array members if possible (which are C99 compliant but not C++11 compliant unfortunately).
| #define ASSERT | ( | ... | ) |
| #define BUFFERALIGN_DOWN | ( | LEN | ) | TYPEALIGN_DOWN(CACHELINE_SIZE, (LEN)) |
| #define BUFFERID_FORMAT "%lu" |
| #define CACHELINEALIGN | ( | LEN | ) | TYPEALIGN(CACHELINE_SIZE, (LEN)) |
| #define DOUBLEALIGN | ( | LEN | ) | TYPEALIGN(8, (LEN)) |
| #define DOUBLEALIGN_DOWN | ( | LEN | ) | TYPEALIGN_DOWN(8, (LEN)) |
| #define FIELDID_FORMAT "%hd" |
| #define FIELDOFFSET_FORMAT "%hd" |
| #define FILEID_FORMAT "%u" |
| #define FLEXIBLE_ARRAY_MEMBER -1 |
Disallow FAM by declaring a negative-length array.
The reason that macro exists is that we want to make sure we don't accidentally include any FAM from PostgreSQL source code.
| #define INTALIGN | ( | LEN | ) | TYPEALIGN(4, (LEN)) |
| #define INTALIGN_DOWN | ( | LEN | ) | TYPEALIGN_DOWN(4, (LEN)) |
| #define LONGALIGN | ( | LEN | ) | TYPEALIGN(8, (LEN)) |
| #define LONGALIGN_DOWN | ( | LEN | ) | TYPEALIGN_DOWN(8, (LEN)) |
| #define MAXALIGN | ( | LEN | ) | TYPEALIGN(8, (LEN)) |
| #define MAXALIGN_DOWN | ( | LEN | ) | TYPEALIGN_DOWN(8, (LEN)) |
| #define MAXALIGN_OF 8 |
| #define OID_FORMAT "%u" |
| #define PAGENUMBER_FORMAT "0x%08X" |
| #define RETURN_IF | ( | ... | ) |
RETURN_IF(<cond> [, <optional_expr>]);.
<expr> is evaluated once. If the result is false, this macro expands into a return statement with the optional expr as the return value.
| #define SHORTALIGN | ( | LEN | ) | TYPEALIGN(2, (LEN)) |
| #define SHORTALIGN_DOWN | ( | LEN | ) | TYPEALIGN_DOWN(2, (LEN)) |
| #define SLOTID_FORMAT "%hu" |
| using maxaligned_char_buf = std::vector<char, AlignedAllocImpl::aligned_allocator<8, char> > |
| typedef std::unique_ptr<void, AlignedAllocImpl::FreeMem> unique_malloced_ptr |
| std::enable_if<!std::is_same<typename std::decay<T>::type, absl::string_view>::value, T&&>::type cast_as_string | ( | T && | t | ) |
| std::enable_if<std::is_same<typename std::decay<T>::type, absl::string_view>::value, std::string>::type cast_as_string | ( | T | t | ) |
|
inlinestatic |
|
inline |
Wraps an aligned_alloced'd memory space in a std::unique_ptr.
It will be deallocated using free(3) instead of delete expression.
|
inline |
|
inline |
|
constexpr |
|
constexpr |