1//===----------------------------------------------------------------------===//
2// DuckDB
3//
4// duckdb/storage/table/segment_base.hpp
5//
6//
7//===----------------------------------------------------------------------===//
8
9#pragma once
10
11#include "duckdb/common/constants.hpp"
12#include "duckdb/common/atomic.hpp"
13
14namespace duckdb {
15
16template <class T>
17class SegmentBase {
18public:
19 SegmentBase(idx_t start, idx_t count) : start(start), count(count), next(nullptr) {
20 }
21 T *Next() {
22#ifndef DUCKDB_R_BUILD
23 return next.load();
24#else
25 return next;
26#endif
27 }
28
29 //! The start row id of this chunk
30 idx_t start;
31 //! The amount of entries in this storage chunk
32 atomic<idx_t> count;
33 //! The next segment after this one
34#ifndef DUCKDB_R_BUILD
35 atomic<T *> next;
36#else
37 T *next;
38#endif
39 //! The index within the segment tree
40 idx_t index;
41};
42
43} // namespace duckdb
44