xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
test
jtx
directory.h
1
#pragma once
2
3
#include <test/jtx/Env.h>
4
5
#include <xrpl/basics/base_uint.h>
6
#include <xrpl/ledger/ApplyView.h>
7
#include <xrpl/protocol/Feature.h>
8
#include <xrpl/protocol/Keylet.h>
9
#include <xrpl/protocol/Protocol.h>
10
11
#include <
cstdint
>
12
#include <expected>
13
#include <
functional
>
14
#include <
limits
>
15
19
namespace
xrpl::test::jtx::directory
{
20
21
enum class
Error
{
22
DirectoryRootNotFound
,
23
DirectoryTooSmall
,
24
DirectoryPageDuplicate
,
25
DirectoryPageNotFound
,
26
InvalidLastPage
,
27
AdjustmentError
28
};
29
40
auto
41
bumpLastPage
(
42
Env
& env,
43
std::uint64_t
newLastPage,
44
Keylet
directory
,
45
std::function
<
bool
(
ApplyView
&,
UInt256
,
std::uint64_t
)> adjust) -> std::expected<void, Error>;
46
53
bool
54
adjustOwnerNode
(
ApplyView
& view,
UInt256
key,
std::uint64_t
page);
55
56
inline
auto
57
maximumPageIndex
(
Env
const
& env) ->
std::uint64_t
58
{
59
if
(env.
enabled
(fixDirectoryLimit))
60
return
std::numeric_limits<std::uint64_t>::max
();
61
return
kDirNodeMaxPages
- 1;
62
}
63
64
}
// namespace xrpl::test::jtx::directory
xrpl::ApplyView
Writeable view to a ledger, for applying a transaction.
Definition
ApplyView.h:141
xrpl::test::jtx::Env
A transaction testing environment.
Definition
Env.h:161
xrpl::test::jtx::Env::enabled
bool enabled(UInt256 feature) const
Definition
Env.h:886
cstdint
std::function
functional
std::uint64_t
limits
std::numeric_limits::max
T max(T... args)
xrpl::test::jtx::directory
Directory operations.
Definition
directory.h:19
xrpl::test::jtx::directory::Error
Error
Definition
directory.h:21
xrpl::test::jtx::directory::Error::InvalidLastPage
@ InvalidLastPage
Definition
directory.h:26
xrpl::test::jtx::directory::Error::DirectoryTooSmall
@ DirectoryTooSmall
Definition
directory.h:23
xrpl::test::jtx::directory::Error::DirectoryPageNotFound
@ DirectoryPageNotFound
Definition
directory.h:25
xrpl::test::jtx::directory::Error::DirectoryPageDuplicate
@ DirectoryPageDuplicate
Definition
directory.h:24
xrpl::test::jtx::directory::Error::DirectoryRootNotFound
@ DirectoryRootNotFound
Definition
directory.h:22
xrpl::test::jtx::directory::Error::AdjustmentError
@ AdjustmentError
Definition
directory.h:27
xrpl::test::jtx::directory::bumpLastPage
auto bumpLastPage(Env &env, std::uint64_t newLastPage, Keylet directory, std::function< bool(ApplyView &, UInt256, std::uint64_t)> adjust) -> std::expected< void, Error >
Move the position of the last page in the user's directory on open ledger to newLastPage.
Definition
directory.cpp:27
xrpl::test::jtx::directory::maximumPageIndex
auto maximumPageIndex(Env const &env) -> std::uint64_t
Definition
directory.h:57
xrpl::test::jtx::directory::adjustOwnerNode
bool adjustOwnerNode(ApplyView &view, UInt256 key, std::uint64_t page)
Implementation of adjust for the most common ledger entry, i.e.
Definition
directory.cpp:128
xrpl::kDirNodeMaxPages
constexpr std::uint64_t kDirNodeMaxPages
The maximum number of pages allowed in a directory.
Definition
Protocol.h:65
xrpl::UInt256
BaseUInt< 256 > UInt256
Definition
base_uint.h:580
xrpl::Keylet
A pair of SHAMap key and LedgerEntryType.
Definition
Keylet.h:20
Generated by
1.17.0