20#ifndef MMAPPED_VECTOR_H
21#define MMAPPED_VECTOR_H
59void mmap(
size_t length,
bool read_only);
102void add(
const T& value);
Append-only, mmap-backed vector of elements of type T.
void set(pg_uuid_t u, unsigned long i)
Unused overload kept for interface compatibility.
~MMappedVector()
Sync and unmap the file.
data_t * data
Pointer to the memory-mapped data header.
unsigned long nbElements() const
Return the number of elements currently stored.
static constexpr unsigned STARTING_CAPACITY
Initial number of element slots allocated.
void add(const T &value)
Append an element to the end of the vector.
void mmap(size_t length, bool read_only)
Map length bytes from the backing file.
int fd
File descriptor of the backing mmap file.
void grow()
Double the backing file and remap.
const T & operator[](unsigned long k) const
Read-only element access by index.
void sync()
Flush dirty pages to the backing file with msync().
Core types, constants, and utilities shared across ProvSQL.
On-disk layout stored at the start of the backing file.
unsigned long nb_elements
Number of elements currently stored.
T d[]
Flexible array of elements.
unsigned long capacity
Maximum elements before the next grow.