Compare commits

..
Author SHA1 Message Date
Mayukha Vadari 930def8040 Merge remote-tracking branch 'upstream/develop' into pr6304-work
# Conflicts:
#	API-CHANGELOG.md
2026-09-22 23:55:05 +05:30
Mayukha Vadari 6558ce3d22 Merge remote-tracking branch 'upstream/develop' into copilot/add-augmented-submit-fields 2026-09-11 10:35:23 -04:00
Mayukha Vadari 4b2cd3637d Merge remote-tracking branch 'upstream/develop' into copilot/add-augmented-submit-fields 2026-09-04 10:45:14 -04:00
Mayukha Vadari 7f0190949a Merge remote-tracking branch 'upstream/develop' into copilot/add-augmented-submit-fields 2026-09-03 16:52:04 -04:00
Mayukha Vadari 73d2ed51c4 Merge branch 'develop' into copilot/add-augmented-submit-fields 2026-08-31 16:59:03 -04:00
Mayukha Vadari 5a76baabb3 Merge branch 'develop' into copilot/add-augmented-submit-fields 2026-08-17 22:02:17 -04:00
Mayukha Vadari 373952a62c Merge branch 'develop' into copilot/add-augmented-submit-fields 2026-08-12 11:07:38 -04:00
Ayaz Salikhov 739ef8639a build: Respect lld linker if it gets auto-selected (#8011) 2026-08-12 14:03:37 +00:00
Vito Tumas dc8973053e test: Fix LoanBatch broker cover rates and schedule overflow (#7967) 2026-08-12 13:42:55 +00:00
Timur Yalymov d06a03baa6 test: Verify private-vault DEX permissions survive domain loss (#7937) 2026-08-12 13:42:02 +00:00
Timur YalymovandCursor 050dbc628f refactor: Drop dead associateAsset calls from loan delete paths (#7986)
Co-authored-by: Cursor <[email protected]>
2026-08-12 13:41:30 +00:00
Mayukha Vadari 261b5201e0 fix: use lowercase rpc namespace after rename 2026-08-11 15:02:12 -04:00
Mayukha Vadari 890b2cfa17 Merge branch 'develop' into copilot/add-augmented-submit-fields 2026-08-11 14:21:43 -04:00
Mayukha Vadari f03f890511 Merge branch 'develop' into copilot/add-augmented-submit-fields 2026-08-10 14:53:17 -04:00
Mayukha Vadari 553a36ac6f Merge branch 'develop' into copilot/add-augmented-submit-fields 2026-07-27 15:39:37 -04:00
Mayukha Vadari e6d849dd01 fix pre-commit 2026-07-27 15:39:18 -04:00
Mayukha Vadari a1ac0a31de fix changelog 2026-07-21 18:41:28 -04:00
Mayukha Vadari 1368a1cdf1 fix clang-tidy 2026-07-21 18:40:38 -04:00
Mayukha Vadari 91724750fb fix build issues 2026-07-21 18:38:48 -04:00
Mayukha Vadari 8febef6777 Merge branch 'develop' into copilot/add-augmented-submit-fields 2026-07-21 17:59:01 -04:00
copilot-swe-agent[bot]andmvadari 3bc338211a Merge develop and resolve conflicts
- Updated Json::Value to json::Value (lowercase namespace)
- Updated safe_cast to safeCast
- Updated constant naming (e.g., defaultAutoFillFeeMultiplier to kDefaultAutoFillFeeMultiplier)
- Merged testAugmentedFields with testFailHardValidation in Submit_test.cpp
- Updated namespace from xrpl to xrpl::test for test files
- Updated beast::unit_test::suite to beast::unit_test::Suite

Co-authored-by: mvadari <[email protected]>
2026-05-15 17:50:26 +00:00
Mayukha Vadari 1b05dba80b fix pre-commit issues 2026-04-03 11:00:23 -04:00
Mayukha Vadari 3595ad0928 fix issues 2026-04-03 10:56:04 -04:00
copilot-swe-agent[bot]andmvadari 0af23e1466 Extract helper function to avoid code duplication and update API-CHANGELOG
Co-authored-by: mvadari <[email protected]>
2026-04-03 10:55:42 -04:00
copilot-swe-agent[bot]andmvadari cfcf1d30e2 Fix includes in Submit_test.cpp
Co-authored-by: mvadari <[email protected]>
2026-04-03 10:54:51 -04:00
copilot-swe-agent[bot]andmvadari 6f8618b2f2 Fix test to properly construct transaction JSON for sign-and-submit
Co-authored-by: mvadari <[email protected]>
2026-04-03 10:54:51 -04:00
copilot-swe-agent[bot]andmvadari 361f3469b8 Add augmented fields to sign-and-submit mode and create test
Co-authored-by: mvadari <[email protected]>
2026-04-03 10:54:51 -04:00
1053 changed files with 8976 additions and 18380 deletions

No files matched your search

+1 -8
View File
@@ -90,13 +90,6 @@ CheckOptions:
readability-identifier-naming.ClassCase: CamelCase
readability-identifier-naming.StructCase: CamelCase
readability-identifier-naming.UnionCase: CamelCase
readability-identifier-naming.TypeAliasCase: CamelCase
readability-identifier-naming.TypedefCase: CamelCase
# Member type names mandated by std/Boost concepts. Subtrees that need more
# than these carry their own .clang-tidy (include/xrpl/{beast,basics,protocol,
# peerfinder}, src/test/beast); one-off cases use an inline NOLINT.
readability-identifier-naming.TypeAliasIgnoredRegexp: "^(const_iterator|const_reference|difference_type|duration|iterator|iterator_category|key_type|mapped_type|period|pointer|reference|rep|result_type|size_type|time_point|value_type)$"
readability-identifier-naming.TypedefIgnoredRegexp: "^(const_iterator|const_reference|difference_type|duration|iterator|iterator_category|key_type|mapped_type|period|pointer|reference|rep|result_type|size_type|time_point|value_type)$"
readability-identifier-naming.EnumCase: CamelCase
readability-identifier-naming.EnumConstantCase: CamelCase
readability-identifier-naming.ScopedEnumConstantCase: CamelCase
@@ -129,5 +122,5 @@ CheckOptions:
readability-identifier-naming.GlobalFunctionIgnoredRegexp: "^(to_string|hash_append|tuple_hash)$"
HeaderFilterRegex: '^.*/(tests?|xrpl|xrpld)/.*\.(h|hpp|ipp)$'
ExcludeHeaderFilterRegex: '^.*/protocol_autogen/.*\.(h|hpp)$|^.*\.pb\.h$'
ExcludeHeaderFilterRegex: '^.*/protocol_autogen/.*\.(h|hpp)$'
WarningsAsErrors: "*"
+1 -1
View File
@@ -41,4 +41,4 @@ runs:
- name: Determine release channel and package release
id: release_info
uses: XRPLF/actions/release-info@ebcf6cea14eee258697308a51fea55cad777581b
uses: XRPLF/actions/release-info@7cc0e4a8d9d0b838f92c48d312856b190341bbba
@@ -112,7 +112,6 @@ test.jtx > xrpl.config
test.jtx > xrpl.core
test.jtx > xrpld.app
test.jtx > xrpld.core
test.jtx > xrpld.overlay
test.jtx > xrpld.rpc
test.jtx > xrpl.json
test.jtx > xrpl.ledger
@@ -194,9 +193,6 @@ tests.libxrpl > xrpl.resource
tests.libxrpl > xrpl.server
tests.libxrpl > xrpl.shamap
tests.libxrpl > xrpl.tx
tests.xrpld > xrpld.rpc
tests.xrpld > xrpl.json
tests.xrpld > xrpl.protocol
xrpl.conditions > xrpl.basics
xrpl.conditions > xrpl.protocol
xrpl.config > xrpl.basics
@@ -1,47 +0,0 @@
#!/bin/bash
# Exit the script as soon as an error occurs.
set -euo pipefail
# This script fails if the commits in <base>..<head> copy commits from a release or staging branch
# (e.g. by rebasing or cherry-picking them) instead of merging that branch, see RELEASING.md.
# Commits are compared by patch-id,
# and only against release and staging commits that <head> does not already contain.
# Usage: .github/scripts/releasing/check-no-copied-release-commits.sh <base> <head>
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <base> <head>"
exit 1
fi
BASE=$1
HEAD=$2
patch_ids() {
git log --no-merges --patch --no-color --no-ext-diff "$@" | git patch-id --stable | sort
}
mapfile -t BRANCHES < <(git for-each-ref --format='%(refname)' 'refs/remotes/*/release/*' 'refs/remotes/*/staging/*')
if [ "${#BRANCHES[@]}" -eq 0 ]; then
echo "Error: No release or staging branches found."
exit 1
fi
# Each line is "<patch-id> <commit>".
RELEASE_PATCHES=$(patch_ids "${BRANCHES[@]}" --not "${HEAD}")
PR_PATCHES=$(patch_ids "${BASE}..${HEAD}")
# Each line is "<patch-id> <release commit> <PR commit>".
COPIES=$(join <(echo "${RELEASE_PATCHES}") <(echo "${PR_PATCHES}"))
if [ -z "${COPIES}" ]; then
echo "No copied release commits found."
exit 0
fi
echo "These commits copy release commits instead of merging them:"
while read -r _ RELEASE_COMMIT PR_COMMIT; do
echo " $(git log -1 --format='%h %s' "${PR_COMMIT}") (copies ${RELEASE_COMMIT:0:10})"
done <<<"${COPIES}"
echo
echo "Merge the release tag (or branch) instead, see RELEASING.md."
exit 1
@@ -1,46 +0,0 @@
#!/bin/bash
# Exit the script as soon as an error occurs.
set -euo pipefail
# This script fails if a final release (a tag like 3.4.0) on a release branch
# is not merged back into <develop> within a few days, see RELEASING.md.
# Usage: .github/scripts/releasing/check-releases-merged.sh <develop>
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <develop>"
exit 1
fi
DEVELOP=$1
GRACE_DAYS=3
mapfile -t MERGED_ARGS < <(git for-each-ref --format='--merged=%(refname)' 'refs/remotes/*/release/*')
if [ "${#MERGED_ARGS[@]}" -eq 0 ]; then
echo "Error: No release branches found."
exit 1
fi
# Tags on a release branch that <develop> does not contain.
TAGS=$(git for-each-ref --format='%(refname:short) %(creatordate:unix)' \
"${MERGED_ARGS[@]}" --no-merged="${DEVELOP}" 'refs/tags/[0-9]*')
MISSING=0
while read -r TAG CREATED; do
if ! [[ "${TAG}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
continue
fi
if (($(date +%s) - CREATED < GRACE_DAYS * 86400)); then
echo "${TAG}: not merged yet, still within the ${GRACE_DAYS}-day grace period."
else
echo "${TAG}: not merged into develop."
MISSING=1
fi
done <<<"${TAGS}"
if [ "${MISSING}" -ne 0 ]; then
echo
echo "Merge the missing releases back into develop, see RELEASING.md."
exit 1
fi
echo "No releases past the grace period are missing from develop."
+1 -1
View File
@@ -62,7 +62,7 @@ ${SED_COMMAND} -i 's@ripple/@xrpld/@g' src/test/core/Config_test.cpp
${SED_COMMAND} -i 's/Rippled/File/g' src/test/core/Config_test.cpp
# Restore the old config file name in the code that maintains support for now.
${SED_COMMAND} -i 's/kConfigLegacyName = "xrpld.cfg"/kConfigLegacyName = "rippled.cfg"/g' src/xrpld/core/Config.h
${SED_COMMAND} -i 's/kConfigLegacyName = "xrpld.cfg"/kConfigLegacyName = "rippled.cfg"/g' src/xrpld/core/detail/Config.cpp
# Restore an URL.
${SED_COMMAND} -i 's/connect-your-xrpld-to-the-xrp-test-net.html/connect-your-rippled-to-the-xrp-test-net.html/g' cfg/xrpld-example.cfg
+1 -1
View File
@@ -90,7 +90,7 @@ ${SED_COMMAND} -i 's/www.ripple.com/www.xrpl.org/g' src/test/protocol/Seed_test.
# Restore specific changes.
${SED_COMMAND} -i 's@b5efcc/src/xrpld@b5efcc/src/ripple@' include/xrpl/protocol/README.md
${SED_COMMAND} -i 's/dbPrefix_ = "xrpldb"/dbPrefix_ = "rippledb"/' src/xrpld/app/misc/SHAMapStoreImp.h # cspell: disable-line
${SED_COMMAND} -i 's/kConfigLegacyName = "xrpld.cfg"/kConfigLegacyName = "rippled.cfg"/' src/xrpld/core/Config.h
${SED_COMMAND} -i 's/kConfigLegacyName = "xrpld.cfg"/kConfigLegacyName = "rippled.cfg"/' src/xrpld/core/detail/Config.cpp
popd
echo "Renaming complete."
+1 -1
View File
@@ -58,7 +58,7 @@ jobs:
base_image: debian:bookworm
- name: rhel
base_image: registry.access.redhat.com/ubi9/ubi:latest
uses: XRPLF/actions/.github/workflows/build-multiarch-image.yml@696384b292577293292daed06af0306d1b83bd7d
uses: XRPLF/actions/.github/workflows/build-multiarch-image.yml@034e87065fcd0100214cf0672923bd38d193cf78
with:
image_name: xrpld/nix-${{ matrix.distro.name }}
dockerfile: nix/docker/Dockerfile
+1 -1
View File
@@ -41,7 +41,7 @@ jobs:
# AlmaLinux rather than UBI, which does not ship rpm-sign.
- name: rhel
base_image: almalinux:10
uses: XRPLF/actions/.github/workflows/build-multiarch-image.yml@696384b292577293292daed06af0306d1b83bd7d
uses: XRPLF/actions/.github/workflows/build-multiarch-image.yml@034e87065fcd0100214cf0672923bd38d193cf78
with:
image_name: xrpld/packaging-${{ matrix.distro.name }}
dockerfile: package/docker/Dockerfile
+1 -1
View File
@@ -30,7 +30,7 @@ jobs:
permissions:
contents: read
packages: write
uses: XRPLF/actions/.github/workflows/build-multiarch-image.yml@696384b292577293292daed06af0306d1b83bd7d
uses: XRPLF/actions/.github/workflows/build-multiarch-image.yml@034e87065fcd0100214cf0672923bd38d193cf78
with:
image_name: xrpld/pre-commit
dockerfile: bin/pre-commit/Dockerfile
@@ -13,6 +13,7 @@ on:
- ready_for_review
branches:
- develop
- "release-*"
- "release/*"
- "staging/*"
+1
View File
@@ -13,6 +13,7 @@ on:
- ready_for_review
branches:
- develop
- "release-*"
- "release/*"
- "staging/*"
@@ -1,60 +0,0 @@
# This workflow checks that every final release on a release branch
# has been merged back into develop, see RELEASING.md.
name: Check releases merged
on:
schedule:
# 06:47 UTC every Monday.
- cron: "47 6 * * 1"
push:
branches:
- "develop"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
env:
OUTPUT_FILE: /tmp/releases-merged.txt
ISSUE_FILE: /tmp/releases-merged-issue.md
jobs:
releases-merged:
runs-on: ubuntu-latest
permissions:
contents: read
# Needed to open an issue on scheduled failures.
issues: write
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# The check needs the full history of develop, the release branches and tags.
fetch-depth: 0
- name: Check releases are merged into develop
run: |
set -o pipefail
.github/scripts/releasing/check-releases-merged.sh origin/develop | tee "${OUTPUT_FILE}"
- name: Prepare issue body
if: ${{ failure() && github.event_name == 'schedule' && github.repository == 'XRPLF/rippled' }}
run: |
{
echo '```'
cat "${OUTPUT_FILE}"
echo '```'
} >"${ISSUE_FILE}"
- name: Create issue
if: ${{ failure() && github.event_name == 'schedule' && github.repository == 'XRPLF/rippled' }}
uses: XRPLF/actions/create-issue@2b8bc36af85b88bca0dd7bfac2e2dc05f94ad712
with:
title: "Releases not merged back into develop"
body_file: ${{ env.ISSUE_FILE }}
labels: "Bug"
-22
View File
@@ -150,27 +150,6 @@ jobs:
if: ${{ needs.should-run.outputs.go == 'true' }}
uses: ./.github/workflows/reusable-check-rename.yml
# Runs regardless of the changed files.
# PRs into staging branches are skipped, since fixes may be cherry-picked between release lines.
check-release-commits:
needs: should-run
if: ${{ github.event.pull_request.base.ref == 'develop' || github.event.merge_group.base_ref == 'refs/heads/develop' }}
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# The check needs the full history of the release and staging branches.
fetch-depth: 0
persist-credentials: false
- name: Check for copied release commits
env:
BASE: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha }}
HEAD: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }}
run: .github/scripts/releasing/check-no-copied-release-commits.sh "${BASE}" "${HEAD}"
clang-tidy:
needs: should-run
if: ${{ needs.should-run.outputs.go == 'true' }}
@@ -251,7 +230,6 @@ jobs:
- check-autogen
- check-levelization
- check-rename
- check-release-commits
- clang-tidy
- build-test
- rust
-1
View File
@@ -50,4 +50,3 @@ jobs:
remote_username: ${{ secrets.NEXUS_REMOTE_USERNAME }}
remote_password: ${{ secrets.NEXUS_REMOTE_PASSWORD }}
signing_key: ${{ secrets.NEXUS_PACKAGES_PRIVATE_KEY }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
-1
View File
@@ -129,4 +129,3 @@ jobs:
remote_username: ${{ secrets.NEXUS_REMOTE_USERNAME }}
remote_password: ${{ secrets.NEXUS_REMOTE_PASSWORD }}
signing_key: ${{ secrets.NEXUS_PACKAGES_PRIVATE_KEY }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
@@ -257,7 +257,6 @@ jobs:
run: |
./bin/check-nix-store-refs.sh "${BUILD_DIR}/xrpld"
./bin/check-nix-store-refs.sh "${BUILD_DIR}/xrpl_tests"
./bin/check-nix-store-refs.sh "${BUILD_DIR}/xrpld_tests"
- name: Show ccache statistics
if: ${{ inputs.ccache_enabled }}
@@ -339,9 +338,7 @@ jobs:
- name: Run the separate tests
if: ${{ !inputs.build_only }}
working-directory: ${{ runner.os == 'Windows' && format('{0}/{1}', env.BUILD_DIR, inputs.build_type) || env.BUILD_DIR }}
run: |
./xrpl_tests
./xrpld_tests
run: ./xrpl_tests
- name: Run the embedded tests
if: ${{ !inputs.build_only }}
+4 -63
View File
@@ -1,5 +1,5 @@
# Build, verify and publish Linux packages from the pre-built xrpld and
# validator-keys artifacts, in these stages:
# validator-keys artifacts, in three stages:
#
# - 'package' builds and signs one format per config that carries a "package"
# map in linux.json; that map names the container image and the format
@@ -9,8 +9,6 @@
# never reaches Nexus
# - 'publish' uploads with the image's publish_pkg.py, doing a --dry-run
# unless 'publish: true'
# - 'docker' builds an Ubuntu image from the tested DEB, pushing it to Docker
# Hub only with 'publish: true'
#
# Only linux/amd64 is supported; the runner is hardcoded in the jobs below.
name: Package
@@ -39,9 +37,6 @@ on:
signing_key:
description: "Armoured PGP private key used to sign the RPMs. Required when publishing."
required: false
dockerhub_token:
description: "A Docker Hub organization access token for xrplf, with push access to xrplf/xrpld. Required when publishing."
required: false
defaults:
run:
@@ -203,6 +198,9 @@ jobs:
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
# The name says which of the two this is, because the job runs either way:
# with publish false it passes --dry-run and uploads nothing, and a job
# called "publish ..." succeeding on a pull request reads like a release.
name: "publish ${{ matrix.xrpld_artifact_name }}${{ !inputs.publish && ' (dry run)' || '' }}"
permissions:
contents: read
@@ -244,60 +242,3 @@ jobs:
--package-dir "${PACKAGE_DIR}" \
--nexus-url "${NEXUS_URL}" \
${DRY_RUN_OPTION}
docker:
needs: [test-install-deb, test-install-rpm]
name: "docker${{ !inputs.publish && ' (dry run)' || '' }}"
permissions:
contents: read
runs-on: ubuntu-latest
timeout-minutes: 5
env:
IMAGE: xrplf/xrpld:${{ github.ref_type == 'tag' && github.ref_name || 'develop' }}
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Download package artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: "*-pkg"
merge-multiple: true
path: ${{ env.PACKAGE_DIR }}
- name: Build image
env:
CONTEXT: image-context
run: |
mkdir -p "${CONTEXT}"
find "${PACKAGE_DIR}" -type f -name 'xrpld_[0-9]*.deb' -exec cp {} "${CONTEXT}/" \;
docker build --pull --file package/image/Dockerfile --tag "${IMAGE}" "${CONTEXT}"
- name: Start the server
run: |
container="$(docker run --detach "${IMAGE}" --standalone --silent --conf /etc/xrpld/xrpld.cfg)"
trap 'docker rm --force "${container}" >/dev/null' EXIT
for _ in $(seq 30); do
output="$(docker exec "${container}" xrpld --conf /etc/xrpld/xrpld.cfg server_info || true)"
if [[ "${output}" == *'"status" : "success"'* ]]; then
exit 0
fi
sleep 2
done
docker logs "${container}"
exit 1
# Docker Hub is public, so a private build never reaches it.
- name: Log in to Docker Hub
if: ${{ inputs.publish && github.event.repository.visibility == 'public' }}
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
username: xrplf
password: ${{ secrets.dockerhub_token }}
- name: Push image
if: ${{ inputs.publish && github.event.repository.visibility == 'public' }}
run: docker push "${IMAGE}"
+21 -5
View File
@@ -68,17 +68,33 @@ jobs:
run: conan remote login "${REMOTE_NAME}" "${CONAN_LOGIN_USERNAME_XRPLF}" --password "${CONAN_PASSWORD_XRPLF}"
- name: Upload Conan recipe (version)
env:
VERSION: ${{ steps.release_info.outputs.version }}
run: |
conan export . --version="${VERSION}"
conan upload --confirm --check --remote="${REMOTE_NAME}" "xrpl/${VERSION}"
conan export . --version=${{ steps.release_info.outputs.version }}
conan upload --confirm --check --remote="${REMOTE_NAME}" xrpl/${{ steps.release_info.outputs.version }}
# When this workflow is triggered by a push event, it will always be when merging into the
# 'develop' branch, see on-trigger.yml.
- name: Upload Conan recipe (develop)
if: ${{ github.ref == 'refs/heads/develop' }}
if: ${{ github.event_name == 'push' }}
run: |
conan export . --version=develop
conan upload --confirm --check --remote="${REMOTE_NAME}" xrpl/develop
# When this workflow is triggered by a pull request event, it will always be when merging into
# one of the 'release' branches, see on-pr.yml.
- name: Upload Conan recipe (rc)
if: ${{ github.event_name == 'pull_request' }}
run: |
conan export . --version=rc
conan upload --confirm --check --remote="${REMOTE_NAME}" xrpl/rc
# When this workflow is triggered by a push event, it will always be when tagging a final
# release, see on-tag.yml.
- name: Upload Conan recipe (release)
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: |
conan export . --version=release
conan upload --confirm --check --remote="${REMOTE_NAME}" xrpl/release
outputs:
ref: xrpl/${{ steps.release_info.outputs.version }}
+7 -12
View File
@@ -53,14 +53,9 @@ repos:
entry: ./bin/pre-commit/check_doxygen_style.py
language: python
types_or: [c++, c]
- id: fix-gtest-names
name: "fix gtest names: CamelCase suite, snake_case test case"
entry: ./bin/pre-commit/fix_gtest_names.py
language: python
types_or: [c++, c]
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: e2b496dc2bd8340c2524cb9a2d2a943cde1bb6df # frozen: v23.1.1
rev: f4d7745e17a28aad7eed2f4874ca8d1568c11c4c # frozen: v22.1.8
hooks:
- id: clang-format
args: [--style=file]
@@ -82,12 +77,12 @@ repos:
files: ^crates/.*\.rs$
- repo: https://github.com/BlankSpruce/gersemi-pre-commit
rev: f1c4833f8cf23c6d952673abc73525411a5719e8 # frozen: 0.29.1
rev: e98930bdc210d3387007f9252d8c1694ea7e410f # frozen: 0.27.7
hooks:
- id: gersemi
- repo: https://github.com/rbubley/mirrors-prettier
rev: ef4a397f916211b4a39ccf9d3d9cbb6562157251 # frozen: v3.9.9
rev: 9337a74165b178ae2c766f60bee7252a0f06f3e8 # frozen: v3.9.5
hooks:
- id: prettier
args: [--end-of-line=auto]
@@ -95,7 +90,7 @@ repos:
# Scoped to package/: the rest of the repo's Python has pre-existing findings,
# so widening these is its own change.
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: a56c0b927e6465d37cae3e97d35d4d18ab2b96cd # frozen: v0.16.9
rev: 7c55798a78262d14b2074abf623d8a992ebb70d4 # frozen: v0.16.2
hooks:
- id: ruff-check
args: [--fix]
@@ -107,14 +102,14 @@ repos:
- id: black
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 7ff8d35ae36a7d2b968f2f90b4c723e292e594ee # frozen: v2.3.1
rev: 41e691678310dfd3833f7ab4e180ddb014310356 # frozen: v2.3.0
hooks:
- id: mypy
args: [--strict]
files: ^package/.*\.py$
- repo: https://github.com/scop/pre-commit-shfmt
rev: 479be5958357ba5ab65ce47172117348516860e9 # frozen: v3.14.1-1
rev: 05c1426671b9237fb5e1444dd63aa5731bec0dfb # frozen: v3.13.1-1
hooks:
- id: shfmt
args: [--write, --indent=4, --case-indent=true]
@@ -133,7 +128,7 @@ repos:
files: \.md$
- repo: https://github.com/streetsidesoftware/cspell-cli
rev: f5c5d72342f35643988a9ffa0705c05bd3ff8383 # frozen: v10.3.0
rev: ea11f9efc0bec520073405bc30552da887ba71bc # frozen: v10.0.1
hooks:
- id: cspell
name: check changed files spelling
+1 -1
View File
@@ -28,7 +28,6 @@ Version 3.4.0 is not yet released. These changes are available in the 3.4.0 beta
### Additions in 3.4.0
- `server_info` (admin): The `node_size` field has been removed; it reported the deprecated `[node_size]` config setting, which is still accepted as an alias for `[memory_limit]` and still emits a startup warning. Admin responses now include `memory_limit`, the cache memory budget in gigabytes rounded up (0 when enforcement is disabled).
- `ledger`: `nftoken_id`, `nftoken_ids`, and `offer_id` are now included in transaction metadata when transactions are expanded (`expand`, or admin-only `full`), matching the `tx`, `account_tx`, and `subscribe` (`transactions` stream) responses. ([#5706](https://github.com/XRPLF/rippled/pull/5706))
### Bugfixes in 3.4.0
@@ -43,6 +42,7 @@ Version 3.4.0 is not yet released. These changes are available in the 3.4.0 beta
- `account_lines`: The `peer` field now returns an error if the value is not a string. [#7728](https://github.com/XRPLF/rippled/pull/7728)
- `ledger`: `delivered_amount` is now included in the metadata of successful `AccountDelete` transactions when transactions are expanded (`expand`, or admin-only `full`). Previously it was only added for `Payment` and `CheckCash`, which made `ledger` inconsistent with `tx` and `account_tx`. [#5706](https://github.com/XRPLF/rippled/pull/5706)
- `noripple_check`: The `transactions` field is no longer included in error responses; it is still returned (possibly as an empty array) whenever `transactions` is `true` and the request succeeds. A malformed `account` is now rejected before the ledger is looked up, so that error response no longer carries the `ledger_hash`, `ledger_index`, and `validated` fields ([#6303](https://github.com/XRPLF/rippled/pull/6303)).
- `submit`: Augmented response fields (`accepted`, `applied`, `broadcast`, `queued`, `kept`, `account_sequence_next`, `account_sequence_available`, `open_ledger_cost`, `validated_ledger_index`) are now included in sign-and-submit mode. Previously, these fields were only returned when submitting a binary transaction blob. ([#6304](https://github.com/XRPLF/rippled/pull/6304))
## XRP Ledger server version 3.3.0
-2
View File
@@ -115,7 +115,6 @@ find_package(secp256k1 REQUIRED)
find_package(SOCI REQUIRED)
find_package(SQLite3 REQUIRED)
find_package(xxHash REQUIRED)
find_package(xrpl-rpc-spec REQUIRED)
target_link_libraries(
xrpl_libs
@@ -176,7 +175,6 @@ include(XrplPackaging)
if(tests)
include(CTest)
add_subdirectory(src/tests/libxrpl)
add_subdirectory(src/tests/xrpld)
endif()
if(benchmark)
+2 -6
View File
@@ -479,12 +479,8 @@ exists, then no other unit test will be executed, apart from `TestSuiteName`.
elsewhere in the codebase.
12. Use clear and self-explanatory names for functions, variables,
structs and classes.
13. Use TitleCase for classes, structs, type aliases and filenames,
camelCase for function and variable names, lower case for namespaces and
folders. The exception is a type alias that generic code looks up by name
(`value_type`, `iterator`, `result_type`, and the rest of the standard
container, hash and clock members), which keeps its snake_case spelling;
`.clang-tidy` lists the names that are allowed.
13. Use TitleCase for classes, structs and filenames, camelCase for
function and variable names, lower case for namespaces and folders.
14. Provide as many comments as you feel that a competent programmer
would need to understand what your code does.
-144
View File
@@ -1,144 +0,0 @@
#!/usr/bin/env python3
"""
Rewrites gtest names to the required style in this project: the suite name is
CamelCase, the test-case name is snake_case.
TEST(SuiteName, test_case_name)
The gtest `DISABLED_` prefix is kept verbatim on either name.
Both conversions fold acronyms the way a reader expects:
`SetAndResetAccountTxnID` -> `set_and_reset_account_txn_id`, not
`set_and_reset_account_txn_i_d`.
The first argument of `TEST_F`, `TEST_P`, `TYPED_TEST` and `TYPED_TEST_P` is a
fixture class rather than a free identifier, so rewriting it here would leave
the class it names behind. Those are reported for a human to rename (clang-tidy
checks the class declaration itself, via readability-identifier-naming).
Usage: ./bin/pre-commit/fix_gtest_names.py <file1> <file2> ...
"""
import re
import sys
from collections import Counter
from pathlib import Path
# A test-case definition, `MACRO(SuiteOrFixture, TestName)`, anchored at the
# start of a line so that commented-out definitions and project macros that
# merely look similar (`TEST_EXPECT(...)`) are left alone. The `\s*` between
# arguments allows for a definition clang-format wrapped over several lines.
PATTERN = re.compile(
r"(?P<head>^[ \t]*(?P<macro>TYPED_TEST_P|TYPED_TEST|TEST_F|TEST_P|TEST)\s*\(\s*)"
r"(?P<suite>\w+)(?P<mid>\s*,\s*)(?P<name>\w+)(?P<tail>\s*\))",
re.MULTILINE,
)
# The macros whose first argument names a fixture class, not a free identifier.
FIXTURE_MACROS = ("TEST_F", "TEST_P", "TYPED_TEST", "TYPED_TEST_P")
DISABLED = "DISABLED_"
ACRONYM_BOUNDARY = re.compile(r"([A-Z]+)([A-Z][a-z])")
WORD_BOUNDARY = re.compile(r"([a-z\d])([A-Z])")
def _split_disabled(name: str) -> tuple[str, str]:
"""Splits off gtest's `DISABLED_` prefix, which is kept verbatim."""
if name.startswith(DISABLED):
return DISABLED, name[len(DISABLED) :]
return "", name
def snake_case(name: str) -> str:
"""Returns the name in snake_case, leaving acronyms whole.
`SetAndResetAccountTxnID` -> `set_and_reset_account_txn_id`,
`parseStatRSSkB` -> `parse_stat_rs_sk_b`.
"""
prefix, core = _split_disabled(name)
core = ACRONYM_BOUNDARY.sub(r"\1_\2", core)
return prefix + WORD_BOUNDARY.sub(r"\1_\2", core).lower()
def camel_case(name: str) -> str:
"""Returns the name in CamelCase, capitalizing each underscored word.
Only the letters that have to change are touched, so acronyms survive: a
conversion that went via snake_case would turn `SHAMapTest` into
`ShaMapTest`, whereas here it is already CamelCase and stays put.
`json_value` -> `JsonValue`, `parseStatRSSkB` -> `ParseStatRSSkB`.
"""
prefix, core = _split_disabled(name)
return prefix + "".join(w[:1].upper() + w[1:] for w in core.split("_") if w)
def _corrected(match: re.Match) -> tuple[str, str]:
"""Returns the suite and test-case names this definition should end up with."""
suite = match["suite"]
return (
suite if match["macro"] in FIXTURE_MACROS else camel_case(suite),
snake_case(match["name"]),
)
def fix_source(text: str) -> tuple[str, list[str]]:
"""Returns the corrected text and one `line: message` report per bad name."""
# gtest joins the suite and test names into one class name, so two test
# cases whose joined names agree cannot coexist: `TEST(a, b_c)` and
# `TEST(a_b, c)` both define `a_b_c_Test`. A rename that would introduce
# such a clash is reported for a human instead of applied.
joined = Counter("_".join(_corrected(m)) for m in PATTERN.finditer(text))
reports = []
def rewrite(match: re.Match) -> str:
suite, name = match["suite"], match["name"]
new_suite, new_name = _corrected(match)
line = text.count("\n", 0, match.start()) + 1
if match["macro"] in FIXTURE_MACROS and camel_case(suite) != suite:
reports.append(
f"{line}: fixture '{suite}' is not CamelCase: rename the class "
f"to '{camel_case(suite)}' by hand"
)
if (new_suite, new_name) == (suite, name):
return match[0]
if joined[f"{new_suite}_{new_name}"] > 1:
reports.append(
f"{line}: cannot rename '{suite}, {name}' to '{new_suite}, "
f"{new_name}': another test case already generates that name"
)
return match[0]
if new_suite != suite:
reports.append(f"{line}: renamed suite '{suite}' to '{new_suite}'")
if new_name != name:
reports.append(f"{line}: renamed test case '{name}' to '{new_name}'")
return match["head"] + new_suite + match["mid"] + new_name + match["tail"]
return PATTERN.sub(rewrite, text), reports
def fix_names(path: Path) -> bool:
"""Corrects one file's gtest names, reporting each on stdout."""
original = path.read_text(encoding="utf-8")
fixed, reports = fix_source(original)
for report in reports:
print(f"{path}:{report}")
if fixed != original:
path.write_text(fixed, encoding="utf-8")
return not reports
def main() -> int:
files = [Path(f) for f in sys.argv[1:]]
success = True
for path in files:
success &= fix_names(path)
return 0 if success else 1
if __name__ == "__main__":
sys.exit(main())
-259
View File
@@ -1,259 +0,0 @@
#!/usr/bin/env python3
"""
Tests for fix_gtest_names.py.
Run directly (no test framework needed):
./bin/pre-commit/test_fix_gtest_names.py
or under pytest:
pytest bin/pre-commit/test_fix_gtest_names.py
"""
import sys
import textwrap
from fix_gtest_names import camel_case, fix_source, snake_case
def dedent(text: str) -> str:
"""Removes a fixture's common indentation and its leading newline.
Lets fixtures be written as indented triple-quoted here-docs while keeping
honest 1-based line numbers.
"""
return textwrap.dedent(text).lstrip("\n")
def fixed(text: str) -> str:
return fix_source(dedent(text))[0]
def reports(text: str) -> list[str]:
return fix_source(dedent(text))[1]
# --- conversion --------------------------------------------------------------
def test_snake_case_conversion() -> None:
assert snake_case("BadInputs") == "bad_inputs"
assert snake_case("mulDiv") == "mul_div"
assert snake_case("already_snake") == "already_snake"
assert snake_case("base64") == "base64"
def test_snake_case_keeps_acronyms_whole() -> None:
assert snake_case("SetAndResetAccountTxnID") == "set_and_reset_account_txn_id"
assert snake_case("XRPToIOU") == "xrp_to_iou"
assert snake_case("STAmountMath") == "st_amount_math"
def test_camel_case_conversion() -> None:
assert camel_case("json_value") == "JsonValue"
assert camel_case("mulDiv") == "MulDiv"
assert camel_case("scope") == "Scope"
assert camel_case("base64") == "Base64"
def test_camel_case_leaves_acronyms_alone() -> None:
# A snake_case round-trip would give `ShaMapTest` / `ParseStatmRsSkB` here.
assert camel_case("SHAMapTest") == "SHAMapTest"
assert camel_case("parseStatmRSSkB") == "ParseStatmRSSkB"
assert camel_case("XRPAmount") == "XRPAmount"
assert camel_case("CSPRNG") == "CSPRNG"
def test_disabled_prefix_preserved() -> None:
assert snake_case("DISABLED_FooBar") == "DISABLED_foo_bar"
assert snake_case("DISABLED_foo_bar") == "DISABLED_foo_bar"
assert snake_case("DISABLED_") == "DISABLED_"
assert camel_case("DISABLED_foo_bar") == "DISABLED_FooBar"
assert camel_case("DISABLED_") == "DISABLED_"
# --- what counts as a test definition ---------------------------------------
def test_all_macros_recognized() -> None:
code = """
TEST(Suite, oneName)
TEST_F(Fixture, twoName)
TEST_P(Fixture, threeName)
TYPED_TEST(Fixture, fourName)
TYPED_TEST_P(Fixture, fiveName)
"""
assert fixed(code) == dedent("""
TEST(Suite, one_name)
TEST_F(Fixture, two_name)
TEST_P(Fixture, three_name)
TYPED_TEST(Fixture, four_name)
TYPED_TEST_P(Fixture, five_name)
""")
def test_conforming_definitions_untouched() -> None:
code = """
TEST(AccountSet, bad_inputs)
TEST_F(MutexMakeTest, default_constructor)
TEST(SHAMap, DISABLED_slow_path)
"""
assert reports(code) == []
assert fixed(code) == dedent(code)
def test_lookalikes_ignored() -> None:
code = """
// TEST(Suite, notATest)
TEST_EXPECT(someCall())
TEST_EXPECTS(amount == value, amount.getText())
INSTANTIATE_TEST_SUITE_P(Prefix, Fixture, testValues());
auto x = TEST(Suite, notATest);
TYPED_TEST_SUITE(Fixture, MyTypes);
"""
assert reports(code) == []
assert fixed(code) == dedent(code)
def test_indented_and_wrapped_definitions() -> None:
code = """
namespace ripple {
TEST(Suite, indentedName)
}
TEST_F(
SomeVeryLongFixtureName,
wrappedName)
"""
assert fixed(code) == dedent("""
namespace ripple {
TEST(Suite, indented_name)
}
TEST_F(
SomeVeryLongFixtureName,
wrapped_name)
""")
# --- rewriting --------------------------------------------------------------
def test_only_the_two_names_are_rewritten() -> None:
code = """
TEST(mulDiv, mulDiv)
{
auto const mulDiv = 1; // mulDiv stays
}
"""
assert fixed(code) == dedent("""
TEST(MulDiv, mul_div)
{
auto const mulDiv = 1; // mulDiv stays
}
""")
def test_suite_name_camel_cased() -> None:
code = """
TEST(json_value, limits)
TEST(scope, ScopeExit)
"""
assert reports(code) == [
"1: renamed suite 'json_value' to 'JsonValue'",
"2: renamed suite 'scope' to 'Scope'",
"2: renamed test case 'ScopeExit' to 'scope_exit'",
]
assert fixed(code) == dedent("""
TEST(JsonValue, limits)
TEST(Scope, scope_exit)
""")
def test_fixture_reported_but_not_renamed() -> None:
# The first argument names a class, so only a human (or clang-tidy) can
# rename it; the test-case name is still fixed.
code = """
TEST_F(my_fixture, someTest)
"""
assert reports(code) == [
"1: fixture 'my_fixture' is not CamelCase: rename the class to "
"'MyFixture' by hand",
"1: renamed test case 'someTest' to 'some_test'",
]
assert fixed(code) == dedent("""
TEST_F(my_fixture, some_test)
""")
def test_reports_carry_line_numbers() -> None:
code = """
#include <foo.h>
TEST(Suite, firstName)
TEST(Suite, secondName)
"""
assert reports(code) == [
"3: renamed test case 'firstName' to 'first_name'",
"5: renamed test case 'secondName' to 'second_name'",
]
# --- collisions -------------------------------------------------------------
def test_collision_reported_and_not_applied() -> None:
# Both would define `Suite_mul_div_Test`.
code = """
TEST(Suite, mulDiv)
TEST(Suite, mul_div)
"""
assert reports(code) == [
"1: cannot rename 'Suite, mulDiv' to 'Suite, mul_div': another test "
"case already generates that name"
]
assert fixed(code) == dedent(code)
def test_collision_between_converging_suites() -> None:
# Both suites camel-case to `SuiteA`, so both would define
# `SuiteA_one_test_Test`.
code = """
TEST(SuiteA, oneTest)
TEST(Suite_a, one_test)
"""
assert [r.split(":")[1].strip() for r in reports(code)] == [
"cannot rename 'SuiteA, oneTest' to 'SuiteA, one_test'",
"cannot rename 'Suite_a, one_test' to 'SuiteA, one_test'",
]
assert fixed(code) == dedent(code)
def test_same_name_in_different_suites_is_not_a_collision() -> None:
code = """
TEST(SuiteOne, mulDiv)
TEST(SuiteTwo, mulDiv)
"""
assert fixed(code) == dedent("""
TEST(SuiteOne, mul_div)
TEST(SuiteTwo, mul_div)
""")
def main() -> int:
tests = sorted(
(name, fn)
for name, fn in globals().items()
if name.startswith("test_") and callable(fn)
)
failed = 0
for name, fn in tests:
try:
fn()
print(f"PASS {name}")
except AssertionError as exc:
failed += 1
print(f"FAIL {name}: {exc!r}")
print(f"\n{len(tests) - failed}/{len(tests)} passed")
return 1 if failed else 0
if __name__ == "__main__":
sys.exit(main())
+15 -33
View File
@@ -1368,41 +1368,23 @@
#
# [node_size]
#
# DEPRECATED. Each size is now an alias for a [memory_limit] value:
# tiny = 4, small = 8, medium = 32, large = 64, huge = 128. Set
# [memory_limit] instead; setting this logs a warning at startup.
# Tunes the servers based on the expected load and available memory. Legal
# sizes are "tiny", "small", "medium", "large", and "huge". We recommend
# you start at the default and raise the setting if you have extra memory.
#
# [memory_limit]
# The code attempts to automatically determine the appropriate size for
# this parameter based on the amount of RAM and the number of execution
# cores available to the server. The current decision matrix is:
#
# The memory budget, in gigabytes, that the server sizes its caches
# within. Cache sizes scale with the budget; the SHAMap tree node cache
# is capped to fit within half of it, enforced as it grows. Defaults to
# detected physical RAM (capped by the container limit when one is set);
# 0 selects minimal sizes with no enforcement. Values above 1024 are
# rejected, and a value above detected RAM logs a warning.
# Set this when xrpld shares the machine with other services or runs in
# a container with a memory limit below the host's RAM. Thread counts
# are unrelated: they come from the core count and the [workers] /
# [io_workers] overrides.
#
# Example:
# [memory_limit]
# 16
#
# [tree_cache_age]
#
# Seconds a SHAMap tree node stays cached after its last use. The default
# is 300. Accepted values are 10 to 3600.
#
# [ledger_cache_age]
#
# Seconds a full ledger stays in the ledger cache after its last use. The
# default is 180. Accepted values are 10 to 3600.
#
# [ledger_fetch_size]
#
# How many historical ledgers to acquire per fetch pass while backfilling.
# The default is 4. Accepted values are 1 to 16.
# | | Cores |
# |---------|------------------------|
# | RAM | 1 | 2 or 3 | ≥ 4 |
# |---------|------|--------|--------|
# | < ~8GB | tiny | tiny | tiny |
# | < ~12GB | tiny | small | small |
# | < ~16GB | tiny | small | medium |
# | < ~24GB | tiny | small | large |
# | < ~32GB | tiny | small | huge |
#
# [signing_support]
#
+1 -8
View File
@@ -296,14 +296,7 @@ if(xrpld)
target_sources(xrpld PRIVATE ${sources})
endif()
target_link_libraries(
xrpld
Xrpl::boost
Xrpl::opts
Xrpl::libs
xrpl.libxrpl
rpcspec::rpcspec
)
target_link_libraries(xrpld Xrpl::boost Xrpl::opts Xrpl::libs xrpl.libxrpl)
exclude_if_included(xrpld)
# define a macro for tests that might need to
# be excluded or run differently in CI environment
+1 -1
View File
@@ -48,7 +48,7 @@ setup_target_for_coverage_gcovr(
"include/xrpl/beast/test"
"include/xrpl/beast/unit_test"
"${CMAKE_BINARY_DIR}/pb-xrpl.libpb"
DEPENDENCIES xrpld xrpl_tests xrpld_tests
DEPENDENCIES xrpld xrpl_tests
)
add_code_coverage_to_target(opts INTERFACE)
+1 -1
View File
@@ -59,7 +59,7 @@ def create_transaction_parser():
# the members that differ from these.
SETTING_DEFAULTS = {
"delegable": "Delegation::NotDelegable",
"amendment": "UInt256{}",
"amendment": "uint256{}",
"privileges": "Privilege::NoPriv",
}
@@ -209,7 +209,7 @@ ${field['typeData']['setter_type']} ${field['paramName']}${',' if i < len(requir
* @return The constructed ledger entry wrapper.
*/
${name}
build(UInt256 const& index)
build(uint256 const& index)
{
return ${name}{std::make_shared<SLE>(std::move(object_), index)};
}
@@ -31,7 +31,7 @@ namespace xrpl::ledger_entries {
// builder's STObject and the wrapper's SLE.
TEST(${name}Tests, BuilderSettersRoundTrip)
{
UInt256 const index{1u};
uint256 const index{1u};
% for field in fields:
auto const ${field["paramName"]}Value = ${canonical_expr(field)};
@@ -85,7 +85,7 @@ TEST(${name}Tests, BuilderSettersRoundTrip)
// from that SLE, build a new wrapper, and verify all fields (and validate()).
TEST(${name}Tests, BuilderFromSleRoundTrip)
{
UInt256 const index{2u};
uint256 const index{2u};
% for field in fields:
auto const ${field["paramName"]}Value = ${canonical_expr(field)};
@@ -146,7 +146,7 @@ TEST(${name}Tests, BuilderFromSleRoundTrip)
// 3) Verify wrapper throws when constructed from wrong ledger entry type.
TEST(${name}Tests, WrapperThrowsOnWrongEntryType)
{
UInt256 const index{3u};
uint256 const index{3u};
// Build a valid ledger entry of a different type
// Ticket requires: Account, OwnerNode, TicketSequence, PreviousTxnID, PreviousTxnLgrSeq
@@ -177,7 +177,7 @@ TEST(${name}Tests, WrapperThrowsOnWrongEntryType)
// 4) Verify builder throws when constructed from wrong ledger entry type.
TEST(${name}Tests, BuilderThrowsOnWrongEntryType)
{
UInt256 const index{4u};
uint256 const index{4u};
// Build a valid ledger entry of a different type
% if wrong_le_include == "Ticket":
@@ -207,7 +207,7 @@ TEST(${name}Tests, BuilderThrowsOnWrongEntryType)
// 5) Build with only required fields and verify optional fields return nullopt.
TEST(${name}Tests, OptionalFieldsReturnNullopt)
{
UInt256 const index{3u};
uint256 const index{3u};
% for field in required_fields:
auto const ${field["paramName"]}Value = ${canonical_expr(field)};
+2 -7
View File
@@ -3,7 +3,6 @@
"requires": [
"zlib/1.3.2#1cb806da49011867778ffb6ac7190fcb%1782392402.122708",
"xxhash/0.8.3#681d36a0a6111fc56e5e45ea182c19cc%1782392402.420688",
"xrpl-rpc-spec/0.1.19#870b2d3abcfbbf13b61c2d3c69495060%1790348286.187549",
"sqlite3/3.53.0#324ada52333108388a9a6108bfa96734%1782392403.185447",
"soci/4.0.3#e726491a03468795453f7c83fc924a96%1782392402.679521",
"snappy/1.1.10#968fef506ff261592ec30c574d4a7809%1782307151.633168",
@@ -20,8 +19,8 @@
"libarchive/3.8.7#c446109bd1f1d8ba7936c94189bc50e6%1782392403.066892",
"jemalloc/5.3.1#1fc58d55316041f10fbc1e8a2eae632a%1776700028.228",
"gtest/1.17.0#5224b3b3ff3b4ce1133cbdd27d53ee7d%1782392402.791979",
"grpc/1.81.1#b87796a4269034856cbc1a2522db16eb%1788275071.530512",
"fast_float/8.2.10#f6f28d6bb22112078e7dbda611caf681%1785888854.601666",
"grpc/1.81.1#f729f6d75992d20f9c72828e9142d62f%1783945160.094135",
"fast_float/8.2.10#f6f28d6bb22112078e7dbda611caf681%1782494504.298",
"ed25519/2015.03#ae761bdc52730a843f0809bdf6c1b1f6%1782307148.15562",
"date/3.0.4#862e11e80030356b53c2c38599ceb32b%1782392402.538492",
"corrosion/0.6.1#bfa292df0a957bc70a450ff316cd9435%1786119416.131296",
@@ -46,10 +45,6 @@
],
"python_requires": [],
"overrides": {
"boost/1.91.0#ea540ca2133d831b560036aa24dece3c": [
null,
"boost/1.91.0#ea540ca2133d831b560036aa24dece3c"
],
"protobuf/[>=5.27.0 <7]": [
"protobuf/6.33.5"
],
-2
View File
@@ -36,7 +36,6 @@ class Xrpl(ConanFile):
"nudb/2.0.9",
"openssl/3.6.3",
"soci/4.0.3",
"xrpl-rpc-spec/0.1.19",
"zlib/1.3.2",
]
@@ -115,7 +114,6 @@ class Xrpl(ConanFile):
"soci/*:shared": False,
"soci/*:with_sqlite3": True,
"soci/*:with_boost": True,
"xrpl-rpc-spec/*:server": "xrpld",
"xxhash/*:shared": False,
}
+10 -10
View File
@@ -57,9 +57,9 @@ dependencies = [
[[package]]
name = "cxx"
version = "1.0.202"
version = "1.0.199"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13f6de320895f42e6e081abb5c7983bedcf0b6d0ff9323de0d33f620c8ac1199"
checksum = "824894a4a85dca76d4c95c2b9098c036f5a29f627b30c12780774f6654e60974"
dependencies = [
"cc",
"cxx-build",
@@ -72,9 +72,9 @@ dependencies = [
[[package]]
name = "cxx-build"
version = "1.0.202"
version = "1.0.199"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fde53ca86b9704a943fef0f1e1d836239a6aedca5de3c65fa9f97ec0bd46d39"
checksum = "f1ae0b651ea5b0000b19513aef5a03f194d7e3486f2d9258b658da8677fe9036"
dependencies = [
"cc",
"codespan-reporting",
@@ -87,9 +87,9 @@ dependencies = [
[[package]]
name = "cxxbridge-cmd"
version = "1.0.202"
version = "1.0.199"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07bae89236c811fd4d08ed3441759ac4ac98d752cbfd3de341315ba16ad20ec3"
checksum = "fb05f91d3fb8435d9bab6ac5ce6ac1868be774325fb7fb2a91be39393b21388e"
dependencies = [
"clap",
"codespan-reporting",
@@ -101,15 +101,15 @@ dependencies = [
[[package]]
name = "cxxbridge-flags"
version = "1.0.202"
version = "1.0.199"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49045042e5fced01b80742aba5508de82aa4f13677ed3fa2b4cda709c40c5918"
checksum = "bf293202e0e3e98495785745389e8d0755b217e66f19194a5c695c25e03282ef"
[[package]]
name = "cxxbridge-macro"
version = "1.0.202"
version = "1.0.199"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b181252e2e3d3b5d183afbdc033a3958b445eb3e1a0ae65fc3d4f5259f5da6fd"
checksum = "ca001d746947c7249ed9d332a10f7a59daedbafeb0ec68c5c18a7db7a93f6ccc"
dependencies = [
"indexmap",
"proc-macro2",
+3 -17
View File
@@ -1,19 +1,5 @@
# `xrpld` Docker Image
`xrpld` is published to Docker Hub as [`xrplf/xrpld`](https://hub.docker.com/r/xrplf/xrpld):
the `xrpld` DEB package installed on Ubuntu 26.04, running as the `xrpld` user.
Each release is tagged with its version, `xrplf/xrpld:<version>`, and
`xrplf/xrpld:develop` follows the `develop` branch.
See [`package/README.md`](../package/README.md#docker-image) for how it is built
and tagged.
```bash
docker run --detach --name xrpld \
--volume xrpld-db:/var/lib/xrpld \
--publish 2459:2459 \
xrplf/xrpld:develop
```
The admin ports (5005, 6006 and 50051) listen on `127.0.0.1` in the shipped
configuration; to reach them from outside the container, mount your own over
`/etc/xrpld/xrpld.cfg`.
- Some info relating to Docker containers can be found here: [../Builds/containers](../Builds/containers)
- Images for building and testing xrpld can be found here: [thejohnfreeman/rippled-docker](https://github.com/thejohnfreeman/rippled-docker/)
- These images do not have xrpld. They have all the tools necessary to build xrpld.
-11
View File
@@ -1,11 +0,0 @@
# basics' container adapters (TaggedCache, partitioned_unordered_map,
# base_uint) model std concepts, which mandate
# snake_case member type names.
#
# clang-tidy replaces rather than merges this option, so the list is the
# top-level one restated plus the 6 name(s) needed only here:
# allocator_type const_pointer const_reverse_iterator hasher key_equal reverse_iterator
InheritParentConfig: true
CheckOptions:
readability-identifier-naming.TypeAliasIgnoredRegexp: "^(allocator_type|const_iterator|const_pointer|const_reference|const_reverse_iterator|difference_type|duration|hasher|iterator|iterator_category|key_equal|key_type|mapped_type|period|pointer|reference|rep|result_type|reverse_iterator|size_type|time_point|value_type)$"
readability-identifier-naming.TypedefIgnoredRegexp: "^(allocator_type|const_iterator|const_pointer|const_reference|const_reverse_iterator|difference_type|duration|hasher|iterator|iterator_category|key_equal|key_type|mapped_type|period|pointer|reference|rep|result_type|reverse_iterator|size_type|time_point|value_type)$"
+5 -8
View File
@@ -618,16 +618,13 @@ SharedWeakUnion<T>::convertToWeak()
unsafeSetRawPtr(nullptr);
return true; // Should never happen
// LCOV_EXCL_STOP
case PartialDestroy: {
// We just converted the last strong pointer to a weak pointer.
// The weak ref we now hold keeps the object from being fully
// destroyed, so `p` stays valid; only the copy passed to
// `partialDestructorFinished` is nulled.
case PartialDestroy:
// This is a weird case. We just converted the last strong
// pointer to a weak pointer.
p->partialDestructor();
auto finished = p;
partialDestructorFinished(&finished);
partialDestructorFinished(&p);
// p is null and may no longer be used
break;
}
}
unsafeSetRawPtr(p, RefStrength::Weak);
return true;
+31 -21
View File
@@ -77,13 +77,21 @@ struct IntrusiveRefCounts
std::size_t
useCount() const noexcept;
// MUST be called after `partialDestructor` returns. Another thread may
// then delete the object, so `*o` is nulled and must not be used after
// (unless the caller holds its own weak ref, e.g.
// SharedWeakUnion::convertToWeak). Called by the smart pointers, not
// `partialDestructor`, so custom partial destructors can't forget it.
// The two-star API signals that `*o` may be deleted. Templated to
// support incomplete types.
// This function MUST be called after a partial destructor finishes running.
// Calling this function may cause other threads to delete the object
// pointed to by `o`, so `o` should never be used after calling this
// function. The parameter will be set to a `nullptr` after calling this
// function to emphasize that it should not be used.
// Note: This is intentionally NOT called at the end of `partialDestructor`.
// The reason for this is if new classes are written to support this smart
// pointer class, they need to write their own `partialDestructor` function
// and ensure `partialDestructorFinished` is called at the end. Putting this
// call inside the smart pointer class itself is expected to be less error
// prone.
// Note: The "two-star" programming is intentional. It emphasizes that `o`
// may be deleted and the unergonomic API is meant to signal the special
// nature of this function call to callers.
// Note: This is a template to support incompletely defined classes.
template <class T>
friend void
partialDestructorFinished(T** o);
@@ -326,11 +334,15 @@ IntrusiveRefCounts::addWeakReleaseStrongRef() const
ReleaseStrongRefAction action = NoOp;
if (prevVal.strong == 1)
{
// The weak ref added here keeps the weak count non-zero, so
// releasing the last strong ref always starts a partial destroy,
// regardless of the previous weak count.
nextIntVal |= kPartialDestroyStartedMask;
action = PartialDestroy;
if (prevVal.weak == 0)
{
action = NoOp;
}
else
{
nextIntVal |= kPartialDestroyStartedMask;
action = PartialDestroy;
}
}
if (refCounts_.compare_exchange_weak(prevIntVal, nextIntVal, std::memory_order_acq_rel))
{
@@ -346,26 +358,24 @@ IntrusiveRefCounts::addWeakReleaseStrongRef() const
inline ReleaseWeakRefAction
IntrusiveRefCounts::releaseWeakRef() const
{
auto const prevIntVal = refCounts_.fetch_sub(kWeakDelta, std::memory_order_acq_rel);
RefCountPair const prev = prevIntVal;
auto prevIntVal = refCounts_.fetch_sub(kWeakDelta, std::memory_order_acq_rel);
RefCountPair prev = prevIntVal;
if (prev.weak == 1 && prev.strong == 0)
{
// `wait` blocks while the value equals its argument, so it must be
// given the value as it is after the decrement above.
auto curIntVal = prevIntVal - kWeakDelta;
if (prev.partialDestroyStartedBit == 0u)
{
// This case should only be hit if the partialDestroyStartedBit is
// set non-atomically (and even then very rarely). The code is kept
// in case we need to set the flag non-atomically for perf reasons.
refCounts_.wait(curIntVal, std::memory_order_acquire);
curIntVal = refCounts_.load(std::memory_order_acquire);
refCounts_.wait(prevIntVal, std::memory_order_acquire);
prevIntVal = refCounts_.load(std::memory_order_acquire);
prev = RefCountPair{prevIntVal};
}
if (RefCountPair{curIntVal}.partialDestroyFinishedBit == 0u)
if (prev.partialDestroyFinishedBit == 0u)
{
// partial destroy MUST finish before running a full destroy (when
// using weak pointers)
refCounts_.wait(curIntVal, std::memory_order_acquire);
refCounts_.wait(prevIntVal - kWeakDelta, std::memory_order_acquire);
}
return ReleaseWeakRefAction::Destroy;
}
+1 -1
View File
@@ -5,6 +5,6 @@
namespace xrpl {
using KeyCache = TaggedCache<UInt256, int, true>;
using KeyCache = TaggedCache<uint256, int, true>;
} // namespace xrpl
+18 -18
View File
@@ -350,10 +350,10 @@ concept Integral64 = std::is_same_v<T, std::int64_t> || std::is_same_v<T, std::u
class Number final
{
using rep = std::int64_t;
using InternalRep = MantissaRange::rep;
using internalrep = MantissaRange::rep;
bool negative_{false};
InternalRep mantissa_{0};
internalrep mantissa_{0};
int exponent_{std::numeric_limits<int>::lowest()};
public:
@@ -361,10 +361,10 @@ public:
static constexpr int kMinExponent = -32768;
static constexpr int kMaxExponent = 32768;
static constexpr InternalRep kMaxRep = std::numeric_limits<rep>::max();
static constexpr internalrep kMaxRep = std::numeric_limits<rep>::max();
static_assert(kMaxRep == 9'223'372'036'854'775'807);
static_assert(-kMaxRep == std::numeric_limits<rep>::min() + 1);
static constexpr InternalRep kMaxRepUp = ((kMaxRep / 10) + 1) * 10;
static constexpr internalrep kMaxRepUp = ((kMaxRep / 10) + 1) * 10;
static_assert(kMaxRepUp == 9'223'372'036'854'775'810ULL);
// May need to make unchecked private
@@ -388,15 +388,15 @@ public:
explicit Number(rep mantissa, int exponent);
explicit constexpr Number(
bool negative,
InternalRep mantissa,
internalrep mantissa,
int exponent,
Unchecked) noexcept;
// Assume unsigned values are... unsigned. i.e. positive
explicit constexpr Number(InternalRep mantissa, int exponent, Unchecked) noexcept;
explicit constexpr Number(internalrep mantissa, int exponent, Unchecked) noexcept;
// Only unit tests are expected to use this ctor
explicit Number(bool negative, InternalRep mantissa, int exponent, Normalized);
explicit Number(bool negative, internalrep mantissa, int exponent, Normalized);
// Assume unsigned values are... unsigned. i.e. positive
explicit Number(InternalRep mantissa, int exponent, Normalized);
explicit Number(internalrep mantissa, int exponent, Normalized);
[[nodiscard]] constexpr rep
mantissa() const noexcept;
@@ -558,13 +558,13 @@ public:
static void
setMantissaScale(MantissaRange::MantissaScale scale);
static InternalRep
static internalrep
minMantissa()
{
return kRange.get().min;
}
static InternalRep
static internalrep
maxMantissa()
{
return kRange.get().max;
@@ -591,7 +591,7 @@ public:
// is negative, returns the positive value. This takes a little extra work
// because converting std::numeric_limits<std::int64_t>::min() flirts with
// UB, and can vary across compilers.
static InternalRep
static internalrep
externalToInternal(rep mantissa);
private:
@@ -625,8 +625,8 @@ private:
bool& negative,
T& mantissa,
int& exponent,
InternalRep const& minMantissa,
InternalRep const& maxMantissa,
internalrep const& minMantissa,
internalrep const& maxMantissa,
MantissaRange::CuspRoundingFix cuspRoundingFix);
template <class T>
@@ -650,25 +650,25 @@ private:
shiftExponent(int exponentDelta) const;
};
constexpr Number::Number(bool negative, InternalRep mantissa, int exponent, Unchecked) noexcept
constexpr Number::Number(bool negative, internalrep mantissa, int exponent, Unchecked) noexcept
: negative_(negative), mantissa_{mantissa}, exponent_{exponent}
{
}
constexpr Number::Number(InternalRep mantissa, int exponent, Unchecked) noexcept
constexpr Number::Number(internalrep mantissa, int exponent, Unchecked) noexcept
: Number(false, mantissa, exponent, Unchecked{})
{
}
static constexpr Number kNumZero{};
inline Number::Number(bool negative, InternalRep mantissa, int exponent, Normalized)
inline Number::Number(bool negative, internalrep mantissa, int exponent, Normalized)
: Number(negative, mantissa, exponent, Unchecked{})
{
normalize(kRange);
}
inline Number::Number(InternalRep mantissa, int exponent, Normalized)
inline Number::Number(internalrep mantissa, int exponent, Normalized)
: Number(false, mantissa, exponent, Normalized{})
{
}
@@ -853,7 +853,7 @@ Number::normalizeToRange() const
static_assert((kMAX + 1) / 10 == kMIN);
bool negative = negative_;
InternalRep mantissa = mantissa_;
internalrep mantissa = mantissa_;
int exponent = exponent_;
if constexpr (std::is_unsigned_v<T>)
+4 -4
View File
@@ -21,11 +21,11 @@ The module xrpl/basics should contain no dependencies on other modules.
- `std::set`
- For sorted containers.
- `xrpl::HashSet`
- `xrpl::hash_set`
- Where inserts and contains need to be O(1).
- For "small" sets, `std::set` might be faster and smaller.
- `xrpl::HardenedHashSet`
- `xrpl::hardened_hash_set`
- For data sets where the key could be manipulated by an attacker
in an attempt to mount an algorithmic complexity attack: see
http://en.wikipedia.org/wiki/Algorithmic_complexity_attack
@@ -33,5 +33,5 @@ The module xrpl/basics should contain no dependencies on other modules.
The following container is deprecated
- `std::unordered_set`
- Use `xrpl::HashSet` instead, which uses a better hashing algorithm.
- Or use `xrpl::HardenedHashSet` to prevent algorithmic complexity attacks.
- Use `xrpl::hash_set` instead, which uses a better hashing algorithm.
- Or use `xrpl::hardened_hash_set` to prevent algorithmic complexity attacks.
+4 -4
View File
@@ -14,20 +14,20 @@ namespace xrpl {
class SHAMapHash
{
UInt256 hash_;
uint256 hash_;
public:
SHAMapHash() = default;
explicit SHAMapHash(UInt256 const& hash) : hash_(hash)
explicit SHAMapHash(uint256 const& hash) : hash_(hash)
{
}
[[nodiscard]] UInt256 const&
[[nodiscard]] uint256 const&
asUInt256() const
{
return hash_;
}
UInt256&
uint256&
asUInt256()
{
return hash_;
+32 -105
View File
@@ -15,11 +15,9 @@
#include <chrono>
#include <cstddef>
#include <cstdint>
#include <deque>
#include <functional>
#include <memory>
#include <mutex>
#include <optional>
#include <string>
#include <thread>
#include <type_traits>
@@ -61,45 +59,34 @@ template <
class T,
bool IsKeyCache = false,
class SharedWeakUnionPointerType = SharedWeakCachePointer<T>,
class SharedPointer = std::shared_ptr<T>,
class SharedPointerType = std::shared_ptr<T>,
class Hash = HardenedHash<>,
class KeyEqual = std::equal_to<Key>,
class Mutex = std::recursive_mutex>
class TaggedCache
{
public:
using MutexType = Mutex;
using mutex_type = Mutex;
using key_type = Key;
using mapped_type = T;
using ClockType = beast::AbstractClock<std::chrono::steady_clock>;
using SharedWeakComboPointerType = SharedWeakUnionPointerType;
using SharedPointerType = SharedPointer;
using clock_type = beast::AbstractClock<std::chrono::steady_clock>;
using shared_weak_combo_pointer_type = SharedWeakUnionPointerType;
using shared_pointer_type = SharedPointerType;
public:
/**
* @param cacheHardCap When positive, a hard upper bound on the number of
* strongly-cached entries, enforced by demoting the approximately
* oldest entry whenever growth would exceed it. 0 disables the cap
* (the periodic sweep alone bounds the cache).
* @param partitions Number of partitions the underlying map is split
* into; defaults to the hardware concurrency. Exposed so tests can
* pin a small, known partition count.
*/
TaggedCache(
std::string const& name,
int size,
ClockType::duration expiration,
ClockType& clock,
clock_type::duration expiration,
clock_type& clock,
beast::Journal journal,
beast::insight::Collector::Ptr const& collector = beast::insight::NullCollector::make(),
int cacheHardCap = 0,
std::optional<std::size_t> partitions = std::nullopt);
beast::insight::Collector::ptr const& collector = beast::insight::NullCollector::make());
public:
/**
* Return the clock associated with the cache.
*/
ClockType&
clock_type&
clock();
/**
@@ -114,13 +101,6 @@ public:
int
getTrackSize() const;
/**
* Returns the number of strong-key slots evictForHardCap has examined
* since construction.
*/
std::uint64_t
getEvictVisits() const;
float
getHitRate();
@@ -259,7 +239,7 @@ public:
bool
retrieve(key_type const& key, T& data);
MutexType&
mutex_type&
peekMutex();
std::vector<key_type>
@@ -285,7 +265,7 @@ public:
private:
SharedPointerType
initialFetch(key_type const& key, std::scoped_lock<MutexType> const& l);
initialFetch(key_type const& key, std::scoped_lock<mutex_type> const& l);
void
collectMetrics();
@@ -297,7 +277,7 @@ private:
Stats(
std::string const& prefix,
Handler const& handler,
beast::insight::Collector::Ptr const& collector)
beast::insight::Collector::ptr const& collector)
: hook(collector->makeHook(handler))
, size(collector->makeGauge(prefix, "size"))
, hitRate(collector->makeGauge(prefix, "hit_rate"))
@@ -316,14 +296,14 @@ private:
class KeyOnlyEntry
{
public:
ClockType::time_point lastAccess;
clock_type::time_point lastAccess;
explicit KeyOnlyEntry(ClockType::time_point const& lastAccess) : lastAccess(lastAccess)
explicit KeyOnlyEntry(clock_type::time_point const& lastAccess) : lastAccess(lastAccess)
{
}
void
touch(ClockType::time_point const& now)
touch(clock_type::time_point const& now)
{
lastAccess = now;
}
@@ -332,13 +312,10 @@ private:
class ValueEntry
{
public:
SharedWeakComboPointerType ptr;
ClockType::time_point lastAccess;
// Stamped by queueStrong each time the entry becomes strong; the
// strong-key slot carrying the same seq is the entry's live slot.
std::uint64_t strongSeq{0};
shared_weak_combo_pointer_type ptr;
clock_type::time_point lastAccess;
ValueEntry(ClockType::time_point const& lastAccess, SharedPointerType const& ptr)
ValueEntry(clock_type::time_point const& lastAccess, shared_pointer_type const& ptr)
: ptr(ptr), lastAccess(lastAccess)
{
}
@@ -366,7 +343,7 @@ private:
return ptr.lock();
}
void
touch(ClockType::time_point const& now)
touch(clock_type::time_point const& now)
{
lastAccess = now;
}
@@ -374,55 +351,35 @@ private:
using Entry = std::conditional_t<IsKeyCache, KeyOnlyEntry, ValueEntry>;
using KeyOnlyCacheType = HardenedPartitionedHashMap<key_type, KeyOnlyEntry, Hash, KeyEqual>;
using KeyOnlyCacheType = hardened_partitioned_hash_map<key_type, KeyOnlyEntry, Hash, KeyEqual>;
using KeyValueCacheType = HardenedPartitionedHashMap<key_type, ValueEntry, Hash, KeyEqual>;
using KeyValueCacheType = hardened_partitioned_hash_map<key_type, ValueEntry, Hash, KeyEqual>;
using CacheType = HardenedPartitionedHashMap<key_type, Entry, Hash, KeyEqual>;
// Counts an entry that just became strong and, under a hard cap, queues
// its key for eviction and evicts down to the cap. Caller holds mutex_.
void
addStrong(CacheType::Iterator const& it);
// Stamps the entry with a new strong seq and appends its key to
// strongRing_, dropping stale slots once they outnumber the live ones.
// Caller holds mutex_.
void
queueStrong(key_type const& key, Entry& entry);
// CLOCK eviction over strongRing_: pops slots from the front, discards
// stale ones, gives `keep` and entries used since they became strong a
// second chance at the back, and demotes the first other strong entry,
// repeating until the count is back under cacheHardCap_ or the demotion
// budget is spent. Amortized O(1) per insert. No-op for key caches;
// caller holds mutex_.
void
evictForHardCap(CacheType::Iterator const& keep);
using cache_type = hardened_partitioned_hash_map<key_type, Entry, Hash, KeyEqual>;
[[nodiscard]] std::thread
sweepHelper(
ClockType::time_point const& whenExpire,
[[maybe_unused]] ClockType::time_point const& now,
KeyValueCacheType::MapType& partition,
clock_type::time_point const& whenExpire,
[[maybe_unused]] clock_type::time_point const& now,
KeyValueCacheType::map_type& partition,
SweptPointersVector& stuffToSweep,
std::atomic<int>& allRemovals,
std::scoped_lock<std::recursive_mutex> const&);
[[nodiscard]] std::thread
sweepHelper(
ClockType::time_point const& whenExpire,
ClockType::time_point const& now,
KeyOnlyCacheType::MapType& partition,
clock_type::time_point const& whenExpire,
clock_type::time_point const& now,
KeyOnlyCacheType::map_type& partition,
SweptPointersVector&,
std::atomic<int>& allRemovals,
std::scoped_lock<std::recursive_mutex> const&);
beast::Journal journal_;
ClockType& clock_;
clock_type& clock_;
Stats stats_;
MutexType mutable mutex_;
mutex_type mutable mutex_;
// Used for logging
std::string name_;
@@ -431,41 +388,11 @@ private:
int const targetSize_;
// Desired maximum cache age
ClockType::duration const targetAge_;
// Hard upper bound on strongly-cached entries, enforced by
// evictForHardCap whenever the strong count grows (fresh inserts and
// weak-to-strong revivals). 0 disables it (sweep-only sizing).
int const cacheHardCap_;
// Total hard-cap evictions (under mutex_); the first marks saturation
// onset for logging.
std::uint64_t hardCapEvictions_{0};
clock_type::duration const targetAge_;
// Number of items cached
int cacheCount_{0};
// A key, the strong seq its entry had when the slot was queued, and the
// time it was queued.
struct StrongSlot
{
key_type key;
std::uint64_t seq;
ClockType::time_point since;
};
// Keys in the order their entries became strong, consumed front-first
// by evictForHardCap. Filled only when cacheHardCap_ > 0. A slot is
// stale once its entry is gone, weak, or strong again under a newer seq.
std::deque<StrongSlot> strongRing_;
// Source of strong seqs; advanced under mutex_.
std::uint64_t strongSeqNext_{0};
// Slots examined by evictForHardCap; read by getEvictVisits.
std::uint64_t evictVisits_{0};
CacheType cache_; // Hold strong reference to recent objects
cache_type cache_; // Hold strong reference to recent objects
std::uint64_t hits_{0};
std::uint64_t misses_{0};
};
+25 -192
View File
@@ -54,12 +54,10 @@ inline TaggedCache<
TaggedCache(
std::string const& name,
int size,
ClockType::duration expiration,
ClockType& clock,
clock_type::duration expiration,
clock_type& clock,
beast::Journal journal,
beast::insight::Collector::Ptr const& collector,
int cacheHardCap,
std::optional<std::size_t> partitions)
beast::insight::Collector::ptr const& collector)
: journal_(journal)
, clock_(clock)
, stats_(
@@ -69,8 +67,6 @@ inline TaggedCache<
, name_(name)
, targetSize_(size)
, targetAge_(expiration)
, cacheHardCap_(cacheHardCap)
, cache_(partitions)
{
}
@@ -85,7 +81,7 @@ template <
class Mutex>
inline auto
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
clock() -> ClockType&
clock() -> clock_type&
{
return clock_;
}
@@ -141,23 +137,6 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
return cache_.size();
}
template <
class Key,
class T,
bool IsKeyCache,
class SharedWeakUnionPointer,
class SharedPointerType,
class Hash,
class KeyEqual,
class Mutex>
inline std::uint64_t
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
getEvictVisits() const
{
std::scoped_lock const lock(mutex_);
return evictVisits_;
}
template <
class Key,
class T,
@@ -191,7 +170,6 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
{
std::scoped_lock const lock(mutex_);
cache_.clear();
strongRing_.clear();
cacheCount_ = 0;
}
@@ -210,7 +188,6 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
{
std::scoped_lock const lock(mutex_);
cache_.clear();
strongRing_.clear();
cacheCount_ = 0;
hits_ = 0;
misses_ = 0;
@@ -242,141 +219,6 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
return true;
}
template <
class Key,
class T,
bool IsKeyCache,
class SharedWeakUnionPointer,
class SharedPointerType,
class Hash,
class KeyEqual,
class Mutex>
inline void
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
addStrong(CacheType::Iterator const& it)
{
++cacheCount_;
if constexpr (!IsKeyCache)
{
if (cacheHardCap_ > 0)
{
queueStrong(it->first, it->second);
if (cacheCount_ > cacheHardCap_)
evictForHardCap(it);
}
}
}
template <
class Key,
class T,
bool IsKeyCache,
class SharedWeakUnionPointer,
class SharedPointerType,
class Hash,
class KeyEqual,
class Mutex>
inline void
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
queueStrong(key_type const& key, Entry& entry)
{
entry.strongSeq = ++strongSeqNext_;
strongRing_.push_back({key, entry.strongSeq, clock_.now()});
// Stale slots accumulate from sweep and del; drop them once
// they outnumber the live ones so the ring stays O(strong entries).
constexpr std::size_t kRingSlack = 1024;
if (strongRing_.size() > 2 * static_cast<std::size_t>(cacheCount_) + kRingSlack)
{
std::erase_if(strongRing_, [this](StrongSlot const& s) {
auto const it = cache_.find(s.key);
return it == cache_.end() || it->second.isWeak() || it->second.strongSeq != s.seq;
});
}
}
template <
class Key,
class T,
bool IsKeyCache,
class SharedWeakUnionPointer,
class SharedPointerType,
class Hash,
class KeyEqual,
class Mutex>
inline void
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
evictForHardCap(CacheType::Iterator const& keep)
{
if constexpr (!IsKeyCache)
{
key_type const keepKey = keep->first;
// Growth paths raise the count by one at a time, so a few demotions
// per call let eviction catch up without stalling them.
constexpr int kMaxDemotionsPerCall = 8;
for (int demotions = 0; cacheCount_ > cacheHardCap_ && demotions < kMaxDemotionsPerCall;
++demotions)
{
// Every strong entry owns one live slot, and only `keep` can be
// re-queued twice in one call, so two passes over the ring reach
// a victim whenever one exists.
bool demoted = false;
for (std::size_t budget = 2 * strongRing_.size();
!demoted && budget > 0 && !strongRing_.empty();
--budget)
{
StrongSlot const slot = strongRing_.front();
strongRing_.pop_front();
++evictVisits_;
auto it = cache_.find(slot.key);
if (it == cache_.end() || it->second.isWeak() || it->second.strongSeq != slot.seq)
continue; // stale: the entry is gone, weak, or re-queued since
if (slot.key == keepKey || it->second.lastAccess > slot.since)
{
// The newest entry stays; one used since it became
// strong gets a second chance at the back.
queueStrong(slot.key, it->second);
continue;
}
if (it->second.ptr.useCount() == 1)
{
// Sole owner: release entirely.
cache_.erase(it);
}
else
{
// Others hold it: keep it weakly tracked.
it->second.ptr.convertToWeak();
}
--cacheCount_;
demoted = true;
// First eviction marks saturation onset; then a heartbeat
// every 100k to avoid flooding.
++hardCapEvictions_;
if (hardCapEvictions_ == 1 || hardCapEvictions_ % 100000 == 0)
{
JLOG(journal_.warn()) << name_ << ": hard-cap eviction #" << hardCapEvictions_
<< " (cap " << cacheHardCap_ << ", strong " << cacheCount_
<< ") - cache saturated, growth now evicts";
}
}
if (!demoted)
{
JLOG(journal_.debug()) << name_ << ": over hard cap " << cacheHardCap_
<< " but no strong entry other than the newest to demote";
return;
}
}
}
}
template <
class Key,
class T,
@@ -395,8 +237,8 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
// is destroyed but still within the main cache lock.
std::vector<SweptPointersVector> allStuffToSweep(cache_.partitions());
ClockType::time_point const now(clock_.now());
ClockType::time_point whenExpire;
clock_type::time_point const now(clock_.now());
clock_type::time_point whenExpire;
auto const start = std::chrono::steady_clock::now();
{
@@ -410,7 +252,7 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
{
whenExpire = now - (targetAge_ * targetSize_ / cache_.size());
ClockType::duration const minimumAge(std::chrono::seconds(1));
clock_type::duration const minimumAge(std::chrono::seconds(1));
if (whenExpire > (now - minimumAge))
whenExpire = now - minimumAge;
@@ -518,14 +360,11 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
if (cit == cache_.end())
{
auto const emplacedIt = cache_
.emplace(
std::piecewise_construct,
std::forward_as_tuple(key),
std::forward_as_tuple(clock_.now(), data))
.first;
// The just-inserted entry is the newest; evictForHardCap keeps it.
addStrong(emplacedIt);
cache_.emplace(
std::piecewise_construct,
std::forward_as_tuple(key),
std::forward_as_tuple(clock_.now(), data));
++cacheCount_;
return false;
}
@@ -575,12 +414,12 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
data = cachedData;
}
addStrong(cit);
++cacheCount_;
return true;
}
entry.ptr = data;
addStrong(cit);
++cacheCount_;
return false;
}
@@ -648,7 +487,7 @@ inline SharedPointerType
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
fetch(key_type const& key)
{
std::scoped_lock<MutexType> const l(mutex_);
std::scoped_lock<mutex_type> const l(mutex_);
auto ret = initialFetch(key, l);
if (!ret)
++misses_;
@@ -702,7 +541,7 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
requires IsKeyCache
{
std::scoped_lock const lock(mutex_);
ClockType::time_point const now(clock_.now());
clock_type::time_point const now(clock_.now());
auto [it, inserted] = cache_.emplace(
std::piecewise_construct, std::forward_as_tuple(key), std::forward_as_tuple(now));
if (!inserted)
@@ -744,7 +583,7 @@ template <
class Mutex>
inline auto
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
peekMutex() -> MutexType&
peekMutex() -> mutex_type&
{
return mutex_;
}
@@ -856,13 +695,7 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
++misses_;
auto const [it, inserted] = cache_.emplace(digest, Entry(clock_.now(), std::move(sle)));
if (!inserted)
{
it->second.touch(clock_.now());
}
else
{
addStrong(it);
}
return it->second.ptr.getStrong();
}
// End CachedSLEs functions.
@@ -878,7 +711,7 @@ template <
class Mutex>
inline SharedPointerType
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
initialFetch(key_type const& key, std::scoped_lock<MutexType> const& l)
initialFetch(key_type const& key, std::scoped_lock<mutex_type> const& l)
{
auto cit = cache_.find(key);
if (cit == cache_.end())
@@ -895,7 +728,7 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
if (entry.isCached())
{
// independent of cache size, so not counted as a hit
addStrong(cit);
++cacheCount_;
entry.touch(clock_.now());
return entry.ptr.getStrong();
}
@@ -943,9 +776,9 @@ template <
inline std::thread
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
sweepHelper(
ClockType::time_point const& whenExpire,
[[maybe_unused]] ClockType::time_point const& now,
KeyValueCacheType::MapType& partition,
clock_type::time_point const& whenExpire,
[[maybe_unused]] clock_type::time_point const& now,
KeyValueCacheType::map_type& partition,
SweptPointersVector& stuffToSweep,
std::atomic<int>& allRemovals,
std::scoped_lock<std::recursive_mutex> const&)
@@ -1023,9 +856,9 @@ template <
inline std::thread
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
sweepHelper(
ClockType::time_point const& whenExpire,
ClockType::time_point const& now,
KeyOnlyCacheType::MapType& partition,
clock_type::time_point const& whenExpire,
clock_type::time_point const& now,
KeyOnlyCacheType::map_type& partition,
SweptPointersVector&,
std::atomic<int>& allRemovals,
std::scoped_lock<std::recursive_mutex> const&)
+15 -15
View File
@@ -33,7 +33,7 @@ template <
class Hash = beast::Uhash<>,
class Pred = std::equal_to<Key>,
class Allocator = std::allocator<std::pair<Key const, Value>>>
using HashMap = std::unordered_map<Key, Value, Hash, Pred, Allocator>;
using hash_map = std::unordered_map<Key, Value, Hash, Pred, Allocator>;
template <
class Key,
@@ -41,62 +41,62 @@ template <
class Hash = beast::Uhash<>,
class Pred = std::equal_to<Key>,
class Allocator = std::allocator<std::pair<Key const, Value>>>
using HashMultimap = std::unordered_multimap<Key, Value, Hash, Pred, Allocator>;
using hash_multimap = std::unordered_multimap<Key, Value, Hash, Pred, Allocator>;
template <
class Value,
class Hash = beast::Uhash<>,
class Pred = std::equal_to<Value>,
class Allocator = std::allocator<Value>>
using HashSet = std::unordered_set<Value, Hash, Pred, Allocator>;
using hash_set = std::unordered_set<Value, Hash, Pred, Allocator>;
template <
class Value,
class Hash = beast::Uhash<>,
class Pred = std::equal_to<Value>,
class Allocator = std::allocator<Value>>
using HashMultiset = std::unordered_multiset<Value, Hash, Pred, Allocator>;
using hash_multiset = std::unordered_multiset<Value, Hash, Pred, Allocator>;
// hardened_hash containers
using StrongHash = beast::Xxhasher;
using strong_hash = beast::Xxhasher;
template <
class Key,
class Value,
class Hash = HardenedHash<StrongHash>,
class Hash = HardenedHash<strong_hash>,
class Pred = std::equal_to<Key>,
class Allocator = std::allocator<std::pair<Key const, Value>>>
using HardenedHashMap = std::unordered_map<Key, Value, Hash, Pred, Allocator>;
using hardened_hash_map = std::unordered_map<Key, Value, Hash, Pred, Allocator>;
template <
class Key,
class Value,
class Hash = HardenedHash<StrongHash>,
class Hash = HardenedHash<strong_hash>,
class Pred = std::equal_to<Key>,
class Allocator = std::allocator<std::pair<Key const, Value>>>
using HardenedPartitionedHashMap = PartitionedUnorderedMap<Key, Value, Hash, Pred, Allocator>;
using hardened_partitioned_hash_map = PartitionedUnorderedMap<Key, Value, Hash, Pred, Allocator>;
template <
class Key,
class Value,
class Hash = HardenedHash<StrongHash>,
class Hash = HardenedHash<strong_hash>,
class Pred = std::equal_to<Key>,
class Allocator = std::allocator<std::pair<Key const, Value>>>
using HardenedHashMultimap = std::unordered_multimap<Key, Value, Hash, Pred, Allocator>;
using hardened_hash_multimap = std::unordered_multimap<Key, Value, Hash, Pred, Allocator>;
template <
class Value,
class Hash = HardenedHash<StrongHash>,
class Hash = HardenedHash<strong_hash>,
class Pred = std::equal_to<Value>,
class Allocator = std::allocator<Value>>
using HardenedHashSet = std::unordered_set<Value, Hash, Pred, Allocator>;
using hardened_hash_set = std::unordered_set<Value, Hash, Pred, Allocator>;
template <
class Value,
class Hash = HardenedHash<StrongHash>,
class Hash = HardenedHash<strong_hash>,
class Pred = std::equal_to<Value>,
class Allocator = std::allocator<Value>>
using HardenedHashMultiset = std::unordered_multiset<Value, Hash, Pred, Allocator>;
using hardened_hash_multiset = std::unordered_multiset<Value, Hash, Pred, Allocator>;
} // namespace xrpl
+10 -16
View File
@@ -111,7 +111,7 @@ public:
using const_iterator = const_pointer;
using reverse_iterator = std::reverse_iterator<iterator>;
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
using TagType = Tag;
using tag_type = Tag;
pointer
data()
@@ -575,16 +575,10 @@ public:
}
};
using UInt128 = BaseUInt<128>;
using UInt160 = BaseUInt<160>;
using UInt256 = BaseUInt<256>;
using UInt192 = BaseUInt<192>;
// TODO [#8340]: Legacy names still used by external consumers of libxrpl (e.g. rpc-spec).
// Do not use in new code; remove once those consumers have migrated.
using uint160 = UInt160; // NOLINT(readability-identifier-naming)
using uint256 = UInt256; // NOLINT(readability-identifier-naming)
using uint192 = UInt192; // NOLINT(readability-identifier-naming)
using uint128 = BaseUInt<128>;
using uint160 = BaseUInt<160>;
using uint256 = BaseUInt<256>;
using uint192 = BaseUInt<192>;
template <std::size_t Bits, class Tag>
[[nodiscard]] constexpr std::strong_ordering
@@ -676,7 +670,7 @@ operator<<(std::ostream& out, BaseUInt<Bits, Tag> const& u)
template <>
inline std::size_t
extract(UInt256 const& key)
extract(uint256 const& key)
{
std::size_t result = 0;
// Use memcpy to avoid unaligned UB
@@ -686,10 +680,10 @@ extract(UInt256 const& key)
}
#ifndef __INTELLISENSE__
static_assert(sizeof(UInt128) == 128 / 8, "There should be no padding bytes");
static_assert(sizeof(UInt160) == 160 / 8, "There should be no padding bytes");
static_assert(sizeof(UInt192) == 192 / 8, "There should be no padding bytes");
static_assert(sizeof(UInt256) == 256 / 8, "There should be no padding bytes");
static_assert(sizeof(uint128) == 128 / 8, "There should be no padding bytes");
static_assert(sizeof(uint160) == 160 / 8, "There should be no padding bytes");
static_assert(sizeof(uint192) == 192 / 8, "There should be no padding bytes");
static_assert(sizeof(uint256) == 256 / 8, "There should be no padding bytes");
#endif
} // namespace xrpl
+2 -2
View File
@@ -16,10 +16,10 @@ namespace xrpl {
// A few handy aliases
using Days =
using days =
std::chrono::duration<int, std::ratio_multiply<std::chrono::hours::period, std::ratio<24>>>;
using Weeks = std::chrono::duration<int, std::ratio_multiply<Days::period, std::ratio<7>>>;
using weeks = std::chrono::duration<int, std::ratio_multiply<days::period, std::ratio<7>>>;
/**
* Clock for measuring the network time.
+3 -3
View File
@@ -11,10 +11,10 @@ namespace xrpl {
namespace detail {
using SeedPair = std::pair<std::uint64_t, std::uint64_t>;
using seed_pair = std::pair<std::uint64_t, std::uint64_t>;
template <bool = true>
SeedPair
seed_pair
makeSeedPair() noexcept
{
struct StateT
@@ -71,7 +71,7 @@ template <class HashAlgorithm = beast::Xxhasher>
class HardenedHash
{
private:
detail::SeedPair seeds_{detail::makeSeedPair<>()};
detail::seed_pair seeds_{detail::makeSeedPair<>()};
public:
using result_type = HashAlgorithm::result_type;
+12 -12
View File
@@ -53,19 +53,19 @@ public:
using const_reference = value_type const&;
using pointer = value_type*;
using const_pointer = value_type const*;
using MapType = std::unordered_map<key_type, mapped_type, hasher, key_equal, allocator_type>;
using PartitionMapType = std::vector<MapType>;
using map_type = std::unordered_map<key_type, mapped_type, hasher, key_equal, allocator_type>;
using partition_map_type = std::vector<map_type>;
struct Iterator
{
using iterator_category = std::forward_iterator_tag;
PartitionMapType* map{nullptr};
PartitionMapType::iterator ait{};
MapType::iterator mit;
partition_map_type* map{nullptr};
partition_map_type::iterator ait{};
map_type::iterator mit;
Iterator() = default;
Iterator(PartitionMapType* m) : map(m)
Iterator(partition_map_type* m) : map(m)
{
}
@@ -122,13 +122,13 @@ public:
{
using iterator_category = std::forward_iterator_tag;
PartitionMapType* map{nullptr};
PartitionMapType::iterator ait{};
MapType::iterator mit;
partition_map_type* map{nullptr};
partition_map_type::iterator ait{};
map_type::iterator mit;
ConstIterator() = default;
ConstIterator(PartitionMapType* m) : map(m)
ConstIterator(partition_map_type* m) : map(m)
{
}
@@ -234,7 +234,7 @@ public:
return partitions_;
}
PartitionMapType&
partition_map_type&
map()
{
return map_;
@@ -377,7 +377,7 @@ public:
}
private:
mutable PartitionMapType map_{};
mutable partition_map_type map_{};
};
} // namespace xrpl
+13 -13
View File
@@ -14,13 +14,13 @@ namespace xrpl {
#ifndef __INTELLISENSE__
static_assert(
// NOLINTNEXTLINE(misc-redundant-expression)
std::is_integral_v<beast::XorShiftEngine::result_type> &&
std::is_unsigned_v<beast::XorShiftEngine::result_type>,
std::is_integral_v<beast::xor_shift_engine::result_type> &&
std::is_unsigned_v<beast::xor_shift_engine::result_type>,
"The XRPL default PRNG engine must return an unsigned integral type.");
static_assert(
// NOLINTNEXTLINE(misc-redundant-expression)
std::numeric_limits<beast::XorShiftEngine::result_type>::max() >=
std::numeric_limits<beast::xor_shift_engine::result_type>::max() >=
std::numeric_limits<std::uint64_t>::max(),
"The XRPL default PRNG engine return must be at least 64 bits wide.");
#endif
@@ -30,7 +30,7 @@ namespace detail {
// Determines if a type can be called like an Engine
// NOLINTNEXTLINE(readability-redundant-typename): typename required by MSVC
template <class Engine, class Result = typename Engine::result_type>
using IsEngine = std::is_invocable_r<Result, Engine>;
using is_engine = std::is_invocable_r<Result, Engine>;
} // namespace detail
/**
@@ -44,28 +44,28 @@ using IsEngine = std::is_invocable_r<Result, Engine>;
* Each thread gets its own instance of the engine which
* will be randomly seeded.
*/
inline beast::XorShiftEngine&
inline beast::xor_shift_engine&
defaultPrng()
{
// This is used to seed the thread-specific PRNGs on demand
static beast::XorShiftEngine kSeeder = [] {
static beast::xor_shift_engine kSeeder = [] {
std::random_device rng;
std::uniform_int_distribution<std::uint64_t> distribution{1};
return beast::XorShiftEngine(distribution(rng));
return beast::xor_shift_engine(distribution(rng));
}();
// This protects the seeder
static std::mutex kM;
// The thread-specific PRNGs:
thread_local beast::XorShiftEngine kEngine = [] {
thread_local beast::xor_shift_engine kEngine = [] {
std::uint64_t seed = 0;
{
std::scoped_lock const lk(kM);
std::uniform_int_distribution<std::uint64_t> distribution{1};
seed = distribution(kSeeder);
}
return beast::XorShiftEngine{seed};
return beast::xor_shift_engine{seed};
}();
return kEngine;
@@ -95,7 +95,7 @@ defaultPrng()
template <class Engine, class Integral>
Integral
randInt(Engine& engine, Integral min, Integral max)
requires(std::is_integral_v<Integral> && detail::IsEngine<Engine>::value)
requires(std::is_integral_v<Integral> && detail::is_engine<Engine>::value)
{
XRPL_ASSERT(max > min, "xrpl::randInt : max over min inputs");
@@ -116,7 +116,7 @@ randInt(Integral min, Integral max)
template <class Engine, class Integral>
Integral
randInt(Engine& engine, Integral max)
requires(std::is_integral_v<Integral> && detail::IsEngine<Engine>::value)
requires(std::is_integral_v<Integral> && detail::is_engine<Engine>::value)
{
return randInt(engine, Integral(0), max);
}
@@ -132,7 +132,7 @@ randInt(Integral max)
template <class Integral, class Engine>
Integral
randInt(Engine& engine)
requires(std::is_integral_v<Integral> && detail::IsEngine<Engine>::value)
requires(std::is_integral_v<Integral> && detail::is_engine<Engine>::value)
{
return randInt(engine, std::numeric_limits<Integral>::max());
}
@@ -155,7 +155,7 @@ Byte
randByte(Engine& engine)
requires(
(std::is_same_v<Byte, unsigned char> || std::is_same_v<Byte, std::uint8_t>) &&
detail::IsEngine<Engine>::value)
detail::is_engine<Engine>::value)
{
return static_cast<Byte>(randInt<Engine, std::uint32_t>(
engine, std::numeric_limits<Byte>::min(), std::numeric_limits<Byte>::max()));
+1 -1
View File
@@ -40,7 +40,7 @@ private:
public:
using value_type = Int;
using TagType = Tag;
using tag_type = Tag;
TaggedInteger() = default;
-10
View File
@@ -1,10 +0,0 @@
# beast's containers, clocks and Journal streambuf model std concepts, which mandate
# snake_case member type names.
#
# clang-tidy replaces rather than merges this option, so the list is the
# top-level one restated plus the 20 name(s) needed only here:
# allocator_type argument_type char_type const_local_iterator const_pointer const_reverse_iterator first_argument_type hasher int_type key_compare key_equal local_iterator native_handle_type off_type pos_type reverse_iterator second_argument_type traits_type type value_compare
InheritParentConfig: true
CheckOptions:
readability-identifier-naming.TypeAliasIgnoredRegexp: "^(allocator_type|argument_type|char_type|const_iterator|const_local_iterator|const_pointer|const_reference|const_reverse_iterator|difference_type|duration|first_argument_type|hasher|int_type|iterator|iterator_category|key_compare|key_equal|key_type|local_iterator|mapped_type|native_handle_type|off_type|period|pointer|pos_type|reference|rep|result_type|reverse_iterator|second_argument_type|size_type|time_point|traits_type|type|value_compare|value_type)$"
readability-identifier-naming.TypedefIgnoredRegexp: "^(allocator_type|argument_type|char_type|const_iterator|const_local_iterator|const_pointer|const_reference|const_reverse_iterator|difference_type|duration|first_argument_type|hasher|int_type|iterator|iterator_category|key_compare|key_equal|key_type|local_iterator|mapped_type|native_handle_type|off_type|period|pointer|pos_type|reference|rep|result_type|reverse_iterator|second_argument_type|size_type|time_point|traits_type|type|value_compare|value_type)$"
+5 -5
View File
@@ -9,7 +9,7 @@ namespace beast {
* an instance of the class can be dependency injected, facilitating
* unit tests where time may be controlled.
*
* An AbstractClock inherits all the nested types of the Clock
* An abstract_clock inherits all the nested types of the Clock
* template parameter.
*
* Example:
@@ -18,9 +18,9 @@ namespace beast {
*
* struct Implementation
* {
* using ClockType = AbstractClock<std::chrono::steady_clock>;
* ClockType& clock_;
* explicit Implementation(ClockType& clock)
* using clock_type = abstract_clock <std::chrono::steady_clock>;
* clock_type& clock_;
* explicit Implementation (clock_type& clock)
* : clock_(clock)
* {
* }
@@ -39,7 +39,7 @@ public:
using period = Clock::period;
using duration = Clock::duration;
using time_point = Clock::time_point;
using ClockType = Clock;
using clock_type = Clock;
static bool const is_steady = Clock::is_steady; // NOLINT(readability-identifier-naming)
+1 -1
View File
@@ -15,6 +15,6 @@ template <
class Clock = std::chrono::steady_clock,
class Compare = std::less<Key>,
class Allocator = std::allocator<std::pair<Key const, T>>>
using AgedMap = detail::AgedOrderedContainer<false, true, Key, T, Clock, Compare, Allocator>;
using aged_map = detail::AgedOrderedContainer<false, true, Key, T, Clock, Compare, Allocator>;
} // namespace beast
+1 -1
View File
@@ -15,6 +15,6 @@ template <
class Clock = std::chrono::steady_clock,
class Compare = std::less<Key>,
class Allocator = std::allocator<std::pair<Key const, T>>>
using AgedMultimap = detail::AgedOrderedContainer<true, true, Key, T, Clock, Compare, Allocator>;
using aged_multimap = detail::AgedOrderedContainer<true, true, Key, T, Clock, Compare, Allocator>;
} // namespace beast
+1 -1
View File
@@ -13,7 +13,7 @@ template <
class Clock = std::chrono::steady_clock,
class Compare = std::less<Key>,
class Allocator = std::allocator<Key>>
using AgedMultiset =
using aged_multiset =
detail::AgedOrderedContainer<true, false, Key, void, Clock, Compare, Allocator>;
} // namespace beast
+1 -1
View File
@@ -13,6 +13,6 @@ template <
class Clock = std::chrono::steady_clock,
class Compare = std::less<Key>,
class Allocator = std::allocator<Key>>
using AgedSet = detail::AgedOrderedContainer<false, false, Key, void, Clock, Compare, Allocator>;
using aged_set = detail::AgedOrderedContainer<false, false, Key, void, Clock, Compare, Allocator>;
} // namespace beast
@@ -16,7 +16,7 @@ template <
class Hash = std::hash<Key>,
class KeyEqual = std::equal_to<Key>,
class Allocator = std::allocator<std::pair<Key const, T>>>
using AgedUnorderedMap =
using aged_unordered_map =
detail::AgedUnorderedContainer<false, true, Key, T, Clock, Hash, KeyEqual, Allocator>;
} // namespace beast
@@ -16,7 +16,7 @@ template <
class Hash = std::hash<Key>,
class KeyEqual = std::equal_to<Key>,
class Allocator = std::allocator<std::pair<Key const, T>>>
using AgedUnorderedMultimap =
using aged_unordered_multimap =
detail::AgedUnorderedContainer<true, true, Key, T, Clock, Hash, KeyEqual, Allocator>;
} // namespace beast
@@ -14,7 +14,7 @@ template <
class Hash = std::hash<Key>,
class KeyEqual = std::equal_to<Key>,
class Allocator = std::allocator<Key>>
using AgedUnorderedMultiset =
using aged_unordered_multiset =
detail::AgedUnorderedContainer<true, false, Key, void, Clock, Hash, KeyEqual, Allocator>;
} // namespace beast
@@ -14,7 +14,7 @@ template <
class Hash = std::hash<Key>,
class KeyEqual = std::equal_to<Key>,
class Allocator = std::allocator<Key>>
using AgedUnorderedSet =
using aged_unordered_set =
detail::AgedUnorderedContainer<false, false, Key, void, Clock, Hash, KeyEqual, Allocator>;
} // namespace beast
@@ -4,7 +4,12 @@
#include <type_traits>
#include <utility>
namespace beast::detail {
namespace beast {
template <bool, bool, class, class, class, class, class>
class aged_ordered_container;
namespace detail {
// If Iterator is SCARY then this iterator will be as well.
template <bool IsConst, class Iterator>
@@ -139,4 +144,6 @@ private:
Iterator iter_;
};
} // namespace beast::detail
} // namespace detail
} // namespace beast
@@ -54,7 +54,7 @@ struct IsBoostReverseIterator<boost::intrusive::reverse_iterator<It>> : std::tru
* whose items expire after a certain amount of time. The chronological
* iterators allow for fully customizable expiration strategies.
*
* @see AgedSet, AgedMultiset, AgedMap, AgedMultimap
* @see aged_set, aged_multiset, aged_map, aged_multimap
*/
template <
bool IsMulti,
@@ -67,9 +67,9 @@ template <
class AgedOrderedContainer
{
public:
using ClockType = AbstractClock<Clock>;
using time_point = ClockType::time_point;
using duration = ClockType::duration;
using clock_type = AbstractClock<Clock>;
using time_point = clock_type::time_point;
using duration = clock_type::duration;
using key_type = Key;
using mapped_type = T;
using value_type = std::conditional_t<IsMap, std::pair<Key const, T>, Key>;
@@ -77,9 +77,9 @@ public:
using difference_type = std::ptrdiff_t;
// Introspection (for unit tests)
using IsUnorderedType = std::false_type;
using IsMultiType = std::integral_constant<bool, IsMulti>;
using IsMapType = std::integral_constant<bool, IsMap>;
using is_unordered = std::false_type;
using is_multi = std::integral_constant<bool, IsMulti>;
using is_map = std::integral_constant<bool, IsMap>;
private:
static Key const&
@@ -127,8 +127,8 @@ private:
class PairValueCompare : public Compare
{
public:
using FirstArgument = value_type;
using SecondArgument = value_type;
using first_argument = value_type;
using second_argument = value_type;
using result_type = bool;
bool
@@ -156,8 +156,8 @@ private:
class KeyValueCompare : public Compare
{
public:
using FirstArgument = Key;
using SecondArgument = Element;
using first_argument = Key;
using second_argument = Element;
using result_type = bool;
KeyValueCompare() = default;
@@ -197,10 +197,10 @@ private:
}
};
using ListType =
using list_type =
boost::intrusive::make_list<Element, boost::intrusive::constant_time_size<false>>::type;
using ContType = std::conditional_t<
using cont_type = std::conditional_t<
IsMulti,
typename boost::intrusive::make_multiset<
Element,
@@ -219,20 +219,20 @@ private:
public beast::detail::EmptyBaseOptimization<ElementAllocator>
{
public:
explicit ConfigT(ClockType& clock) : clock(clock)
explicit ConfigT(clock_type& clock) : clock(clock)
{
}
ConfigT(ClockType& clock, Compare const& comp) : KeyValueCompare(comp), clock(clock)
ConfigT(clock_type& clock, Compare const& comp) : KeyValueCompare(comp), clock(clock)
{
}
ConfigT(ClockType& clock, Allocator const& alloc)
ConfigT(clock_type& clock, Allocator const& alloc)
: beast::detail::EmptyBaseOptimization<ElementAllocator>(alloc), clock(clock)
{
}
ConfigT(ClockType& clock, Compare const& comp, Allocator const& alloc)
ConfigT(clock_type& clock, Compare const& comp, Allocator const& alloc)
: KeyValueCompare(comp)
, beast::detail::EmptyBaseOptimization<ElementAllocator>(alloc)
, clock(clock)
@@ -328,7 +328,7 @@ private:
return beast::detail::EmptyBaseOptimization<ElementAllocator>::member();
}
std::reference_wrapper<ClockType> clock;
std::reference_wrapper<clock_type> clock;
};
template <class... Args>
@@ -383,12 +383,12 @@ public:
// A set iterator (IsMap==false) is always const
// because the elements of a set are immutable.
using iterator = beast::detail::AgedContainerIterator<!IsMap, typename ContType::iterator>;
using const_iterator = beast::detail::AgedContainerIterator<true, typename ContType::iterator>;
using iterator = beast::detail::AgedContainerIterator<!IsMap, typename cont_type::iterator>;
using const_iterator = beast::detail::AgedContainerIterator<true, typename cont_type::iterator>;
using reverse_iterator =
beast::detail::AgedContainerIterator<!IsMap, typename ContType::reverse_iterator>;
beast::detail::AgedContainerIterator<!IsMap, typename cont_type::reverse_iterator>;
using const_reverse_iterator =
beast::detail::AgedContainerIterator<true, typename ContType::reverse_iterator>;
beast::detail::AgedContainerIterator<true, typename cont_type::reverse_iterator>;
//--------------------------------------------------------------------------
//
@@ -406,13 +406,13 @@ public:
public:
// A set iterator (IsMap==false) is always const
// because the elements of a set are immutable.
using iterator = beast::detail::AgedContainerIterator<!IsMap, typename ListType::iterator>;
using iterator = beast::detail::AgedContainerIterator<!IsMap, typename list_type::iterator>;
using const_iterator =
beast::detail::AgedContainerIterator<true, typename ListType::iterator>;
beast::detail::AgedContainerIterator<true, typename list_type::iterator>;
using reverse_iterator =
beast::detail::AgedContainerIterator<!IsMap, typename ListType::reverse_iterator>;
beast::detail::AgedContainerIterator<!IsMap, typename list_type::reverse_iterator>;
using const_reverse_iterator =
beast::detail::AgedContainerIterator<true, typename ListType::reverse_iterator>;
beast::detail::AgedContainerIterator<true, typename list_type::reverse_iterator>;
iterator
begin()
@@ -509,7 +509,7 @@ public:
private:
friend class AgedOrderedContainer;
ListType mutable list_;
list_type mutable list_;
} chronological;
//--------------------------------------------------------------------------
@@ -520,28 +520,28 @@ public:
AgedOrderedContainer() = delete;
explicit AgedOrderedContainer(ClockType& clock);
explicit AgedOrderedContainer(clock_type& clock);
AgedOrderedContainer(ClockType& clock, Compare const& comp);
AgedOrderedContainer(clock_type& clock, Compare const& comp);
AgedOrderedContainer(ClockType& clock, Allocator const& alloc);
AgedOrderedContainer(clock_type& clock, Allocator const& alloc);
AgedOrderedContainer(ClockType& clock, Compare const& comp, Allocator const& alloc);
AgedOrderedContainer(clock_type& clock, Compare const& comp, Allocator const& alloc);
template <class InputIt>
AgedOrderedContainer(InputIt first, InputIt last, ClockType& clock);
AgedOrderedContainer(InputIt first, InputIt last, clock_type& clock);
template <class InputIt>
AgedOrderedContainer(InputIt first, InputIt last, ClockType& clock, Compare const& comp);
AgedOrderedContainer(InputIt first, InputIt last, clock_type& clock, Compare const& comp);
template <class InputIt>
AgedOrderedContainer(InputIt first, InputIt last, ClockType& clock, Allocator const& alloc);
AgedOrderedContainer(InputIt first, InputIt last, clock_type& clock, Allocator const& alloc);
template <class InputIt>
AgedOrderedContainer(
InputIt first,
InputIt last,
ClockType& clock,
clock_type& clock,
Compare const& comp,
Allocator const& alloc);
@@ -556,21 +556,21 @@ public:
AgedOrderedContainer&& other,
Allocator const& alloc);
AgedOrderedContainer(std::initializer_list<value_type> init, ClockType& clock);
AgedOrderedContainer(std::initializer_list<value_type> init, clock_type& clock);
AgedOrderedContainer(
std::initializer_list<value_type> init,
ClockType& clock,
clock_type& clock,
Compare const& comp);
AgedOrderedContainer(
std::initializer_list<value_type> init,
ClockType& clock,
clock_type& clock,
Allocator const& alloc);
AgedOrderedContainer(
std::initializer_list<value_type> init,
ClockType& clock,
clock_type& clock,
Compare const& comp,
Allocator const& alloc);
@@ -591,13 +591,13 @@ public:
return config_.alloc();
}
ClockType&
clock_type&
clock()
{
return config_.clock;
}
ClockType const&
clock_type const&
clock() const
{
return config_.clock;
@@ -820,7 +820,7 @@ public:
template <class P, bool MaybeMap = IsMap>
std::conditional_t<IsMulti, iterator, std::pair<iterator, bool>>
insert(P&& value)
requires(MaybeMap && std::is_constructible_v<value_type, P&&>)
requires(MaybeMap && std::is_constructible_v<value_type, P &&>)
{
return emplace(std::forward<P>(value));
}
@@ -829,7 +829,7 @@ public:
template <class P, bool MaybeMap = IsMap>
std::conditional_t<IsMulti, iterator, std::pair<iterator, bool>>
insert(const_iterator hint, P&& value)
requires(MaybeMap && std::is_constructible_v<value_type, P&&>)
requires(MaybeMap && std::is_constructible_v<value_type, P &&>)
{
return emplaceHint(hint, std::forward<P>(value));
}
@@ -1121,7 +1121,7 @@ private:
void
touch(
beast::detail::AgedContainerIterator<IsConst, Iterator> pos,
ClockType::time_point const& now)
clock_type::time_point const& now)
requires(!IsBoostReverseIterator<Iterator>::value);
template <
@@ -1138,21 +1138,21 @@ private:
private:
ConfigT config_;
ContType mutable cont_;
cont_type mutable cont_;
};
//------------------------------------------------------------------------------
template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compare, class Allocator>
AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::AgedOrderedContainer(
ClockType& clock)
clock_type& clock)
: config_(clock)
{
}
template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compare, class Allocator>
AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::AgedOrderedContainer(
ClockType& clock,
clock_type& clock,
Compare const& comp)
: config_(clock, comp), cont_(comp)
{
@@ -1160,7 +1160,7 @@ AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::AgedOrd
template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compare, class Allocator>
AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::AgedOrderedContainer(
ClockType& clock,
clock_type& clock,
Allocator const& alloc)
: config_(clock, alloc)
{
@@ -1168,7 +1168,7 @@ AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::AgedOrd
template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compare, class Allocator>
AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::AgedOrderedContainer(
ClockType& clock,
clock_type& clock,
Compare const& comp,
Allocator const& alloc)
: config_(clock, comp, alloc), cont_(comp)
@@ -1180,7 +1180,7 @@ template <class InputIt>
AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::AgedOrderedContainer(
InputIt first,
InputIt last,
ClockType& clock)
clock_type& clock)
: config_(clock)
{
insert(first, last);
@@ -1191,7 +1191,7 @@ template <class InputIt>
AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::AgedOrderedContainer(
InputIt first,
InputIt last,
ClockType& clock,
clock_type& clock,
Compare const& comp)
: config_(clock, comp), cont_(comp)
{
@@ -1203,7 +1203,7 @@ template <class InputIt>
AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::AgedOrderedContainer(
InputIt first,
InputIt last,
ClockType& clock,
clock_type& clock,
Allocator const& alloc)
: config_(clock, alloc)
{
@@ -1215,7 +1215,7 @@ template <class InputIt>
AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::AgedOrderedContainer(
InputIt first,
InputIt last,
ClockType& clock,
clock_type& clock,
Compare const& comp,
Allocator const& alloc)
: config_(clock, comp, alloc), cont_(comp)
@@ -1261,7 +1261,7 @@ AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::AgedOrd
template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compare, class Allocator>
AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::AgedOrderedContainer(
std::initializer_list<value_type> init,
ClockType& clock)
clock_type& clock)
: config_(clock)
{
insert(init.begin(), init.end());
@@ -1270,7 +1270,7 @@ AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::AgedOrd
template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compare, class Allocator>
AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::AgedOrderedContainer(
std::initializer_list<value_type> init,
ClockType& clock,
clock_type& clock,
Compare const& comp)
: config_(clock, comp), cont_(comp)
{
@@ -1280,7 +1280,7 @@ AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::AgedOrd
template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compare, class Allocator>
AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::AgedOrderedContainer(
std::initializer_list<value_type> init,
ClockType& clock,
clock_type& clock,
Allocator const& alloc)
: config_(clock, alloc)
{
@@ -1290,7 +1290,7 @@ AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::AgedOrd
template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compare, class Allocator>
AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::AgedOrderedContainer(
std::initializer_list<value_type> init,
ClockType& clock,
clock_type& clock,
Compare const& comp,
Allocator const& alloc)
: config_(clock, comp, alloc), cont_(comp)
@@ -1372,7 +1372,7 @@ std::conditional_t<IsMap, T, void*>&
AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::operator[](Key const& key)
requires(MaybeMap && !MaybeMulti)
{
typename ContType::insert_commit_data d;
typename cont_type::insert_commit_data d;
auto const result(cont_.insert_check(key, std::cref(config_.keyCompare()), d));
if (result.second)
{
@@ -1391,7 +1391,7 @@ std::conditional_t<IsMap, T, void*>&
AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::operator[](Key&& key)
requires(MaybeMap && !MaybeMulti)
{
typename ContType::insert_commit_data d;
typename cont_type::insert_commit_data d;
auto const result(cont_.insert_check(key, std::cref(config_.keyCompare()), d));
if (result.second)
{
@@ -1426,7 +1426,7 @@ AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::insert(
value_type const& value) -> std::pair<iterator, bool>
requires(!MaybeMulti)
{
typename ContType::insert_commit_data d;
typename cont_type::insert_commit_data d;
auto const result(cont_.insert_check(extract(value), std::cref(config_.keyCompare()), d));
if (result.second)
{
@@ -1461,7 +1461,7 @@ AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::insert(
-> std::pair<iterator, bool>
requires(!MaybeMulti && !MaybeMap)
{
typename ContType::insert_commit_data d;
typename cont_type::insert_commit_data d;
auto const result(cont_.insert_check(extract(value), std::cref(config_.keyCompare()), d));
if (result.second)
{
@@ -1499,7 +1499,7 @@ AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::insert(
value_type const& value) -> iterator
requires(!MaybeMulti)
{
typename ContType::insert_commit_data d;
typename cont_type::insert_commit_data d;
auto const result(
cont_.insert_check(hint.iterator(), extract(value), std::cref(config_.keyCompare()), d));
if (result.second)
@@ -1521,7 +1521,7 @@ AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::insert(
value_type&& value) -> iterator
requires(!MaybeMulti)
{
typename ContType::insert_commit_data d;
typename cont_type::insert_commit_data d;
auto const result(
cont_.insert_check(hint.iterator(), extract(value), std::cref(config_.keyCompare()), d));
if (result.second)
@@ -1545,7 +1545,7 @@ AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::emplace
// VFALCO NOTE Its unfortunate that we need to
// construct element here
Element* const p(newElement(std::forward<Args>(args)...));
typename ContType::insert_commit_data d;
typename cont_type::insert_commit_data d;
auto const result(cont_.insert_check(extract(p->value), std::cref(config_.keyCompare()), d));
if (result.second)
{
@@ -1584,7 +1584,7 @@ AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::emplace
// VFALCO NOTE Its unfortunate that we need to
// construct element here
Element* const p(newElement(std::forward<Args>(args)...));
typename ContType::insert_commit_data d;
typename cont_type::insert_commit_data d;
auto const result(
cont_.insert_check(hint.iterator(), extract(p->value), std::cref(config_.keyCompare()), d));
if (result.second)
@@ -1721,7 +1721,7 @@ template <bool IsConst, class Iterator>
void
AgedOrderedContainer<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::touch(
beast::detail::AgedContainerIterator<IsConst, Iterator> pos,
ClockType::time_point const& now)
clock_type::time_point const& now)
requires(!IsBoostReverseIterator<Iterator>::value)
{
auto& e(*pos.iterator());
@@ -59,8 +59,8 @@ namespace detail {
* whose items expire after a certain amount of time. The chronological
* iterators allow for fully customizable expiration strategies.
*
* @see AgedUnorderedSet, AgedUnorderedMultiset
* @see AgedUnorderedMap, AgedUnorderedMultimap
* @see aged_unordered_set, aged_unordered_multiset
* @see aged_unordered_map, aged_unordered_multimap
*/
template <
bool IsMulti,
@@ -74,9 +74,9 @@ template <
class AgedUnorderedContainer
{
public:
using ClockType = AbstractClock<Clock>;
using time_point = ClockType::time_point;
using duration = ClockType::duration;
using clock_type = AbstractClock<Clock>;
using time_point = clock_type::time_point;
using duration = clock_type::duration;
using key_type = Key;
using mapped_type = T;
using value_type = std::conditional_t<IsMap, std::pair<Key const, T>, Key>;
@@ -84,9 +84,9 @@ public:
using difference_type = std::ptrdiff_t;
// Introspection (for unit tests)
using IsUnorderedType = std::true_type;
using IsMultiType = std::integral_constant<bool, IsMulti>;
using IsMapType = std::integral_constant<bool, IsMap>;
using is_unordered = std::true_type;
using is_multi = std::integral_constant<bool, IsMulti>;
using is_map = std::integral_constant<bool, IsMap>;
private:
static Key const&
@@ -208,10 +208,10 @@ private:
}
};
using ListType =
using list_type =
boost::intrusive::make_list<Element, boost::intrusive::constant_time_size<false>>::type;
using ContType = std::conditional_t<
using cont_type = std::conditional_t<
IsMulti,
typename boost::intrusive::make_unordered_multiset<
Element,
@@ -226,8 +226,8 @@ private:
boost::intrusive::equal<KeyValueEqual>,
boost::intrusive::cache_begin<true>>::type>;
using BucketType = ContType::bucket_type;
using BucketTraits = ContType::bucket_traits;
using bucket_type = cont_type::bucket_type;
using bucket_traits = cont_type::bucket_traits;
using ElementAllocator = std::allocator_traits<Allocator>::template rebind_alloc<Element>;
@@ -242,36 +242,36 @@ private:
private beast::detail::EmptyBaseOptimization<ElementAllocator>
{
public:
explicit ConfigT(ClockType& clock) : clock(clock)
explicit ConfigT(clock_type& clock) : clock(clock)
{
}
ConfigT(ClockType& clock, Hash const& hash) : ValueHash(hash), clock(clock)
ConfigT(clock_type& clock, Hash const& hash) : ValueHash(hash), clock(clock)
{
}
ConfigT(ClockType& clock, KeyEqual const& keyEqual) : KeyValueEqual(keyEqual), clock(clock)
ConfigT(clock_type& clock, KeyEqual const& keyEqual) : KeyValueEqual(keyEqual), clock(clock)
{
}
ConfigT(ClockType& clock, Allocator const& alloc)
ConfigT(clock_type& clock, Allocator const& alloc)
: beast::detail::EmptyBaseOptimization<ElementAllocator>(alloc), clock(clock)
{
}
ConfigT(ClockType& clock, Hash const& hash, KeyEqual const& keyEqual)
ConfigT(clock_type& clock, Hash const& hash, KeyEqual const& keyEqual)
: ValueHash(hash), KeyValueEqual(keyEqual), clock(clock)
{
}
ConfigT(ClockType& clock, Hash const& hash, Allocator const& alloc)
ConfigT(clock_type& clock, Hash const& hash, Allocator const& alloc)
: ValueHash(hash)
, beast::detail::EmptyBaseOptimization<ElementAllocator>(alloc)
, clock(clock)
{
}
ConfigT(ClockType& clock, KeyEqual const& keyEqual, Allocator const& alloc)
ConfigT(clock_type& clock, KeyEqual const& keyEqual, Allocator const& alloc)
: KeyValueEqual(keyEqual)
, beast::detail::EmptyBaseOptimization<ElementAllocator>(alloc)
, clock(clock)
@@ -279,7 +279,7 @@ private:
}
ConfigT(
ClockType& clock,
clock_type& clock,
Hash const& hash,
KeyEqual const& keyEqual,
Allocator const& alloc)
@@ -405,29 +405,29 @@ private:
return beast::detail::EmptyBaseOptimization<ElementAllocator>::member();
}
std::reference_wrapper<ClockType> clock;
std::reference_wrapper<clock_type> clock;
};
class Buckets
{
public:
using VecType = std::vector<
BucketType,
typename std::allocator_traits<Allocator>::template rebind_alloc<BucketType>>;
using vec_type = std::vector<
bucket_type,
typename std::allocator_traits<Allocator>::template rebind_alloc<bucket_type>>;
Buckets() : maxLoadFactor_(1.f), vec_()
{
vec_.resize(ContType::suggested_upper_bucket_count(0));
vec_.resize(cont_type::suggested_upper_bucket_count(0));
}
Buckets(Allocator const& alloc) : maxLoadFactor_(1.f), vec_(alloc)
{
vec_.resize(ContType::suggested_upper_bucket_count(0));
vec_.resize(cont_type::suggested_upper_bucket_count(0));
}
operator BucketTraits()
operator bucket_traits()
{
return BucketTraits(&vec_[0], vec_.size());
return bucket_traits(&vec_[0], vec_.size());
}
void
@@ -466,10 +466,10 @@ private:
{
// Need two vectors otherwise we
// will destroy non-empty buckets.
VecType vec(vec_.get_allocator());
vec_type vec(vec_.get_allocator());
std::swap(vec_, vec);
vec_.resize(count);
c.rehash(BucketTraits(&vec_[0], vec_.size()));
c.rehash(bucket_traits(&vec_[0], vec_.size()));
return;
}
// Rehash in place.
@@ -478,12 +478,12 @@ private:
// This should not reallocate since
// we checked capacity earlier.
vec_.resize(count);
c.rehash(BucketTraits(&vec_[0], count));
c.rehash(bucket_traits(&vec_[0], count));
return;
}
// Resize must happen after rehash otherwise
// we might destroy non-empty buckets.
c.rehash(BucketTraits(&vec_[0], count));
c.rehash(bucket_traits(&vec_[0], count));
vec_.resize(count);
}
@@ -492,13 +492,13 @@ private:
void
resize(size_type n, Container& c)
{
size_type const suggested(ContType::suggested_upper_bucket_count(n));
size_type const suggested(cont_type::suggested_upper_bucket_count(n));
rehash(suggested, c);
}
private:
float maxLoadFactor_;
VecType vec_;
vec_type vec_;
};
template <class... Args>
@@ -553,13 +553,13 @@ public:
// A set iterator (IsMap==false) is always const
// because the elements of a set are immutable.
using iterator = beast::detail::AgedContainerIterator<!IsMap, typename ContType::iterator>;
using const_iterator = beast::detail::AgedContainerIterator<true, typename ContType::iterator>;
using iterator = beast::detail::AgedContainerIterator<!IsMap, typename cont_type::iterator>;
using const_iterator = beast::detail::AgedContainerIterator<true, typename cont_type::iterator>;
using local_iterator =
beast::detail::AgedContainerIterator<!IsMap, typename ContType::local_iterator>;
beast::detail::AgedContainerIterator<!IsMap, typename cont_type::local_iterator>;
using const_local_iterator =
beast::detail::AgedContainerIterator<true, typename ContType::local_iterator>;
beast::detail::AgedContainerIterator<true, typename cont_type::local_iterator>;
//--------------------------------------------------------------------------
//
@@ -575,13 +575,13 @@ public:
public:
// A set iterator (IsMap==false) is always const
// because the elements of a set are immutable.
using iterator = beast::detail::AgedContainerIterator<!IsMap, typename ListType::iterator>;
using iterator = beast::detail::AgedContainerIterator<!IsMap, typename list_type::iterator>;
using const_iterator =
beast::detail::AgedContainerIterator<true, typename ListType::iterator>;
beast::detail::AgedContainerIterator<true, typename list_type::iterator>;
using reverse_iterator =
beast::detail::AgedContainerIterator<!IsMap, typename ListType::reverse_iterator>;
beast::detail::AgedContainerIterator<!IsMap, typename list_type::reverse_iterator>;
using const_reverse_iterator =
beast::detail::AgedContainerIterator<true, typename ListType::reverse_iterator>;
beast::detail::AgedContainerIterator<true, typename list_type::reverse_iterator>;
iterator
begin()
@@ -679,7 +679,7 @@ public:
private:
friend class AgedUnorderedContainer;
ListType mutable list_;
list_type mutable list_;
} chronological;
//--------------------------------------------------------------------------
@@ -690,43 +690,43 @@ public:
AgedUnorderedContainer() = delete;
explicit AgedUnorderedContainer(ClockType& clock);
explicit AgedUnorderedContainer(clock_type& clock);
AgedUnorderedContainer(ClockType& clock, Hash const& hash);
AgedUnorderedContainer(clock_type& clock, Hash const& hash);
AgedUnorderedContainer(ClockType& clock, KeyEqual const& keyEq);
AgedUnorderedContainer(clock_type& clock, KeyEqual const& keyEq);
AgedUnorderedContainer(ClockType& clock, Allocator const& alloc);
AgedUnorderedContainer(clock_type& clock, Allocator const& alloc);
AgedUnorderedContainer(ClockType& clock, Hash const& hash, KeyEqual const& keyEq);
AgedUnorderedContainer(clock_type& clock, Hash const& hash, KeyEqual const& keyEq);
AgedUnorderedContainer(ClockType& clock, Hash const& hash, Allocator const& alloc);
AgedUnorderedContainer(clock_type& clock, Hash const& hash, Allocator const& alloc);
AgedUnorderedContainer(ClockType& clock, KeyEqual const& keyEq, Allocator const& alloc);
AgedUnorderedContainer(clock_type& clock, KeyEqual const& keyEq, Allocator const& alloc);
AgedUnorderedContainer(
ClockType& clock,
clock_type& clock,
Hash const& hash,
KeyEqual const& keyEq,
Allocator const& alloc);
template <class InputIt>
AgedUnorderedContainer(InputIt first, InputIt last, ClockType& clock);
AgedUnorderedContainer(InputIt first, InputIt last, clock_type& clock);
template <class InputIt>
AgedUnorderedContainer(InputIt first, InputIt last, ClockType& clock, Hash const& hash);
AgedUnorderedContainer(InputIt first, InputIt last, clock_type& clock, Hash const& hash);
template <class InputIt>
AgedUnorderedContainer(InputIt first, InputIt last, ClockType& clock, KeyEqual const& keyEq);
AgedUnorderedContainer(InputIt first, InputIt last, clock_type& clock, KeyEqual const& keyEq);
template <class InputIt>
AgedUnorderedContainer(InputIt first, InputIt last, ClockType& clock, Allocator const& alloc);
AgedUnorderedContainer(InputIt first, InputIt last, clock_type& clock, Allocator const& alloc);
template <class InputIt>
AgedUnorderedContainer(
InputIt first,
InputIt last,
ClockType& clock,
clock_type& clock,
Hash const& hash,
KeyEqual const& keyEq);
@@ -734,7 +734,7 @@ public:
AgedUnorderedContainer(
InputIt first,
InputIt last,
ClockType& clock,
clock_type& clock,
Hash const& hash,
Allocator const& alloc);
@@ -742,7 +742,7 @@ public:
AgedUnorderedContainer(
InputIt first,
InputIt last,
ClockType& clock,
clock_type& clock,
KeyEqual const& keyEq,
Allocator const& alloc);
@@ -750,7 +750,7 @@ public:
AgedUnorderedContainer(
InputIt first,
InputIt last,
ClockType& clock,
clock_type& clock,
Hash const& hash,
KeyEqual const& keyEq,
Allocator const& alloc);
@@ -766,44 +766,44 @@ public:
AgedUnorderedContainer&& other,
Allocator const& alloc);
AgedUnorderedContainer(std::initializer_list<value_type> init, ClockType& clock);
AgedUnorderedContainer(std::initializer_list<value_type> init, clock_type& clock);
AgedUnorderedContainer(
std::initializer_list<value_type> init,
ClockType& clock,
clock_type& clock,
Hash const& hash);
AgedUnorderedContainer(
std::initializer_list<value_type> init,
ClockType& clock,
clock_type& clock,
KeyEqual const& keyEq);
AgedUnorderedContainer(
std::initializer_list<value_type> init,
ClockType& clock,
clock_type& clock,
Allocator const& alloc);
AgedUnorderedContainer(
std::initializer_list<value_type> init,
ClockType& clock,
clock_type& clock,
Hash const& hash,
KeyEqual const& keyEq);
AgedUnorderedContainer(
std::initializer_list<value_type> init,
ClockType& clock,
clock_type& clock,
Hash const& hash,
Allocator const& alloc);
AgedUnorderedContainer(
std::initializer_list<value_type> init,
ClockType& clock,
clock_type& clock,
KeyEqual const& keyEq,
Allocator const& alloc);
AgedUnorderedContainer(
std::initializer_list<value_type> init,
ClockType& clock,
clock_type& clock,
Hash const& hash,
KeyEqual const& keyEq,
Allocator const& alloc);
@@ -825,13 +825,13 @@ public:
return config_.alloc();
}
ClockType&
clock_type&
clock()
{
return config_.clock;
}
ClockType const&
clock_type const&
clock() const
{
return config_.clock;
@@ -1028,7 +1028,7 @@ public:
template <class P, bool MaybeMap = IsMap>
std::conditional_t<IsMulti, iterator, std::pair<iterator, bool>>
insert(P&& value)
requires(MaybeMap && std::is_constructible_v<value_type, P&&>)
requires(MaybeMap && std::is_constructible_v<value_type, P &&>)
{
return emplace(std::forward<P>(value));
}
@@ -1037,7 +1037,7 @@ public:
template <class P, bool MaybeMap = IsMap>
std::conditional_t<IsMulti, iterator, std::pair<iterator, bool>>
insert(const_iterator hint, P&& value)
requires(MaybeMap && std::is_constructible_v<value_type, P&&>)
requires(MaybeMap && std::is_constructible_v<value_type, P &&>)
{
return emplaceHint(hint, std::forward<P>(value));
}
@@ -1399,7 +1399,7 @@ private:
void
touch(
beast::detail::AgedContainerIterator<IsConst, Iterator> pos,
ClockType::time_point const& now)
clock_type::time_point const& now)
{
auto& e(*pos.iterator());
e.when = now;
@@ -1433,7 +1433,7 @@ private:
private:
ConfigT config_;
Buckets buck_;
ContType mutable cont_;
cont_type mutable cont_;
};
//------------------------------------------------------------------------------
@@ -1448,7 +1448,7 @@ template <
class KeyEqual,
class Allocator>
AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::
AgedUnorderedContainer(ClockType& clock)
AgedUnorderedContainer(clock_type& clock)
: config_(clock)
, cont_(buck_, std::cref(config_.valueHash()), std::cref(config_.keyValueEqual()))
{
@@ -1464,7 +1464,7 @@ template <
class KeyEqual,
class Allocator>
AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::
AgedUnorderedContainer(ClockType& clock, Hash const& hash)
AgedUnorderedContainer(clock_type& clock, Hash const& hash)
: config_(clock, hash)
, cont_(buck_, std::cref(config_.valueHash()), std::cref(config_.keyValueEqual()))
{
@@ -1480,7 +1480,7 @@ template <
class KeyEqual,
class Allocator>
AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::
AgedUnorderedContainer(ClockType& clock, KeyEqual const& keyEq)
AgedUnorderedContainer(clock_type& clock, KeyEqual const& keyEq)
: config_(clock, keyEq)
, cont_(buck_, std::cref(config_.valueHash()), std::cref(config_.keyValueEqual()))
{
@@ -1496,7 +1496,7 @@ template <
class KeyEqual,
class Allocator>
AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::
AgedUnorderedContainer(ClockType& clock, Allocator const& alloc)
AgedUnorderedContainer(clock_type& clock, Allocator const& alloc)
: config_(clock, alloc)
, buck_(alloc)
, cont_(buck_, std::cref(config_.valueHash()), std::cref(config_.keyValueEqual()))
@@ -1513,7 +1513,7 @@ template <
class KeyEqual,
class Allocator>
AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::
AgedUnorderedContainer(ClockType& clock, Hash const& hash, KeyEqual const& keyEq)
AgedUnorderedContainer(clock_type& clock, Hash const& hash, KeyEqual const& keyEq)
: config_(clock, hash, keyEq)
, cont_(buck_, std::cref(config_.valueHash()), std::cref(config_.keyValueEqual()))
{
@@ -1529,7 +1529,7 @@ template <
class KeyEqual,
class Allocator>
AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::
AgedUnorderedContainer(ClockType& clock, Hash const& hash, Allocator const& alloc)
AgedUnorderedContainer(clock_type& clock, Hash const& hash, Allocator const& alloc)
: config_(clock, hash, alloc)
, buck_(alloc)
, cont_(buck_, std::cref(config_.valueHash()), std::cref(config_.keyValueEqual()))
@@ -1546,7 +1546,7 @@ template <
class KeyEqual,
class Allocator>
AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::
AgedUnorderedContainer(ClockType& clock, KeyEqual const& keyEq, Allocator const& alloc)
AgedUnorderedContainer(clock_type& clock, KeyEqual const& keyEq, Allocator const& alloc)
: config_(clock, keyEq, alloc)
, buck_(alloc)
, cont_(buck_, std::cref(config_.valueHash()), std::cref(config_.keyValueEqual()))
@@ -1564,7 +1564,7 @@ template <
class Allocator>
AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::
AgedUnorderedContainer(
ClockType& clock,
clock_type& clock,
Hash const& hash,
KeyEqual const& keyEq,
Allocator const& alloc)
@@ -1585,7 +1585,7 @@ template <
class Allocator>
template <class InputIt>
AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::
AgedUnorderedContainer(InputIt first, InputIt last, ClockType& clock)
AgedUnorderedContainer(InputIt first, InputIt last, clock_type& clock)
: config_(clock)
, cont_(buck_, std::cref(config_.valueHash()), std::cref(config_.keyValueEqual()))
{
@@ -1603,7 +1603,7 @@ template <
class Allocator>
template <class InputIt>
AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::
AgedUnorderedContainer(InputIt first, InputIt last, ClockType& clock, Hash const& hash)
AgedUnorderedContainer(InputIt first, InputIt last, clock_type& clock, Hash const& hash)
: config_(clock, hash)
, cont_(buck_, std::cref(config_.valueHash()), std::cref(config_.keyValueEqual()))
{
@@ -1621,7 +1621,7 @@ template <
class Allocator>
template <class InputIt>
AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::
AgedUnorderedContainer(InputIt first, InputIt last, ClockType& clock, KeyEqual const& keyEq)
AgedUnorderedContainer(InputIt first, InputIt last, clock_type& clock, KeyEqual const& keyEq)
: config_(clock, keyEq)
, cont_(buck_, std::cref(config_.valueHash()), std::cref(config_.keyValueEqual()))
{
@@ -1639,7 +1639,7 @@ template <
class Allocator>
template <class InputIt>
AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::
AgedUnorderedContainer(InputIt first, InputIt last, ClockType& clock, Allocator const& alloc)
AgedUnorderedContainer(InputIt first, InputIt last, clock_type& clock, Allocator const& alloc)
: config_(clock, alloc)
, buck_(alloc)
, cont_(buck_, std::cref(config_.valueHash()), std::cref(config_.keyValueEqual()))
@@ -1661,7 +1661,7 @@ AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>
AgedUnorderedContainer(
InputIt first,
InputIt last,
ClockType& clock,
clock_type& clock,
Hash const& hash,
KeyEqual const& keyEq)
: config_(clock, hash, keyEq)
@@ -1684,7 +1684,7 @@ AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>
AgedUnorderedContainer(
InputIt first,
InputIt last,
ClockType& clock,
clock_type& clock,
Hash const& hash,
Allocator const& alloc)
: config_(clock, hash, alloc)
@@ -1708,7 +1708,7 @@ AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>
AgedUnorderedContainer(
InputIt first,
InputIt last,
ClockType& clock,
clock_type& clock,
KeyEqual const& keyEq,
Allocator const& alloc)
: config_(clock, keyEq, alloc)
@@ -1732,7 +1732,7 @@ AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>
AgedUnorderedContainer(
InputIt first,
InputIt last,
ClockType& clock,
clock_type& clock,
Hash const& hash,
KeyEqual const& keyEq,
Allocator const& alloc)
@@ -1829,7 +1829,7 @@ template <
class KeyEqual,
class Allocator>
AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::
AgedUnorderedContainer(std::initializer_list<value_type> init, ClockType& clock)
AgedUnorderedContainer(std::initializer_list<value_type> init, clock_type& clock)
: config_(clock)
, cont_(buck_, std::cref(config_.valueHash()), std::cref(config_.keyValueEqual()))
{
@@ -1848,7 +1848,7 @@ template <
AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::
AgedUnorderedContainer(
std::initializer_list<value_type> init,
ClockType& clock,
clock_type& clock,
Hash const& hash)
: config_(clock, hash)
, cont_(buck_, std::cref(config_.valueHash()), std::cref(config_.keyValueEqual()))
@@ -1868,7 +1868,7 @@ template <
AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::
AgedUnorderedContainer(
std::initializer_list<value_type> init,
ClockType& clock,
clock_type& clock,
KeyEqual const& keyEq)
: config_(clock, keyEq)
, cont_(buck_, std::cref(config_.valueHash()), std::cref(config_.keyValueEqual()))
@@ -1888,7 +1888,7 @@ template <
AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::
AgedUnorderedContainer(
std::initializer_list<value_type> init,
ClockType& clock,
clock_type& clock,
Allocator const& alloc)
: config_(clock, alloc)
, buck_(alloc)
@@ -1909,7 +1909,7 @@ template <
AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::
AgedUnorderedContainer(
std::initializer_list<value_type> init,
ClockType& clock,
clock_type& clock,
Hash const& hash,
KeyEqual const& keyEq)
: config_(clock, hash, keyEq)
@@ -1930,7 +1930,7 @@ template <
AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::
AgedUnorderedContainer(
std::initializer_list<value_type> init,
ClockType& clock,
clock_type& clock,
Hash const& hash,
Allocator const& alloc)
: config_(clock, hash, alloc)
@@ -1952,7 +1952,7 @@ template <
AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::
AgedUnorderedContainer(
std::initializer_list<value_type> init,
ClockType& clock,
clock_type& clock,
KeyEqual const& keyEq,
Allocator const& alloc)
: config_(clock, keyEq, alloc)
@@ -1974,7 +1974,7 @@ template <
AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::
AgedUnorderedContainer(
std::initializer_list<value_type> init,
ClockType& clock,
clock_type& clock,
Hash const& hash,
KeyEqual const& keyEq,
Allocator const& alloc)
@@ -2127,7 +2127,7 @@ AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>
requires(MaybeMap && !MaybeMulti)
{
maybeRehash(1);
typename ContType::insert_commit_data d;
typename cont_type::insert_commit_data d;
auto const result(cont_.insert_check(
key, std::cref(config_.hashFunction()), std::cref(config_.keyValueEqual()), d));
if (result.second)
@@ -2157,7 +2157,7 @@ AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>
requires(MaybeMap && !MaybeMulti)
{
maybeRehash(1);
typename ContType::insert_commit_data d;
typename cont_type::insert_commit_data d;
auto const result(cont_.insert_check(
key, std::cref(config_.hashFunction()), std::cref(config_.keyValueEqual()), d));
if (result.second)
@@ -2211,7 +2211,7 @@ AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>
requires(!MaybeMulti)
{
maybeRehash(1);
typename ContType::insert_commit_data d;
typename cont_type::insert_commit_data d;
auto const result(cont_.insert_check(
extract(value), std::cref(config_.hashFunction()), std::cref(config_.keyValueEqual()), d));
if (result.second)
@@ -2264,7 +2264,7 @@ AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>
requires(!MaybeMulti && !MaybeMap)
{
maybeRehash(1);
typename ContType::insert_commit_data d;
typename cont_type::insert_commit_data d;
auto const result(cont_.insert_check(
extract(value), std::cref(config_.hashFunction()), std::cref(config_.keyValueEqual()), d));
if (result.second)
@@ -2374,7 +2374,7 @@ AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>
// VFALCO NOTE Its unfortunate that we need to
// construct element here
Element* const p(newElement(std::forward<Args>(args)...));
typename ContType::insert_commit_data d;
typename cont_type::insert_commit_data d;
auto const result(cont_.insert_check(
extract(p->value),
std::cref(config_.hashFunction()),
@@ -2611,7 +2611,7 @@ AgedUnorderedContainer<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>
value_type const& value) -> std::pair<iterator, bool>
requires(!MaybeMulti)
{
typename ContType::insert_commit_data d;
typename cont_type::insert_commit_data d;
auto const result(cont_.insert_check(
extract(value), std::cref(config_.hashFunction()), std::cref(config_.keyValueEqual()), d));
if (result.second)
+1 -1
View File
@@ -26,7 +26,7 @@ namespace beast::insight {
class Collector
{
public:
using Ptr = std::shared_ptr<Collector>;
using ptr = std::shared_ptr<Collector>;
virtual ~Collector() = 0;
+1 -1
View File
@@ -13,7 +13,7 @@ namespace beast::insight {
class Group : public Collector
{
public:
using Ptr = std::shared_ptr<Group>;
using ptr = std::shared_ptr<Group>;
/**
* Returns the name of this group, for diagnostics.
+3 -3
View File
@@ -20,10 +20,10 @@ public:
* Find or create a new collector with a given name.
*/
/** @{ */
virtual Group::Ptr const&
virtual Group::ptr const&
get(std::string const& name) = 0;
Group::Ptr const&
Group::ptr const&
operator[](std::string const& name)
{
return get(name);
@@ -35,6 +35,6 @@ public:
* Create a group container that uses the specified collector.
*/
std::unique_ptr<Groups>
makeGroups(Collector::Ptr const& collector);
makeGroups(Collector::ptr const& collector);
} // namespace beast::insight
+6 -6
View File
@@ -108,12 +108,12 @@ Result
split(FwdIt first, FwdIt last, Char delim)
{
using namespace detail;
using String = Result::value_type;
using string = Result::value_type;
Result result;
FwdIt iter = first;
String e;
string e;
while (iter != last)
{
if (*iter == '"')
@@ -205,10 +205,10 @@ splitCommas(std::string_view s)
*/
class ListIterator
{
using IterType = boost::string_ref::const_iterator;
using iter_type = boost::string_ref::const_iterator;
IterType it_;
IterType end_;
iter_type it_;
iter_type end_;
boost::string_ref value_;
public:
@@ -218,7 +218,7 @@ public:
using difference_type = std::ptrdiff_t;
using iterator_category = std::forward_iterator_tag;
ListIterator(IterType begin, IterType end) : it_(begin), end_(end)
ListIterator(iter_type begin, iter_type end) : it_(begin), end_(end)
{
if (it_ != end_)
increment();
+2 -2
View File
@@ -42,7 +42,7 @@ public:
/**
* The type of yield context passed to functions.
*/
using YieldContext = boost::asio::yield_context;
using yield_context = boost::asio::yield_context;
explicit EnableYieldTo(std::size_t concurrency = 1) : work_(boost::asio::make_work_guard(ios_))
{
@@ -120,7 +120,7 @@ EnableYieldTo::spawn(F0&& f, FN&&... fn)
ios_,
boost::allocator_arg,
boost::context::fixedsize_stack(2 * 1024 * 1024),
[&](YieldContext yield) {
[&](yield_context yield) {
f(yield);
std::scoped_lock const lock{m_};
if (--running_ == 0)
@@ -15,29 +15,29 @@ template <class Container>
class ConstContainer
{
private:
using ContType = Container;
using cont_type = Container;
ContType cont_;
cont_type cont_;
protected:
ContType&
cont_type&
cont()
{
return cont_;
}
[[nodiscard]] ContType const&
[[nodiscard]] cont_type const&
cont() const
{
return cont_;
}
public:
using value_type = ContType::value_type;
using size_type = ContType::size_type;
using difference_type = ContType::difference_type;
using iterator = ContType::const_iterator;
using const_iterator = ContType::const_iterator;
using value_type = cont_type::value_type;
using size_type = cont_type::size_type;
using difference_type = cont_type::difference_type;
using iterator = cont_type::const_iterator;
using const_iterator = cont_type::const_iterator;
/**
* Returns `true` if the container is empty.
+14 -17
View File
@@ -32,7 +32,7 @@ template <class = void>
class Reporter : public Runner
{
private:
using ClockType = std::chrono::steady_clock;
using clock_type = std::chrono::steady_clock;
struct CaseResults
{
@@ -51,7 +51,7 @@ private:
std::size_t cases = 0;
std::size_t total = 0;
std::size_t failed = 0;
ClockType::time_point start = ClockType::now();
clock_type::time_point start = clock_type::now();
explicit SuiteResults(std::string name = "") : name(std::move(name))
{
@@ -63,7 +63,7 @@ private:
struct Results
{
using RunTime = std::pair<std::string, ClockType::duration>;
using run_time = std::pair<std::string, clock_type::duration>;
static constexpr auto kMaxTop = 10;
@@ -71,8 +71,8 @@ private:
std::size_t cases = 0;
std::size_t total = 0;
std::size_t failed = 0;
std::vector<RunTime> top;
ClockType::time_point start = ClockType::now();
std::vector<run_time> top;
clock_type::time_point start = clock_type::now();
void
add(SuiteResults const& r);
@@ -94,7 +94,7 @@ public:
private:
static std::string
fmtdur(ClockType::duration const& d);
fmtdur(clock_type::duration const& d);
void
onSuiteBegin(SuiteInfo const& info) override;
@@ -137,13 +137,14 @@ Reporter<Unused>::Results::add(SuiteResults const& r)
total += r.total;
cases += r.cases;
failed += r.failed;
auto const elapsed = ClockType::now() - r.start;
auto const elapsed = clock_type::now() - r.start;
if (elapsed >= std::chrono::seconds{1})
{
auto const iter = std::lower_bound(
top.begin(), top.end(), elapsed, [](RunTime const& t1, ClockType::duration const& t2) {
return t1.second > t2;
});
top.begin(),
top.end(),
elapsed,
[](run_time const& t1, clock_type::duration const& t2) { return t1.second > t2; });
if (iter != top.end())
{
if (top.size() == kMaxTop)
@@ -173,7 +174,7 @@ Reporter<Unused>::~Reporter()
for (auto const& i : results_.top)
os_ << std::setw(8) << fmtdur(i.second) << " " << i.first << '\n';
}
auto const elapsed = ClockType::now() - results_.start;
auto const elapsed = clock_type::now() - results_.start;
os_ << fmtdur(elapsed) << ", " << Amount{results_.suites, "suite"} << ", "
<< Amount{results_.cases, "case"} << ", " << Amount{results_.total, "test"} << " total, "
<< Amount{results_.failed, "failure"} << std::endl;
@@ -181,7 +182,7 @@ Reporter<Unused>::~Reporter()
template <class Unused>
std::string
Reporter<Unused>::fmtdur(ClockType::duration const& d)
Reporter<Unused>::fmtdur(clock_type::duration const& d)
{
using namespace std::chrono;
auto const ms = duration_cast<milliseconds>(d);
@@ -248,10 +249,6 @@ Reporter<Unused>::onLog(std::string const& s)
} // namespace detail
using Reporter = detail::Reporter<>;
// TODO [#8340]: Legacy name still used by external consumers of libxrpl (e.g. validator-keys-tool).
// Do not use in new code; remove once those consumers have migrated.
using reporter = Reporter; // NOLINT(readability-identifier-naming)
using reporter = detail::Reporter<>;
} // namespace beast::unit_test
+2 -2
View File
@@ -643,12 +643,12 @@ Suite::run(Runner& r)
* Library Identifies the library.
*
* The declaration for the class implementing the test should be the same
* as Class ## _test. For example, if Class is AgedOrderedContainer, the
* as Class ## _test. For example, if Class is aged_ordered_container, the
* test class must be declared as:
*
* @code
*
* struct AgedOrderedContainer_test : beast::unit_test::suite
* struct aged_ordered_container_test : beast::unit_test::suite
* {
* //...
* };
+3 -3
View File
@@ -18,14 +18,14 @@ class Runner;
*/
class SuiteInfo
{
using RunType = std::function<void(Runner&)>;
using run_type = std::function<void(Runner&)>;
std::string name_;
std::string module_;
std::string library_;
bool manual_;
int priority_;
RunType run_;
run_type run_;
public:
SuiteInfo(
@@ -34,7 +34,7 @@ public:
std::string library,
bool manual,
int priority,
RunType run)
run_type run)
: name_(std::move(name))
, module_(std::move(module))
, library_(std::move(library))
+1 -1
View File
@@ -24,7 +24,7 @@ private:
std::thread t_;
public:
using Id = std::thread::id;
using id = std::thread::id;
using native_handle_type = std::thread::native_handle_type;
Thread() = default;
+2 -2
View File
@@ -471,7 +471,7 @@ public:
}
};
using LogStream = BasicLogstream<char>;
using LogWStream = BasicLogstream<wchar_t>;
using logstream = BasicLogstream<char>;
using logwstream = BasicLogstream<wchar_t>;
} // namespace beast
+1 -1
View File
@@ -19,6 +19,6 @@ struct MaybeConst
* Alias for omitting `typename`.
*/
template <bool IsConst, class T>
using MaybeConstT = MaybeConst<IsConst, T>::type;
using maybe_const_t = MaybeConst<IsConst, T>::type;
} // namespace beast
+1 -1
View File
@@ -94,6 +94,6 @@ XorShiftEngine<Unused>::murmurhash3(result_type x) -> result_type
* http://xorshift.di.unimi.it/xorshift128plus.c
* does not accept seed==0
*/
using XorShiftEngine = detail::XorShiftEngine<>;
using xor_shift_engine = detail::XorShiftEngine<>;
} // namespace beast
@@ -105,9 +105,9 @@ public:
[[nodiscard]] Buffer
fingerprint() const override
{
Sha256Hasher h;
sha256_hasher h;
h(payload_.data(), payload_.size());
auto const d = static_cast<Sha256Hasher::result_type>(h);
auto const d = static_cast<sha256_hasher::result_type>(h);
return {d.data(), d.size()};
}
-4
View File
@@ -22,14 +22,11 @@ struct Sections
static constexpr auto kIoWorkers = "io_workers";
static constexpr auto kIps = "ips";
static constexpr auto kIpsFixed = "ips_fixed";
static constexpr auto kLedgerCacheAge = "ledger_cache_age";
static constexpr auto kLedgerFetchSize = "ledger_fetch_size";
static constexpr auto kLedgerHistory = "ledger_history";
static constexpr auto kLedgerReplay = "ledger_replay";
static constexpr auto kLedgerTxTables = "ledger_tx_tables";
static constexpr auto kMaxSubscriptionsPerConnection = "max_subscriptions_per_connection";
static constexpr auto kMaxTransactions = "max_transactions";
static constexpr auto kMemoryLimit = "memory_limit";
static constexpr auto kNetworkId = "network_id";
static constexpr auto kNetworkQuorum = "network_quorum";
static constexpr auto kNodeDatabase = "node_db";
@@ -67,7 +64,6 @@ struct Sections
static constexpr auto kSslVerifyFile = "ssl_verify_file";
static constexpr auto kSweepInterval = "sweep_interval";
static constexpr auto kTransactionQueue = "transaction_queue";
static constexpr auto kTreeCacheAge = "tree_cache_age";
static constexpr auto kValidationSeed = "validation_seed";
static constexpr auto kValidatorKeys = "validator_keys";
static constexpr auto kValidatorKeyRevocation = "validator_key_revocation";
+50 -50
View File
@@ -288,12 +288,12 @@ checkConsensus(
template <class Adaptor>
class Consensus
{
using LedgerT = Adaptor::LedgerT;
using TxSetT = Adaptor::TxSetT;
using NodeIDT = Adaptor::NodeIDT;
using TxT = TxSetT::Tx;
using PeerPositionT = Adaptor::PeerPositionT;
using ProposalT = ConsensusProposal<NodeIDT, typename LedgerT::ID, typename TxSetT::ID>;
using Ledger_t = Adaptor::Ledger_t;
using TxSet_t = Adaptor::TxSet_t;
using NodeID_t = Adaptor::NodeID_t;
using Tx_t = TxSet_t::Tx;
using PeerPosition_t = Adaptor::PeerPosition_t;
using Proposal_t = ConsensusProposal<NodeID_t, typename Ledger_t::ID, typename TxSet_t::ID>;
using Result = ConsensusResult<Adaptor>;
@@ -325,7 +325,7 @@ public:
/**
* Clock type for measuring time within the consensus code
*/
using ClockType = beast::AbstractClock<std::chrono::steady_clock>;
using clock_type = beast::AbstractClock<std::chrono::steady_clock>;
Consensus(Consensus&&) noexcept = default;
@@ -336,7 +336,7 @@ public:
* @param adaptor The instance of the adaptor class
* @param j The journal to log debug output
*/
Consensus(ClockType const& clock, Adaptor& adaptor, beast::Journal j);
Consensus(clock_type const& clock, Adaptor& adaptor, beast::Journal j);
/**
* Kick-off the next round of consensus.
@@ -357,9 +357,9 @@ public:
void
startRound(
NetClock::time_point const& now,
LedgerT::ID const& prevLedgerID,
LedgerT prevLedger,
HashSet<NodeIDT> const& nowUntrusted,
Ledger_t::ID const& prevLedgerID,
Ledger_t prevLedger,
hash_set<NodeID_t> const& nowUntrusted,
bool proposing,
std::unique_ptr<std::stringstream> const& clog = {});
@@ -371,7 +371,7 @@ public:
* @return Whether we should do delayed relay of this proposal.
*/
bool
peerProposal(NetClock::time_point const& now, PeerPositionT const& newProposal);
peerProposal(NetClock::time_point const& now, PeerPosition_t const& newProposal);
/**
* Call periodically to drive consensus forward.
@@ -391,7 +391,7 @@ public:
* @param txSet the transaction set
*/
void
gotTxSet(NetClock::time_point const& now, TxSetT const& txSet);
gotTxSet(NetClock::time_point const& now, TxSet_t const& txSet);
/**
* Simulate the consensus process without any network traffic.
@@ -423,7 +423,7 @@ public:
*
* @return ID of previous ledger
*/
LedgerT::ID
Ledger_t::ID
prevLedgerID() const
{
return prevLedgerID_;
@@ -450,14 +450,14 @@ private:
void
startRoundInternal(
NetClock::time_point const& now,
LedgerT::ID const& prevLedgerID,
LedgerT const& prevLedger,
Ledger_t::ID const& prevLedgerID,
Ledger_t const& prevLedger,
ConsensusMode mode,
std::unique_ptr<std::stringstream> const& clog);
// Change our view of the previous ledger
void
handleWrongLedger(LedgerT::ID const& lgrId, std::unique_ptr<std::stringstream> const& clog);
handleWrongLedger(Ledger_t::ID const& lgrId, std::unique_ptr<std::stringstream> const& clog);
/**
* Check if our previous ledger matches the network's.
@@ -479,7 +479,7 @@ private:
* Handle a replayed or a new peer proposal.
*/
bool
peerProposalInternal(NetClock::time_point const& now, PeerPositionT const& newProposal);
peerProposalInternal(NetClock::time_point const& now, PeerPosition_t const& newProposal);
/**
* Handle pre-close phase.
@@ -542,12 +542,12 @@ private:
// Create disputes between our position and the provided one.
void
createDisputes(TxSetT const& o, std::unique_ptr<std::stringstream> const& clog = {});
createDisputes(TxSet_t const& o, std::unique_ptr<std::stringstream> const& clog = {});
// Update our disputes given that this node has adopted a new position.
// Will call createDisputes as needed.
void
updateDisputes(NodeIDT const& node, TxSetT const& other);
updateDisputes(NodeID_t const& node, TxSet_t const& other);
// Revoke our outstanding proposal, if any, and cease proposing
// until this round ends.
@@ -566,7 +566,7 @@ private:
bool firstRound_ = true;
bool haveCloseTimeConsensus_ = false;
ClockType const& clock_;
clock_type const& clock_;
// How long the consensus convergence has taken, expressed as
// a percentage of the time that we expected it to take.
@@ -594,12 +594,12 @@ private:
// Non-peer (self) consensus data
// Last validated ledger ID provided to consensus
LedgerT::ID prevLedgerID_;
Ledger_t::ID prevLedgerID_;
// Last validated ledger seen by consensus
LedgerT previousLedger_;
Ledger_t previousLedger_;
// Transaction Sets, indexed by hash of transaction tree
HashMap<typename TxSetT::ID, TxSetT const> acquired_;
hash_map<typename TxSet_t::ID, TxSet_t const> acquired_;
std::optional<Result> result_;
ConsensusCloseTimes rawCloseTimes_;
@@ -615,24 +615,24 @@ private:
// Peer related consensus data
// Peer proposed positions for the current round
HashMap<NodeIDT, PeerPositionT> currPeerPositions_;
hash_map<NodeID_t, PeerPosition_t> currPeerPositions_;
// Recently received peer positions, available when transitioning between
// ledgers or rounds
HashMap<NodeIDT, std::deque<PeerPositionT>> recentPeerPositions_;
hash_map<NodeID_t, std::deque<PeerPosition_t>> recentPeerPositions_;
// The number of proposers who participated in the last consensus round
std::size_t prevProposers_ = 0;
// nodes that have bowed out of this consensus process
HashSet<NodeIDT> deadNodes_;
hash_set<NodeID_t> deadNodes_;
// Journal for debugging
beast::Journal const j_;
};
template <class Adaptor>
Consensus<Adaptor>::Consensus(ClockType const& clock, Adaptor& adaptor, beast::Journal journal)
Consensus<Adaptor>::Consensus(clock_type const& clock, Adaptor& adaptor, beast::Journal journal)
: adaptor_(adaptor), clock_(clock), j_{journal}
{
JLOG(j_.debug()) << "Creating consensus object";
@@ -642,9 +642,9 @@ template <class Adaptor>
void
Consensus<Adaptor>::startRound(
NetClock::time_point const& now,
LedgerT::ID const& prevLedgerID,
LedgerT prevLedger,
HashSet<NodeIDT> const& nowUntrusted,
Ledger_t::ID const& prevLedgerID,
Ledger_t prevLedger,
hash_set<NodeID_t> const& nowUntrusted,
bool proposing,
std::unique_ptr<std::stringstream> const& clog)
{
@@ -660,7 +660,7 @@ Consensus<Adaptor>::startRound(
prevCloseTime_ = rawCloseTimes_.self;
}
for (NodeIDT const& n : nowUntrusted)
for (NodeID_t const& n : nowUntrusted)
recentPeerPositions_.erase(n);
ConsensusMode startMode = proposing ? ConsensusMode::Proposing : ConsensusMode::Observing;
@@ -687,8 +687,8 @@ template <class Adaptor>
void
Consensus<Adaptor>::startRoundInternal(
NetClock::time_point const& now,
LedgerT::ID const& prevLedgerID,
LedgerT const& prevLedger,
Ledger_t::ID const& prevLedgerID,
Ledger_t const& prevLedger,
ConsensusMode mode,
std::unique_ptr<std::stringstream> const& clog)
{
@@ -715,7 +715,7 @@ Consensus<Adaptor>::startRoundInternal(
closeResolution_ = getNextLedgerTimeResolution(
previousLedger_.closeTimeResolution(),
previousLedger_.closeAgree(),
previousLedger_.seq() + typename LedgerT::Seq{1});
previousLedger_.seq() + typename Ledger_t::Seq{1});
playbackProposals();
CLOG(clog) << "number of peer proposals,previous proposers: " << currPeerPositions_.size()
@@ -731,7 +731,7 @@ Consensus<Adaptor>::startRoundInternal(
template <class Adaptor>
bool
Consensus<Adaptor>::peerProposal(NetClock::time_point const& now, PeerPositionT const& newPeerPos)
Consensus<Adaptor>::peerProposal(NetClock::time_point const& now, PeerPosition_t const& newPeerPos)
{
JLOG(j_.debug()) << "PROPOSAL " << newPeerPos.render();
auto const& peerID = newPeerPos.proposal().nodeID();
@@ -752,7 +752,7 @@ template <class Adaptor>
bool
Consensus<Adaptor>::peerProposalInternal(
NetClock::time_point const& now,
PeerPositionT const& newPeerPos)
PeerPosition_t const& newPeerPos)
{
// Nothing to do for now if we are currently working on a ledger
if (phase_ == ConsensusPhase::Accepted)
@@ -889,7 +889,7 @@ Consensus<Adaptor>::timerEntry(
template <class Adaptor>
void
Consensus<Adaptor>::gotTxSet(NetClock::time_point const& now, TxSetT const& txSet)
Consensus<Adaptor>::gotTxSet(NetClock::time_point const& now, TxSet_t const& txSet)
{
// Nothing to do if we've finished work on a ledger
if (phase_ == ConsensusPhase::Accepted)
@@ -1053,7 +1053,7 @@ Consensus<Adaptor>::getJson(bool full) const
template <class Adaptor>
void
Consensus<Adaptor>::handleWrongLedger(
LedgerT::ID const& lgrId,
Ledger_t::ID const& lgrId,
std::unique_ptr<std::stringstream> const& clog)
{
CLOG(clog) << "handleWrongLedger. ";
@@ -1491,11 +1491,11 @@ Consensus<Adaptor>::updateOurPositions(std::unique_ptr<std::stringstream> const&
auto it = currPeerPositions_.begin();
while (it != currPeerPositions_.end())
{
ProposalT const& peerProp = it->second.proposal();
Proposal_t const& peerProp = it->second.proposal();
if (peerProp.isStale(peerCutoff))
{
// peer's proposal is stale, so remove it
NodeIDT const& peerID = peerProp.nodeID();
NodeID_t const& peerID = peerProp.nodeID();
JLOG(j_.warn()) << "Removing stale proposal from " << peerID;
for (auto& dt : result_->disputes)
dt.second.unVote(peerID);
@@ -1511,11 +1511,11 @@ Consensus<Adaptor>::updateOurPositions(std::unique_ptr<std::stringstream> const&
}
// This will stay unseated unless there are any changes
std::optional<TxSetT> ourNewSet;
std::optional<TxSet_t> ourNewSet;
// Update votes on disputed transactions
{
std::optional<typename TxSetT::MutableTxSet> mutableSet;
std::optional<typename TxSet_t::MutableTxSet> mutableSet;
for (auto& [txId, dispute] : result_->disputes)
{
// Because the threshold for inclusion increases,
@@ -1645,7 +1645,7 @@ Consensus<Adaptor>::updateOurPositions(std::unique_ptr<std::stringstream> const&
for (auto const& [nodeId, peerPos] : currPeerPositions_)
{
ProposalT const& p = peerPos.proposal();
Proposal_t const& p = peerPos.proposal();
if (p.position() == newID)
updateDisputes(nodeId, result_->txns);
}
@@ -1674,7 +1674,7 @@ Consensus<Adaptor>::haveConsensus(std::unique_ptr<std::stringstream> const& clog
// Count number of agreements/disagreements with our position
for (auto const& [nodeId, peerPos] : currPeerPositions_)
{
ProposalT const& peerProp = peerPos.proposal();
Proposal_t const& peerProp = peerPos.proposal();
if (peerProp.position() == ourPosition)
{
++agree;
@@ -1789,7 +1789,7 @@ Consensus<Adaptor>::leaveConsensus(std::unique_ptr<std::stringstream> const& clo
template <class Adaptor>
void
Consensus<Adaptor>::createDisputes(TxSetT const& o, std::unique_ptr<std::stringstream> const& clog)
Consensus<Adaptor>::createDisputes(TxSet_t const& o, std::unique_ptr<std::stringstream> const& clog)
{
// Cannot create disputes without our stance
XRPL_ASSERT(result_, "xrpl::Consensus::createDisputes : result is set");
@@ -1825,7 +1825,7 @@ Consensus<Adaptor>::createDisputes(TxSetT const& o, std::unique_ptr<std::strings
(!inThisSet && !result_->txns.find(txId) && o.find(txId)),
"xrpl::Consensus::createDisputes : has disputed transactions");
TxT const tx = inThisSet ? result_->txns.find(txId) : o.find(txId);
Tx_t const tx = inThisSet ? result_->txns.find(txId) : o.find(txId);
auto txID = tx.id();
if (result_->disputes.find(txID) != result_->disputes.end())
@@ -1833,7 +1833,7 @@ Consensus<Adaptor>::createDisputes(TxSetT const& o, std::unique_ptr<std::strings
JLOG(j_.debug()) << "Transaction " << txID << " is disputed";
typename Result::DisputeT dtx{
typename Result::Dispute_t dtx{
tx,
result_->txns.exists(txID),
std::max(prevProposers_, currPeerPositions_.size()),
@@ -1842,7 +1842,7 @@ Consensus<Adaptor>::createDisputes(TxSetT const& o, std::unique_ptr<std::strings
// Update all of the available peer's votes on the disputed transaction
for (auto const& [nodeId, peerPos] : currPeerPositions_)
{
ProposalT const& peerProp = peerPos.proposal();
Proposal_t const& peerProp = peerPos.proposal();
auto const cit = acquired_.find(peerProp.position());
if (cit != acquired_.end() && dtx.setVote(nodeId, cit->second.exists(txID)))
peerUnchangedCounter_ = 0;
@@ -1858,7 +1858,7 @@ Consensus<Adaptor>::createDisputes(TxSetT const& o, std::unique_ptr<std::strings
template <class Adaptor>
void
Consensus<Adaptor>::updateDisputes(NodeIDT const& node, TxSetT const& other)
Consensus<Adaptor>::updateDisputes(NodeID_t const& node, TxSet_t const& other)
{
// Cannot updateDisputes without our stance
XRPL_ASSERT(result_, "xrpl::Consensus::updateDisputes : result is set");
+2 -2
View File
@@ -235,7 +235,7 @@ public:
/**
* The digest for this proposal, used for signing purposes.
*/
UInt256 const&
uint256 const&
signingHash() const
{
if (!signingHash_)
@@ -283,7 +283,7 @@ private:
/**
* The signing hash for this proposal
*/
mutable std::optional<UInt256> signingHash_;
mutable std::optional<uint256> signingHash_;
};
template <class NodeId, class LedgerId, class Position>
+11 -11
View File
@@ -282,15 +282,15 @@ enum class ConsensusState {
template <class Traits>
struct ConsensusResult
{
using LedgerT = Traits::LedgerT;
using TxSetT = Traits::TxSetT;
using NodeIDT = Traits::NodeIDT;
using Ledger_t = Traits::Ledger_t;
using TxSet_t = Traits::TxSet_t;
using NodeID_t = Traits::NodeID_t;
using TxT = TxSetT::Tx;
using ProposalT = ConsensusProposal<NodeIDT, typename LedgerT::ID, typename TxSetT::ID>;
using DisputeT = DisputedTx<TxT, NodeIDT>;
using Tx_t = TxSet_t::Tx;
using Proposal_t = ConsensusProposal<NodeID_t, typename Ledger_t::ID, typename TxSet_t::ID>;
using Dispute_t = DisputedTx<Tx_t, NodeID_t>;
ConsensusResult(TxSetT&& s, ProposalT&& p) : txns{std::move(s)}, position{std::move(p)}
ConsensusResult(TxSet_t&& s, Proposal_t&& p) : txns{std::move(s)}, position{std::move(p)}
{
XRPL_ASSERT(txns.id() == position.position(), "xrpl::ConsensusResult : valid inputs");
}
@@ -298,20 +298,20 @@ struct ConsensusResult
/**
* The set of transactions consensus agrees go in the ledger
*/
TxSetT txns;
TxSet_t txns;
/**
* Our proposed position on transactions/close time
*/
ProposalT position;
Proposal_t position;
/**
* Transactions which are under dispute with our peers
*/
HashMap<typename TxT::ID, DisputeT> disputes;
hash_map<typename Tx_t::ID, Dispute_t> disputes;
// Set of TxSet ids we have already compared/created disputes
HashSet<typename TxSetT::ID> compares;
hash_set<typename TxSet_t::ID> compares;
// Measures the duration of the establish phase for this consensus round
ConsensusTimer roundTime;
+4 -4
View File
@@ -34,8 +34,8 @@ namespace xrpl {
template <class Tx, class NodeId>
class DisputedTx
{
using TxIDT = Tx::ID;
using MapT = boost::container::flat_map<NodeId, bool>;
using TxID_t = Tx::ID;
using Map_t = boost::container::flat_map<NodeId, bool>;
public:
/**
@@ -55,7 +55,7 @@ public:
/**
* The unique id/hash of the disputed transaction.
*/
[[nodiscard]] TxIDT const&
[[nodiscard]] TxID_t const&
id() const
{
return tx_.id();
@@ -202,7 +202,7 @@ private:
int nays_{0}; //< Number of no votes
bool ourVote_; //< Our vote (true is yes)
Tx tx_; //< Transaction under dispute
MapT votes_; //< Map from NodeID to vote
Map_t votes_; //< Map from NodeID to vote
/**
* The number of rounds we've gone without changing our vote
*/
+19 -16
View File
@@ -312,25 +312,28 @@ class Validations
mutable Mutex mutex_;
// Validations from currently listed and trusted nodes (partial and full)
HashMap<NodeID, Validation> current_;
hash_map<NodeID, Validation> current_;
// Used to enforce the largest validation invariant for the local node
SeqEnforcer<Seq> localSeqEnforcer_;
// Sequence of the largest validation received from each node
HashMap<NodeID, SeqEnforcer<Seq>> seqEnforcers_;
hash_map<NodeID, SeqEnforcer<Seq>> seqEnforcers_;
/**
* Validations from listed nodes, indexed by ledger id (partial and full)
*/
beast::
AgedUnorderedMap<ID, HashMap<NodeID, Validation>, std::chrono::steady_clock, beast::Uhash<>>
byLedger_;
beast::aged_unordered_map<
ID,
hash_map<NodeID, Validation>,
std::chrono::steady_clock,
beast::Uhash<>>
byLedger_;
// Partial and full validations indexed by sequence
beast::AgedUnorderedMap<
beast::aged_unordered_map<
Seq,
HashMap<NodeID, Validation>,
hash_map<NodeID, Validation>,
std::chrono::steady_clock,
beast::Uhash<>>
bySequence_;
@@ -348,10 +351,10 @@ class Validations
// Last (validated) ledger successfully acquired. If in this map, it is
// accounted for in the trie.
HashMap<NodeID, Ledger> lastLedger_;
hash_map<NodeID, Ledger> lastLedger_;
// Set of ledgers being acquired from the network
HashMap<std::pair<Seq, ID>, HashSet<NodeID>> acquiring_;
hash_map<std::pair<Seq, ID>, hash_set<NodeID>> acquiring_;
// Parameters to determine validation staleness
ValidationParms const parms_;
@@ -791,7 +794,7 @@ public:
* @param removed Identifiers of nodes that are no longer trusted
*/
void
trustChanged(HashSet<NodeID> const& added, HashSet<NodeID> const& removed)
trustChanged(hash_set<NodeID> const& added, hash_set<NodeID> const& removed)
{
std::scoped_lock const lock{mutex_};
@@ -859,9 +862,9 @@ public:
// fall back to majority over acquiring ledgers
auto it = std::ranges::max_element(acquiring_, [](auto const& a, auto const& b) {
std::pair<Seq, ID> const& aKey = a.first;
typename HashSet<NodeID>::size_type const& aSize = a.second.size();
typename hash_set<NodeID>::size_type const& aSize = a.second.size();
std::pair<Seq, ID> const& bKey = b.first;
typename HashSet<NodeID>::size_type const& bSize = b.second.size();
typename hash_set<NodeID>::size_type const& bSize = b.second.size();
// order by number of trusted peers validating that ledger
// break ties with ledger ID
return std::tie(aSize, aKey.second) < std::tie(bSize, bKey.second);
@@ -927,7 +930,7 @@ public:
* does not know their sequence number
*/
ID
getPreferredLCL(Ledger const& lcl, Seq minSeq, HashMap<ID, std::uint32_t> const& peerCounts)
getPreferredLCL(Ledger const& lcl, Seq minSeq, hash_map<ID, std::uint32_t> const& peerCounts)
{
std::optional<std::pair<Seq, ID>> preferred = getPreferred(lcl);
@@ -1006,9 +1009,9 @@ public:
* @return The set of node ids for active, listed validators
*/
auto
getCurrentNodeIDs() -> HashSet<NodeID>
getCurrentNodeIDs() -> hash_set<NodeID>
{
HashSet<NodeID> ret;
hash_set<NodeID> ret;
std::scoped_lock const lock{mutex_};
current(
lock,
@@ -1124,7 +1127,7 @@ public:
* @return Quantity of laggards.
*/
std::size_t
laggards(Seq const seq, HashSet<NodeKey>& trustedKeys)
laggards(Seq const seq, hash_set<NodeKey>& trustedKeys)
{
std::size_t laggards = 0;
+14 -14
View File
@@ -88,7 +88,7 @@ class Config;
class HashRouter
{
public:
// The type here *MUST* match the type of Peer::ID
// The type here *MUST* match the type of Peer::id_t
using PeerShortID = std::uint32_t;
/**
@@ -107,17 +107,17 @@ public:
*/
explicit Setup() = default;
using Seconds = std::chrono::seconds;
using seconds = std::chrono::seconds;
/**
* Expiration time for a hash entry
*/
Seconds holdTime{300};
seconds holdTime{300};
/**
* Amount of time required before a relayed item will be relayed again.
*/
Seconds relayTime{30};
seconds relayTime{30};
};
private:
@@ -213,10 +213,10 @@ public:
// VFALCO TODO Replace "Suppression" terminology with something more
// semantically meaningful.
void
addSuppression(UInt256 const& key);
addSuppression(uint256 const& key);
bool
addSuppressionPeer(UInt256 const& key, PeerShortID peer);
addSuppressionPeer(uint256 const& key, PeerShortID peer);
/**
* Add a suppression peer and get message's relay status.
@@ -226,15 +226,15 @@ public:
* is unseated if has not relayed yet.
*/
std::pair<bool, std::optional<Stopwatch::time_point>>
addSuppressionPeerWithStatus(UInt256 const& key, PeerShortID peer);
addSuppressionPeerWithStatus(uint256 const& key, PeerShortID peer);
bool
addSuppressionPeer(UInt256 const& key, PeerShortID peer, HashRouterFlags& flags);
addSuppressionPeer(uint256 const& key, PeerShortID peer, HashRouterFlags& flags);
// Add a peer suppression and return whether the entry should be processed
bool
shouldProcess(
UInt256 const& key,
uint256 const& key,
PeerShortID peer,
HashRouterFlags& flags,
std::chrono::seconds txInterval);
@@ -245,10 +245,10 @@ public:
* @return `true` if the flags were changed. `false` if unchanged.
*/
bool
setFlags(UInt256 const& key, HashRouterFlags flags);
setFlags(uint256 const& key, HashRouterFlags flags);
HashRouterFlags
getFlags(UInt256 const& key);
getFlags(uint256 const& key);
/**
* Determines whether the hashed item should be relayed.
@@ -264,12 +264,12 @@ public:
* _not_ be relayed.
*/
std::optional<std::set<PeerShortID>>
shouldRelay(UInt256 const& key);
shouldRelay(uint256 const& key);
private:
// pair.second indicates whether the entry was created
std::pair<Entry&, bool>
emplace(UInt256 const&);
emplace(uint256 const&);
std::mutex mutable mutex_;
@@ -277,7 +277,7 @@ private:
Setup const setup_;
// Stores all suppressed hashes and their expiration time
beast::AgedUnorderedMap<UInt256, Entry, Stopwatch::ClockType, HardenedHash<StrongHash>>
beast::aged_unordered_map<uint256, Entry, Stopwatch::clock_type, HardenedHash<strong_hash>>
suppressionMap_;
};
+3 -3
View File
@@ -81,7 +81,7 @@ enum JobType {
class Job : public CountedObject<Job>
{
public:
using ClockType = std::chrono::steady_clock;
using clock_type = std::chrono::steady_clock;
/**
* Default constructor.
@@ -112,7 +112,7 @@ public:
/**
* Returns the time when the job was queued.
*/
[[nodiscard]] ClockType::time_point const&
[[nodiscard]] clock_type::time_point const&
queueTime() const;
void
@@ -135,7 +135,7 @@ private:
std::function<void()> job_;
std::shared_ptr<LoadEvent> loadEvent_;
std::string name_;
ClockType::time_point queueTime_;
clock_type::time_point queueTime_;
};
using JobCounter = ClosureCounter<void>;
+2 -2
View File
@@ -156,7 +156,7 @@ public:
JobQueue(
int threadCount,
beast::insight::Collector::Ptr const& collector,
beast::insight::Collector::ptr const& collector,
beast::Journal journal,
Logs& logs,
perf::PerfLog& perfLog);
@@ -280,7 +280,7 @@ private:
// Statistics tracking
perf::PerfLog& perfLog_;
beast::insight::Collector::Ptr collector_;
beast::insight::Collector::ptr collector_;
beast::insight::Gauge jobCount_;
beast::insight::Hook hook_;
+2 -2
View File
@@ -17,7 +17,7 @@ private:
LoadMonitor load_;
/* Support for insight */
beast::insight::Collector::Ptr collector_;
beast::insight::Collector::ptr collector_;
public:
/* The job category which we represent */
@@ -38,7 +38,7 @@ public:
JobTypeData(
JobTypeInfo const& info,
beast::insight::Collector::Ptr collector,
beast::insight::Collector::ptr collector,
Logs& logs) noexcept
: load_(logs.journal("LoadMonitor")), collector_(std::move(collector)), info(info)
+10 -10
View File
@@ -32,13 +32,13 @@ namespace perf {
class PerfLog
{
public:
using SteadyClock = std::chrono::steady_clock;
using SystemClock = std::chrono::system_clock;
using SteadyTimePoint = std::chrono::time_point<SteadyClock>;
using SystemTimePoint = std::chrono::time_point<SystemClock>;
using Seconds = std::chrono::seconds;
using Milliseconds = std::chrono::milliseconds;
using Microseconds = std::chrono::microseconds;
using steady_clock = std::chrono::steady_clock;
using system_clock = std::chrono::system_clock;
using steady_time_point = std::chrono::time_point<steady_clock>;
using system_time_point = std::chrono::time_point<system_clock>;
using seconds = std::chrono::seconds;
using milliseconds = std::chrono::milliseconds;
using microseconds = std::chrono::microseconds;
/**
* Configuration from [perf] section of xrpld.cfg.
@@ -47,7 +47,7 @@ public:
{
std::filesystem::path perfLog;
// log_interval is in milliseconds to support faster testing.
Milliseconds logInterval{Seconds(1)};
milliseconds logInterval{seconds(1)};
};
virtual ~PerfLog() = default;
@@ -106,7 +106,7 @@ public:
* @param instance JobQueue worker thread instance
*/
virtual void
jobStart(JobType const type, Microseconds dur, SteadyTimePoint startTime, int instance) = 0;
jobStart(JobType const type, microseconds dur, steady_time_point startTime, int instance) = 0;
/**
* Log job finishing
@@ -116,7 +116,7 @@ public:
* @param instance Jobqueue worker thread instance
*/
virtual void
jobFinish(JobType const type, Microseconds dur, int instance) = 0;
jobFinish(JobType const type, microseconds dur, int instance) = 0;
/**
* Render performance counters in Json
+3 -3
View File
@@ -40,7 +40,7 @@ template <
class TaggedCache;
class STLedgerEntry;
using SLE = STLedgerEntry;
using CachedSLEs = TaggedCache<UInt256, SLE const>;
using CachedSLEs = TaggedCache<uint256, SLE const>;
// Forward declarations
class AcceptedLedger;
@@ -180,7 +180,7 @@ public:
virtual InboundTransactions&
getInboundTransactions() = 0;
virtual TaggedCache<UInt256, AcceptedLedger>&
virtual TaggedCache<uint256, AcceptedLedger>&
getAcceptedLedgerCache() = 0;
virtual LedgerMaster&
@@ -237,7 +237,7 @@ public:
virtual Logs&
getLogs() = 0;
[[nodiscard]] virtual std::optional<UInt256> const&
[[nodiscard]] virtual std::optional<uint256> const&
getTrapTxID() const = 0;
/**
+1 -1
View File
@@ -207,7 +207,7 @@ private:
std::condition_variable cv_; // signaled when all threads paused
std::mutex mut_;
bool allPaused_{true};
Semaphore semaphore_; // each pending task is 1 resource
semaphore semaphore_; // each pending task is 1 resource
int numberOfThreads_{0}; // how many we want active now
std::atomic<int> activeCount_; // to know when all are paused
std::atomic<int> pauseCount_; // how many threads need to pause now
+1 -1
View File
@@ -91,6 +91,6 @@ public:
}
};
using Semaphore = BasicSemaphore<std::mutex, std::condition_variable>;
using semaphore = BasicSemaphore<std::mutex, std::condition_variable>;
} // namespace xrpl
+3 -3
View File
@@ -526,7 +526,7 @@ class ValueIteratorBase
{
public:
using iterator_category = std::bidirectional_iterator_tag;
using SizeT = unsigned int;
using size_t = unsigned int;
using difference_type = int;
using SelfType = ValueIteratorBase;
@@ -593,7 +593,7 @@ class ValueConstIterator : public ValueIteratorBase
friend class Value;
public:
using SizeT = unsigned int;
using size_t = unsigned int;
using difference_type = int;
using value_type = Value const;
using reference = Value const&;
@@ -658,7 +658,7 @@ class ValueIterator : public ValueIteratorBase
friend class Value;
public:
using SizeT = unsigned int;
using size_t = unsigned int;
using difference_type = int;
using value_type = Value;
using reference = Value&;
+18 -18
View File
@@ -48,33 +48,33 @@ public:
struct FeatureInfo
{
FeatureInfo() = delete;
FeatureInfo(std::string n, UInt256 const& f, VoteBehavior v)
FeatureInfo(std::string n, uint256 const& f, VoteBehavior v)
: name(std::move(n)), feature(f), vote(v)
{
}
std::string const name;
UInt256 const feature;
uint256 const feature;
VoteBehavior const vote;
};
virtual ~AmendmentTable() = default;
[[nodiscard]] virtual UInt256
[[nodiscard]] virtual uint256
find(std::string const& name) const = 0;
virtual bool
veto(UInt256 const& amendment) = 0;
veto(uint256 const& amendment) = 0;
virtual bool
unVeto(UInt256 const& amendment) = 0;
unVeto(uint256 const& amendment) = 0;
virtual bool
enable(UInt256 const& amendment) = 0;
enable(uint256 const& amendment) = 0;
[[nodiscard]] virtual bool
isEnabled(UInt256 const& amendment) const = 0;
isEnabled(uint256 const& amendment) const = 0;
[[nodiscard]] virtual bool
isSupported(UInt256 const& amendment) const = 0;
isSupported(uint256 const& amendment) const = 0;
/**
* @brief returns true if one or more amendments on the network
@@ -95,7 +95,7 @@ public:
* Returns a json::ValueType::Object.
*/
[[nodiscard]] virtual json::Value
getJson(UInt256 const& amendment, bool isAdmin) const = 0;
getJson(uint256 const& amendment, bool isAdmin) const = 0;
/**
* Called when a new fully-validated ledger is accepted.
@@ -122,33 +122,33 @@ public:
virtual void
doValidatedLedger(
LedgerIndex ledgerSeq,
std::set<UInt256> const& enabled,
MajorityAmendmentsT const& majority) = 0;
std::set<uint256> const& enabled,
majorityAmendments_t const& majority) = 0;
// Called when the set of trusted validators changes.
virtual void
trustChanged(HashSet<PublicKey> const& allTrusted) = 0;
trustChanged(hash_set<PublicKey> const& allTrusted) = 0;
// Called by the consensus code when we need to
// inject pseudo-transactions
virtual std::map<UInt256, std::uint32_t>
virtual std::map<uint256, std::uint32_t>
doVoting(
Rules const& rules,
NetClock::time_point closeTime,
std::set<UInt256> const& enabledAmendments,
MajorityAmendmentsT const& majorityAmendments,
std::set<uint256> const& enabledAmendments,
majorityAmendments_t const& majorityAmendments,
std::vector<std::shared_ptr<STValidation>> const& valSet) = 0;
// Called by the consensus code when we need to
// add feature entries to a validation
[[nodiscard]] virtual std::vector<UInt256>
doValidation(std::set<UInt256> const& enabled) const = 0;
[[nodiscard]] virtual std::vector<uint256>
doValidation(std::set<uint256> const& enabled) const = 0;
// The set of amendments to enable in the genesis ledger
// This will return all known, non-vetoed amendments.
// If we ever have two amendments that should not both be
// enabled at the same time, we should ensure one is vetoed.
[[nodiscard]] virtual std::vector<UInt256>
[[nodiscard]] virtual std::vector<uint256>
getDesired() const = 0;
// The function below adapts the API callers expect to the
+20 -27
View File
@@ -43,14 +43,7 @@ enum ApplyFlags : std::uint32_t {
// Transaction shouldn't be applied
// Signatures shouldn't be checked
TapDryRun = 0x1000,
// Transaction is being preflighted as the payload of a
// TransactionProposalCreate. Its signatures are collected on-ledger
// afterward, so signature-presence checks (e.g. Batch signer matching)
// are skipped at proposal-creation time (On-Chain Cosigner spec
// §5.3.1.2).
TapProposal = 0x2000
TapDryRun = 0x1000
};
constexpr ApplyFlags
@@ -147,8 +140,8 @@ private:
dirAdd(
bool preserveOrder,
Keylet const& directory,
UInt256 const& key,
std::function<void(SLE::Ref)> const& describe);
uint256 const& key,
std::function<void(SLE::ref)> const& describe);
public:
ApplyView() = default;
@@ -196,7 +189,7 @@ public:
* The key is no longer associated with the SLE.
*/
virtual void
erase(SLE::Ref sle) = 0;
erase(SLE::ref sle) = 0;
/**
* Insert a new state SLE
@@ -218,7 +211,7 @@ public:
* @note The key is taken from the SLE
*/
virtual void
insert(SLE::Ref sle) = 0;
insert(SLE::ref sle) = 0;
/**
* Indicate changes to a peeked SLE
@@ -238,7 +231,7 @@ public:
*/
/** @{ */
virtual void
update(SLE::Ref sle) = 0;
update(SLE::ref sle) = 0;
//--------------------------------------------------------------------------
@@ -333,7 +326,7 @@ public:
dirAppend(
Keylet const& directory,
Keylet const& key,
std::function<void(SLE::Ref)> const& describe)
std::function<void(SLE::ref)> const& describe)
{
if (key.type != ltOFFER)
{
@@ -372,8 +365,8 @@ public:
std::optional<std::uint64_t>
dirInsert(
Keylet const& directory,
UInt256 const& key,
std::function<void(SLE::Ref)> const& describe)
uint256 const& key,
std::function<void(SLE::ref)> const& describe)
{
return dirAdd(false, directory, key, describe);
}
@@ -382,7 +375,7 @@ public:
dirInsert(
Keylet const& directory,
Keylet const& key,
std::function<void(SLE::Ref)> const& describe)
std::function<void(SLE::ref)> const& describe)
{
return dirAdd(false, directory, key.key, describe);
}
@@ -406,7 +399,7 @@ public:
*/
/** @{ */
bool
dirRemove(Keylet const& directory, std::uint64_t page, UInt256 const& key, bool keepRoot);
dirRemove(Keylet const& directory, std::uint64_t page, uint256 const& key, bool keepRoot);
bool
dirRemove(Keylet const& directory, std::uint64_t page, Keylet const& key, bool keepRoot)
@@ -419,7 +412,7 @@ public:
* Remove the specified directory, invoking the callback for every node.
*/
bool
dirDelete(Keylet const& directory, std::function<void(UInt256 const&)> const&);
dirDelete(Keylet const& directory, std::function<void(uint256 const&)> const&);
/**
* Remove the specified directory, if it is empty.
@@ -466,20 +459,20 @@ std::uint64_t
createRoot(
ApplyView& view,
Keylet const& directory,
UInt256 const& key,
std::function<void(SLE::Ref)> const& describe);
uint256 const& key,
std::function<void(SLE::ref)> const& describe);
auto
findPreviousPage(ApplyView& view, Keylet const& directory, SLE::Ref start);
findPreviousPage(ApplyView& view, Keylet const& directory, SLE::ref start);
std::uint64_t
insertKey(
ApplyView& view,
SLE::Ref node,
SLE::ref node,
std::uint64_t page,
bool preserveOrder,
STVector256& indexes,
UInt256 const& key);
uint256 const& key);
std::optional<std::uint64_t>
insertPage(
@@ -487,10 +480,10 @@ insertPage(
std::uint64_t page,
SLE::pointer node,
std::uint64_t nextPage,
SLE::Ref next,
UInt256 const& key,
SLE::ref next,
uint256 const& key,
Keylet const& directory,
std::function<void(SLE::Ref)> const& describe);
std::function<void(SLE::ref)> const& describe);
} // namespace directory
} // namespace xrpl
+4 -4
View File
@@ -50,7 +50,7 @@ public:
OpenView& to,
STTx const& tx,
TER ter,
std::optional<UInt256> parentBatchId,
std::optional<uint256> parentBatchId,
bool isDryRun,
beast::Journal j);
@@ -81,10 +81,10 @@ public:
visit(
OpenView& target,
std::function<void(
UInt256 const& key,
uint256 const& key,
bool isDelete,
SLE::ConstRef before,
SLE::ConstRef after)> const& func);
SLE::const_ref before,
SLE::const_ref after)> const& func);
private:
std::optional<STAmount> deliver_;
+10 -10
View File
@@ -15,12 +15,12 @@ class BookDirs
{
private:
ReadView const* view_ = nullptr;
UInt256 const root_;
UInt256 const nextQuality_;
UInt256 const key_;
uint256 const root_;
uint256 const nextQuality_;
uint256 const key_;
SLE::const_pointer sle_ = nullptr;
unsigned int entry_ = 0;
UInt256 index_;
uint256 index_;
public:
class const_iterator; // NOLINT(readability-identifier-naming)
@@ -67,19 +67,19 @@ public:
private:
friend class BookDirs;
const_iterator(ReadView const& view, UInt256 const& root, UInt256 const& dirKey)
const_iterator(ReadView const& view, uint256 const& root, uint256 const& dirKey)
: view_(&view), root_(root), key_(dirKey), curKey_(dirKey)
{
}
ReadView const* view_ = nullptr;
UInt256 root_;
UInt256 nextQuality_;
UInt256 key_;
UInt256 curKey_;
uint256 root_;
uint256 nextQuality_;
uint256 key_;
uint256 curKey_;
SLE::const_pointer sle_;
unsigned int entry_ = 0;
UInt256 index_;
uint256 index_;
std::optional<value_type> mutable cache_;
};
+1 -1
View File
@@ -5,5 +5,5 @@
#include <xrpl/protocol/STLedgerEntry.h>
namespace xrpl {
using CachedSLEs = TaggedCache<UInt256, SLE const>;
using CachedSLEs = TaggedCache<uint256, SLE const>;
} // namespace xrpl
+10 -10
View File
@@ -26,7 +26,7 @@ private:
DigestAwareReadView const& base_;
CachedSLEs& cache_;
std::mutex mutable mutex_;
std::unordered_map<key_type, UInt256, HardenedHash<>> mutable map_;
std::unordered_map<key_type, uint256, HardenedHash<>> mutable map_;
public:
CachedViewImpl() = delete;
@@ -78,31 +78,31 @@ public:
return base_.succ(key, last);
}
std::unique_ptr<SlesType::IterBase>
std::unique_ptr<SlesType::iter_base>
slesBegin() const override
{
return base_.slesBegin();
}
std::unique_ptr<SlesType::IterBase>
std::unique_ptr<SlesType::iter_base>
slesEnd() const override
{
return base_.slesEnd();
}
std::unique_ptr<SlesType::IterBase>
slesUpperBound(UInt256 const& key) const override
std::unique_ptr<SlesType::iter_base>
slesUpperBound(uint256 const& key) const override
{
return base_.slesUpperBound(key);
}
std::unique_ptr<TxsType::IterBase>
std::unique_ptr<TxsType::iter_base>
txsBegin() const override
{
return base_.txsBegin();
}
std::unique_ptr<TxsType::IterBase>
std::unique_ptr<TxsType::iter_base>
txsEnd() const override
{
return base_.txsEnd();
@@ -114,7 +114,7 @@ public:
return base_.txExists(key);
}
TxType
tx_type
txRead(key_type const& key) const override
{
return base_.txRead(key);
@@ -124,7 +124,7 @@ public:
// DigestAwareReadView
//
std::optional<DigestType>
std::optional<digest_type>
digest(key_type const& key) const override
{
return base_.digest(key);
@@ -147,7 +147,7 @@ private:
std::shared_ptr<Base const> sp_;
public:
using BaseType = Base;
using base_type = Base;
CachedView() = delete;
CachedView(CachedView const&) = delete;
+8 -8
View File
@@ -27,7 +27,7 @@ private:
class Key
{
public:
Key(UInt256 const& account, SeqProxy seqProx, UInt256 const& id)
Key(uint256 const& account, SeqProxy seqProx, uint256 const& id)
: account_(account), txId_(id), seqProxy_(seqProx)
{
}
@@ -59,21 +59,21 @@ private:
return lhs.txId_ == rhs.txId_;
}
[[nodiscard]] UInt256 const&
[[nodiscard]] uint256 const&
getAccount() const
{
return account_;
}
[[nodiscard]] UInt256 const&
[[nodiscard]] uint256 const&
getTXID() const
{
return txId_;
}
private:
UInt256 account_;
UInt256 txId_;
uint256 account_;
uint256 txId_;
SeqProxy seqProxy_;
};
@@ -81,7 +81,7 @@ private:
operator<(Key const& lhs, Key const& rhs);
// Calculate the salted key for the given account
UInt256
uint256
accountKey(AccountID const& account);
public:
@@ -141,7 +141,7 @@ public:
return map_.empty();
}
[[nodiscard]] UInt256 const&
[[nodiscard]] uint256 const&
key() const
{
return salt_;
@@ -151,7 +151,7 @@ private:
std::map<Key, std::shared_ptr<STTx const>> map_;
// Used to salt the accounts so people can't mine for low account numbers
UInt256 salt_;
uint256 salt_;
};
} // namespace xrpl
Loaded 100 of 1053 files, more files were not shown because too many files have changed in this diff. Show more