xrpld
Loading...
Searching...
No Matches
xrpl::node_store::Sequence Class Reference

Deterministic generator of a reproducible sequence of random NodeObjects. More...

#include <NodeStoreBench.h>

Collaboration diagram for xrpl::node_store::Sequence:

Public Member Functions

 Sequence (std::uint8_t prefix)
uint256 key (std::size_t n)
std::shared_ptr< NodeObjectobj (std::size_t n)
void batch (std::size_t n, Batch &b, std::size_t size)

Private Attributes

beast::xor_shift_engine gen_
std::uint8_t prefix_
std::discrete_distribution< std::uint32_tdType_
std::uniform_int_distribution< std::uint32_tdSize_

Static Private Attributes

static constexpr auto kMinSize = 250
static constexpr auto kMaxSize = 1250

Detailed Description

Deterministic generator of a reproducible sequence of random NodeObjects.

Indexing is stable: obj(n) and key(n) always return the same value for a given n, regardless of call order, because the engine is reseeded from n on every call.

Using different prefixes guarantees the two key spaces are disjoint for the fetch-miss workloads.

Definition at line 64 of file NodeStoreBench.h.

Constructor & Destructor Documentation

◆ Sequence()

xrpl::node_store::Sequence::Sequence ( std::uint8_t prefix)
explicit

Definition at line 76 of file NodeStoreBench.h.

Member Function Documentation

◆ key()

uint256 xrpl::node_store::Sequence::key ( std::size_t n)

Definition at line 89 of file NodeStoreBench.h.

◆ obj()

std::shared_ptr< NodeObject > xrpl::node_store::Sequence::obj ( std::size_t n)

Definition at line 101 of file NodeStoreBench.h.

◆ batch()

void xrpl::node_store::Sequence::batch ( std::size_t n,
Batch & b,
std::size_t size )

Definition at line 116 of file NodeStoreBench.h.

Member Data Documentation

◆ kMinSize

auto xrpl::node_store::Sequence::kMinSize = 250
staticconstexprprivate

Definition at line 67 of file NodeStoreBench.h.

◆ kMaxSize

auto xrpl::node_store::Sequence::kMaxSize = 1250
staticconstexprprivate

Definition at line 68 of file NodeStoreBench.h.

◆ gen_

beast::xor_shift_engine xrpl::node_store::Sequence::gen_
private

Definition at line 70 of file NodeStoreBench.h.

◆ prefix_

std::uint8_t xrpl::node_store::Sequence::prefix_
private

Definition at line 71 of file NodeStoreBench.h.

◆ dType_

std::discrete_distribution<std::uint32_t> xrpl::node_store::Sequence::dType_
private

Definition at line 72 of file NodeStoreBench.h.

◆ dSize_

std::uniform_int_distribution<std::uint32_t> xrpl::node_store::Sequence::dSize_
private

Definition at line 73 of file NodeStoreBench.h.