├── .github
└── workflows
│ └── ci.yml
├── .gitignore
├── .vscode
├── launch.json
├── settings.json
└── tasks.json
├── AUTHORS
├── COPYING
├── ChangeLog
├── INSTALL
├── Makefile.am
├── NEWS
├── README
├── README.md
├── autogen.sh
├── build.cmd
├── builds
├── cmake
│ ├── CMakeLists.txt
│ ├── CMakePresets.json
│ └── modules
│ │ └── FindBitcoin-System.cmake
├── msvc
│ ├── .gitignore
│ ├── build
│ │ ├── build_all.bat
│ │ ├── build_base.bat
│ │ └── nuget_all.bat
│ ├── debug.natvis
│ ├── nuget.config
│ ├── properties
│ │ ├── Arm.props
│ │ ├── Arm64.props
│ │ ├── Common.props
│ │ ├── DLL.props
│ │ ├── Debug.props
│ │ ├── DebugDEXE.props
│ │ ├── DebugDLL.props
│ │ ├── DebugLEXE.props
│ │ ├── DebugLIB.props
│ │ ├── DebugLTCG.props
│ │ ├── DebugSEXE.props
│ │ ├── EXE.props
│ │ ├── LIB.props
│ │ ├── LTCG.props
│ │ ├── Link.props
│ │ ├── Messages.props
│ │ ├── Output.props
│ │ ├── Release.props
│ │ ├── ReleaseDEXE.props
│ │ ├── ReleaseDLL.props
│ │ ├── ReleaseLEXE.props
│ │ ├── ReleaseLIB.props
│ │ ├── ReleaseLTCG.props
│ │ ├── ReleaseSEXE.props
│ │ ├── Win32.props
│ │ └── x64.props
│ └── vs2022
│ │ ├── libbitcoin-database-test
│ │ ├── libbitcoin-database-test.props
│ │ ├── libbitcoin-database-test.vcxproj
│ │ ├── libbitcoin-database-test.vcxproj.filters
│ │ └── packages.config
│ │ ├── libbitcoin-database-tools
│ │ ├── libbitcoin-database-tools.props
│ │ ├── libbitcoin-database-tools.vcxproj
│ │ ├── libbitcoin-database-tools.vcxproj.filters
│ │ └── packages.config
│ │ ├── libbitcoin-database.import.props
│ │ ├── libbitcoin-database.import.xml
│ │ ├── libbitcoin-database.sln
│ │ ├── libbitcoin-database
│ │ ├── libbitcoin-database.props
│ │ ├── libbitcoin-database.vcxproj
│ │ ├── libbitcoin-database.vcxproj.filters
│ │ └── packages.config
│ │ ├── libbitcoin-system.import.props
│ │ └── libbitcoin-system.import.xml
└── vscode
│ └── database.code-workspace
├── configure.ac
├── include
└── bitcoin
│ ├── database.hpp
│ └── database
│ ├── boost.hpp
│ ├── define.hpp
│ ├── error.hpp
│ ├── file
│ ├── file.hpp
│ ├── rotator.hpp
│ └── utilities.hpp
│ ├── impl
│ ├── memory
│ │ └── accessor.ipp
│ ├── primitives
│ │ ├── arrayhead.ipp
│ │ ├── arraymap.ipp
│ │ ├── hashhead.ipp
│ │ ├── hashmap.ipp
│ │ ├── iterator.ipp
│ │ ├── keys.ipp
│ │ ├── linkage.ipp
│ │ ├── manager.ipp
│ │ └── nomap.ipp
│ ├── query
│ │ ├── archive_read.ipp
│ │ ├── archive_write.ipp
│ │ ├── confirm.ipp
│ │ ├── consensus.ipp
│ │ ├── context.ipp
│ │ ├── extent.ipp
│ │ ├── height.ipp
│ │ ├── initialize.ipp
│ │ ├── network.ipp
│ │ ├── objects.ipp
│ │ ├── optional.ipp
│ │ ├── query.ipp
│ │ ├── translate.ipp
│ │ └── validate.ipp
│ └── store.ipp
│ ├── locks
│ ├── file_lock.hpp
│ ├── flush_lock.hpp
│ ├── interprocess_lock.hpp
│ └── locks.hpp
│ ├── memory
│ ├── accessor.hpp
│ ├── finalizer.hpp
│ ├── interfaces
│ │ ├── memory.hpp
│ │ └── storage.hpp
│ ├── map.hpp
│ ├── memory.hpp
│ ├── reader.hpp
│ ├── streamers.hpp
│ └── utilities.hpp
│ ├── primitives
│ ├── arrayhead.hpp
│ ├── arraymap.hpp
│ ├── hashhead.hpp
│ ├── hashmap.hpp
│ ├── iterator.hpp
│ ├── keys.hpp
│ ├── linkage.hpp
│ ├── manager.hpp
│ ├── nomap.hpp
│ └── primitives.hpp
│ ├── query.hpp
│ ├── settings.hpp
│ ├── store.hpp
│ ├── tables
│ ├── archives
│ │ ├── header.hpp
│ │ ├── input.hpp
│ │ ├── ins.hpp
│ │ ├── output.hpp
│ │ ├── outs.hpp
│ │ ├── point.hpp
│ │ ├── transaction.hpp
│ │ └── txs.hpp
│ ├── association.hpp
│ ├── associations.hpp
│ ├── caches
│ │ ├── duplicate.hpp
│ │ ├── prevout.hpp
│ │ ├── validated_bk.hpp
│ │ └── validated_tx.hpp
│ ├── context.hpp
│ ├── event.hpp
│ ├── indexes
│ │ ├── height.hpp
│ │ └── strong_tx.hpp
│ ├── names.hpp
│ ├── optionals
│ │ ├── address.hpp
│ │ ├── filter_bk.hpp
│ │ └── filter_tx.hpp
│ ├── point_set.hpp
│ ├── schema.hpp
│ ├── states.hpp
│ ├── table.hpp
│ └── tables.hpp
│ └── version.hpp
├── install-cmake.sh
├── install-cmakepresets.sh
├── install.sh
├── libbitcoin-database-test_runner.sh
├── libbitcoin-database.pc.in
├── m4
├── .gitignore
├── ax_boost_base.m4
├── ax_boost_unit_test_framework.m4
├── ax_check_compile_flag.m4
├── ax_check_link_flag.m4
├── ax_check_preproc_flag.m4
└── ax_cxx_compile_stdcxx.m4
├── src
├── error.cpp
├── file
│ ├── rotator.cpp
│ └── utilities.cpp
├── locks
│ ├── file_lock.cpp
│ ├── flush_lock.cpp
│ └── interprocess_lock.cpp
├── memory
│ ├── map.cpp
│ ├── mman-win32
│ │ ├── mman.cpp
│ │ └── mman.hpp
│ └── utilities.cpp
└── settings.cpp
├── test
├── error.cpp
├── file
│ ├── rotator.cpp
│ └── utilities.cpp
├── locks
│ ├── file_lock.cpp
│ ├── flush_lock.cpp
│ └── interprocess_lock.cpp
├── main.cpp
├── memory
│ ├── accessor.cpp
│ ├── map.cpp
│ └── utilities.cpp
├── mocks
│ ├── blocks.cpp
│ ├── blocks.hpp
│ ├── chunk_storage.cpp
│ ├── chunk_storage.hpp
│ ├── chunk_store.hpp
│ └── map_store.hpp
├── primitives
│ ├── arrayhead.cpp
│ ├── arraymap.cpp
│ ├── hashhead.cpp
│ ├── hashmap.cpp
│ ├── iterator.cpp
│ ├── keys.cpp
│ ├── linkage.cpp
│ ├── manager.cpp
│ └── nomap.cpp
├── query
│ ├── archive_read.cpp
│ ├── archive_write.cpp
│ ├── confirm.cpp
│ ├── consensus.cpp
│ ├── context.cpp
│ ├── extent.cpp
│ ├── height.cpp
│ ├── initialize.cpp
│ ├── network.cpp
│ ├── objects.cpp
│ ├── optional.cpp
│ ├── translate.cpp
│ └── validate.cpp
├── settings.cpp
├── store.cpp
├── tables
│ ├── archives
│ │ ├── header.cpp
│ │ ├── input.cpp
│ │ ├── output.cpp
│ │ ├── point.cpp
│ │ ├── puts.cpp
│ │ ├── transaction.cpp
│ │ └── txs.cpp
│ ├── caches
│ │ ├── duplicate.cpp
│ │ ├── prevout.cpp
│ │ ├── validated_bk.cpp
│ │ └── validated_tx.cpp
│ ├── indexes
│ │ ├── height.cpp
│ │ └── strong_tx.cpp
│ └── optional
│ │ ├── address.cpp
│ │ ├── filter_bk.cpp
│ │ └── filter_tx.cpp
├── test.cpp
└── test.hpp
└── tools
└── initchain
└── initchain.cpp
/.gitignore:
--------------------------------------------------------------------------------
1 | .deps
2 | .libs
3 | *.la
4 | *.lo
5 | *.o
6 | *.pyc
7 | Makefile
8 | Makefile.in
9 | libbitcoin-database.pc
10 |
11 | bin
12 | obj
13 | build
14 | .*.swp
15 | *~
16 | /*.kdev4
17 | /.cproject
18 | /.project
19 | /.settings
20 | /nbproject
21 |
22 | /aclocal.m4
23 | /autom4te.cache
24 | /build-aux
25 | /config.*
26 | /configure
27 | /libtool
28 | .dirstamp
29 |
30 | *.vsidx
31 | *.lock
32 | /.vs
33 |
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense to learn about possible attributes.
3 | // Hover to view descriptions of existing attributes.
4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "name": "(gdb) Launch",
9 | "type": "cppdbg",
10 | "request": "launch",
11 | "program": "${workspaceFolder}/obj/nix-gnu-debug-static/libbitcoin-database-test",
12 | "args": [],
13 | "stopAtEntry": false,
14 | "cwd": "${workspaceFolder}/obj/nix-gnu-debug-static",
15 | "environment": [],
16 | "externalConsole": false,
17 | "MIMode": "gdb",
18 | "setupCommands": [
19 | {
20 | "description": "Enable pretty-printing for gdb",
21 | "text": "-enable-pretty-printing",
22 | "ignoreFailures": true
23 | },
24 | {
25 | "description": "Set Disassembly Flavor to Intel",
26 | "text": "-gdb-set disassembly-flavor intel",
27 | "ignoreFailures": true
28 | }
29 | ]
30 | }
31 | ]
32 | }
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "cmake.sourceDirectory": "${workspaceFolder}/builds/cmake",
3 | "cmake.useCMakePresets": "always"
4 | }
5 |
--------------------------------------------------------------------------------
/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "2.0.0",
3 | "tasks": [
4 | {
5 | "type": "cmake",
6 | "label": "CMake: build",
7 | "command": "build",
8 | "targets": [
9 | "all"
10 | ],
11 | "preset": "${command:cmake.activeBuildPresetName}",
12 | "group": "build",
13 | "problemMatcher": [],
14 | "detail": "CMake template build task"
15 | },
16 | {
17 | "type": "cmake",
18 | "label": "CMake: clean",
19 | "command": "clean",
20 | "preset": "${command:cmake.activeBuildPresetName}",
21 | "problemMatcher": [],
22 | "detail": "CMake template clean task"
23 | },
24 | {
25 | "type": "cmake",
26 | "label": "CMake: install",
27 | "command": "install",
28 | "preset": "${command:cmake.activeBuildPresetName}",
29 | "problemMatcher": [],
30 | "detail": "CMake template install task"
31 | }
32 | ]
33 | }
--------------------------------------------------------------------------------
/AUTHORS:
--------------------------------------------------------------------------------
1 | commits libbitcoin developers
2 | --------------------------------------------
3 | 918 Eric Voskuil (evoskuil)
4 | 262 Amir Taaki (genjix)
5 | 68 Phillip Mienk (pmienk)
6 | 5 Neill Miller (thecodefactory)
7 | 3 William Swanson (swansontec)
8 | 1 Noel Maersk (veox)
9 |
--------------------------------------------------------------------------------
/ChangeLog:
--------------------------------------------------------------------------------
1 | Use command 'git log --oneline --decorate' for latest change log.
2 |
--------------------------------------------------------------------------------
/NEWS:
--------------------------------------------------------------------------------
1 | See https://libbitcoin.org
--------------------------------------------------------------------------------
/README:
--------------------------------------------------------------------------------
1 | See README.md
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | This branch is not usable in its current state. Please see [version3](https://github.com/libbitcoin/libbitcoin-database/tree/version3) for the latest functional branch.
2 |
--------------------------------------------------------------------------------
/autogen.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | ###############################################################################
3 | # Copyright (c) 2014-2025 libbitcoin-database developers (see COPYING).
4 | #
5 | # GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY
6 | #
7 | ###############################################################################
8 |
9 | autoreconf -i
10 |
--------------------------------------------------------------------------------
/build.cmd:
--------------------------------------------------------------------------------
1 | REM ###########################################################################
2 | REM # Copyright (c) 2014-2025 libbitcoin-database developers (see COPYING).
3 | REM #
4 | REM # GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY
5 | REM #
6 | REM ###########################################################################
7 | @echo off
8 | SETLOCAL ENABLEEXTENSIONS
9 | SET "parent=%~dp0"
10 | SET "relative_path_base=%~1"
11 | call cd /d "%relative_path_base%"
12 | SET "path_base=%cd%"
13 | SET "nuget_pkg_path=%path_base%\.nuget\packages"
14 | SET "msbuild_args=/verbosity:minimal /p:Platform=%~2 /p:Configuration=%~3 /p:PreferredToolArchitecture=%~4"
15 | SET "proj_version=%~5"
16 | SET "msbuild_exe=msbuild"
17 | IF EXIST "%~6" SET "msbuild_exe=%~6"
18 |
19 | call :pending "Build initialized..."
20 | IF NOT EXIST "%nuget_pkg_path%" (
21 | call mkdir "%nuget_pkg_path%"
22 | IF %ERRORLEVEL% NEQ 0 (
23 | call :failure "mkdir %nuget_pkg_path% failed."
24 | exit /b 1
25 | )
26 | )
27 |
28 | call :init libbitcoin libbitcoin-system master
29 | IF %ERRORLEVEL% NEQ 0 (
30 | call :failure "Initializing repository libbitcoin libbitcoin-system master failed."
31 | exit /b 1
32 | )
33 | call :bld_repo libbitcoin-database
34 | IF %ERRORLEVEL% NEQ 0 (
35 | call :failure "Building libbitcoin-database failed."
36 | exit /b 1
37 | )
38 |
39 | call :success "Build complete."
40 | exit /b 0
41 |
42 |
43 |
44 | :init
45 | call :pending "Initializing repository %~1/%~2/%~3..."
46 | IF NOT EXIST "%path_base%\%~2" (
47 | call git clone -q --branch=%~3 https://github.com/%~1/%~2 "%path_base%\%~2"
48 | IF %ERRORLEVEL% NEQ 0 (
49 | call :failure "git clone %~1/%~2 failed."
50 | exit /b 1
51 | )
52 | ) ELSE (
53 | call :success "%path_base%\%~2 exists, assuming valid clone."
54 | )
55 |
56 | call :bld_proj %~2
57 | IF %ERRORLEVEL% NEQ 0 (
58 | call :failure "Building project %~2 failed."
59 | exit /b 1
60 | )
61 | call :success "Initialization of %~1/%~2/%~3 complete."
62 | exit /b 0
63 |
64 | :bld_repo
65 | call :pending "Building respository %~1..."
66 | call :depends "%~1"
67 | IF %ERRORLEVEL% NEQ 0 (
68 | call :failure "Initializing dependencies %~1 failed."
69 | exit /b 1
70 | )
71 | call cd /d "%path_base%\%~1\builds\msvc\%proj_version%"
72 | call "%msbuild_exe%" %msbuild_args% %~1.sln /p:PreBuildEventUseInBuild=false /p:PostBuildEventUseInBuild=false
73 | IF %ERRORLEVEL% NEQ 0 (
74 | call :failure "%msbuild_exe% %msbuild_args% %~1.sln failed."
75 | exit /b 1
76 | )
77 | call :success "Building repository %~1 execution complete."
78 | call cd /d "%path_base%"
79 | exit /b 0
80 |
81 | :bld_proj
82 | call :pending "Building respository project %~1..."
83 | call :depends %~1
84 | IF %ERRORLEVEL% NEQ 0 (
85 | call :failure "Initializing dependencies %~1 failed."
86 | exit /b 1
87 | )
88 | call cd /d "%path_base%\%~1\builds\msvc\%proj_version%"
89 | call "%msbuild_exe%" %msbuild_args% /target:%~1:Rebuild %~1.sln /p:PreBuildEventUseInBuild=false /p:PostBuildEventUseInBuild=false
90 | IF %ERRORLEVEL% NEQ 0 (
91 | call :failure "%msbuild_exe% %msbuild_args% /target:%~1:Rebuild %~1.sln"
92 | exit /b 1
93 | )
94 | call :success "Building repository project %~1 execution complete."
95 | call cd /d "%path_base%"
96 | exit /b 0
97 |
98 | :depends
99 | call :pending "nuget restoring dependencies for %~1..."
100 | call nuget restore "%path_base%\%~1\builds\msvc\%proj_version%\%~1.sln" -OutputDirectory "%nuget_pkg_path%"
101 | IF %ERRORLEVEL% NEQ 0 (
102 | call :failure "nuget restore failed."
103 | exit /b 1
104 | )
105 | call :success "nuget restoration for %~1 complete."
106 | exit /b 0
107 |
108 | :pending
109 | echo [93m%~1[0m
110 | exit /b 0
111 |
112 | :success
113 | echo [92m%~1[0m
114 | exit /b 0
115 |
116 | :failure
117 | echo [91m%~1[0m
118 | exit /b 0
119 |
--------------------------------------------------------------------------------
/builds/cmake/modules/FindBitcoin-System.cmake:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Copyright (c) 2014-2025 libbitcoin-protocol developers (see COPYING).
3 | #
4 | # GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY
5 | #
6 | ###############################################################################
7 | # FindBitcoin
8 | #
9 | # Use this module by invoking find_package with the form::
10 | #
11 | # find_package( Bitcoin-System
12 | # [version] # Minimum version
13 | # [REQUIRED] # Fail with error if bitcoin is not found
14 | # )
15 | #
16 | # Defines the following for use:
17 | #
18 | # bitcoin_system_FOUND - true if headers and requested libraries were found
19 | # bitcoin_system_INCLUDE_DIRS - include directories for bitcoin-system libraries
20 | # bitcoin_system_LIBRARY_DIRS - link directories for bitcoin-system libraries
21 | # bitcoin_system_LIBRARIES - bitcoin-system libraries to be linked
22 | # bitcoin_system_PKG - bitcoin-system pkg-config package specification.
23 | #
24 |
25 | if (MSVC)
26 | if ( Bitcoin-System_FIND_REQUIRED )
27 | set( _bitcoin_system_MSG_STATUS "SEND_ERROR" )
28 | else ()
29 | set( _bitcoin_system_MSG_STATUS "STATUS" )
30 | endif()
31 |
32 | set( bitcoin_system_FOUND false )
33 | message( ${_bitcoin_system_MSG_STATUS} "MSVC environment detection for 'bitcoin-system' not currently supported." )
34 | else ()
35 | # required
36 | if ( Bitcoin-System_FIND_REQUIRED )
37 | set( _bitcoin_system_REQUIRED "REQUIRED" )
38 | endif()
39 |
40 | # quiet
41 | if ( Bitcoin-System_FIND_QUIETLY )
42 | set( _bitcoin_system_QUIET "QUIET" )
43 | endif()
44 |
45 | # modulespec
46 | if ( Bitcoin-System_FIND_VERSION_COUNT EQUAL 0 )
47 | set( _bitcoin_system_MODULE_SPEC "libbitcoin-system" )
48 | else ()
49 | if ( Bitcoin-System_FIND_VERSION_EXACT )
50 | set( _bitcoin_system_MODULE_SPEC_OP "=" )
51 | else ()
52 | set( _bitcoin_system_MODULE_SPEC_OP ">=" )
53 | endif()
54 |
55 | set( _bitcoin_system_MODULE_SPEC "libbitcoin-system ${_bitcoin_system_MODULE_SPEC_OP} ${Bitcoin-System_FIND_VERSION}" )
56 | endif()
57 |
58 | pkg_check_modules( bitcoin_system ${_bitcoin_system_REQUIRED} ${_bitcoin_system_QUIET} "${_bitcoin_system_MODULE_SPEC}" )
59 | set( bitcoin_system_PKG "${_bitcoin_system_MODULE_SPEC}" )
60 | endif()
61 |
--------------------------------------------------------------------------------
/builds/msvc/.gitignore:
--------------------------------------------------------------------------------
1 | *.bin
2 | *.json
3 | *.suo
4 | *.opensdf
5 | *.sdf
6 | *.log
7 | *.aps
8 | *.user
9 | *.ipch
10 | *.VC.*
11 | address_rows
12 | address_table
13 | block_table
14 | candidate_index
15 | confirmed_index
16 | file_storage
17 | hash_table
18 | record_hash_table_64bit
19 | spend_table
20 | stealth_rows
21 | transaction_index
22 | transaction_table
23 | tx_index
24 | tx_table
25 | block_lookup
26 | block_rows
27 | lookup
28 | rows
29 | spend
30 | transaction
31 | record_manager
32 | slab_manager
33 | slab_hash_table
--------------------------------------------------------------------------------
/builds/msvc/build/build_all.bat:
--------------------------------------------------------------------------------
1 | @ECHO OFF
2 | CALL nuget_all.bat
3 | ECHO.
4 | CALL build_base.bat vs2022 libbitcoin-database "Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build"
5 | CALL build_base.bat vs2019 libbitcoin-database "Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build"
6 | CALL build_base.bat vs2017 libbitcoin-database "Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build"
7 | REM CALL build_base.bat vs2015 libbitcoin-database "Microsoft Visual Studio 14.0\VC"
8 | REM CALL build_base.bat vs2013 libbitcoin-database "Microsoft Visual Studio 12.0\VC"
9 | PAUSE
10 |
--------------------------------------------------------------------------------
/builds/msvc/build/build_base.bat:
--------------------------------------------------------------------------------
1 | @ECHO OFF
2 | REM Usage: [buildbase.bat vs2017 libbitcoin "Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build"]
3 | REM Usage: [buildbase.bat vs2015 libbitcoin "Microsoft Visual Studio 14.0\VC"]
4 | REM Usage: [buildbase.bat vs2013 libbitcoin "Microsoft Visual Studio 12.0\VC"]
5 |
6 | SET studio=%1
7 | SET project=%2
8 | SET version=%~3
9 |
10 | SET log=%studio%.log
11 | SET solution=..\%studio%\%project%.sln
12 | SET tools=%version%\vcvarsall.bat
13 | SET environment=%programfiles(x86)%\%tools%
14 |
15 | IF NOT EXIST "%environment%" SET environment=%programfiles%\%tools%
16 | IF NOT EXIST "%environment%" GOTO no_tools
17 |
18 | ECHO Building: %solution%
19 |
20 | CALL "%environment%" x86 > nul
21 | ECHO Platform=x86
22 |
23 | ECHO Configuration=StaticDebug
24 | msbuild /m /v:n /p:Configuration=StaticDebug /p:Platform=Win32 %solution% >> %log%
25 | IF errorlevel 1 GOTO error
26 | ECHO Configuration=StaticRelease
27 | msbuild /m /v:n /p:Configuration=StaticRelease /p:Platform=Win32 %solution% >> %log%
28 | IF errorlevel 1 GOTO error
29 |
30 | CALL "%environment%" x86_amd64 > nul
31 | ECHO Platform=x64
32 |
33 | ECHO Configuration=StaticDebug
34 | msbuild /m /v:n /p:Configuration=StaticDebug /p:Platform=x64 %solution% >> %log%
35 | IF errorlevel 1 GOTO error
36 | ECHO Configuration=StaticRelease
37 | msbuild /m /v:n /p:Configuration=StaticRelease /p:Platform=x64 %solution% >> %log%
38 | IF errorlevel 1 GOTO error
39 |
40 | ECHO Complete: %solution%
41 | GOTO end
42 |
43 | :error
44 | ECHO *** ERROR, build terminated early, see: %log%
45 | GOTO end
46 |
47 | :no_tools
48 | ECHO *** ERROR, build tools not found: %tools%
49 |
50 | :end
51 |
52 |
--------------------------------------------------------------------------------
/builds/msvc/build/nuget_all.bat:
--------------------------------------------------------------------------------
1 | @ECHO OFF
2 | ECHO Downloading libbitcoin vs2022 dependencies from NuGet
3 | CALL nuget.exe install ..\vs2022\libbitcoin-database\packages.config
4 | CALL nuget.exe install ..\vs2022\libbitcoin-database-tools\packages.config
5 | CALL nuget.exe install ..\vs2022\libbitcoin-database-test\packages.config
6 | ECHO.
7 | ECHO Downloading libbitcoin vs2019 dependencies from NuGet
8 | CALL nuget.exe install ..\vs2019\libbitcoin-database\packages.config
9 | CALL nuget.exe install ..\vs2019\libbitcoin-database-tools\packages.config
10 | CALL nuget.exe install ..\vs2019\libbitcoin-database-test\packages.config
11 | ECHO.
12 | ECHO Downloading libbitcoin vs2017 dependencies from NuGet
13 | CALL nuget.exe install ..\vs2017\libbitcoin-database\packages.config
14 | CALL nuget.exe install ..\vs2017\libbitcoin-database-tools\packages.config
15 | CALL nuget.exe install ..\vs2017\libbitcoin-database-test\packages.config
16 |
--------------------------------------------------------------------------------
/builds/msvc/debug.natvis:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
12 | { m_backend }
13 |
14 |
15 |
16 |
17 | { m_data }
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/builds/msvc/nuget.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
22 |
23 |
24 |
25 |
26 |
30 |
31 |
--------------------------------------------------------------------------------
/builds/msvc/properties/Arm.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | <_PropertySheetDisplayName>ARM32 Settings
6 |
7 |
8 |
9 |
10 |
13 | WIN32;_WIN32;_ARM_;%(PreprocessorDefinitions)
14 |
15 |
16 | MachineARM
17 |
18 |
19 | /MACHINE:ARM %(AdditionalOptions)
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/builds/msvc/properties/Arm64.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | <_PropertySheetDisplayName>ARM64 Settings
6 |
7 |
8 |
9 |
10 |
13 | WIN32;_WIN32;_ARM64;%(PreprocessorDefinitions)
14 |
15 |
16 | MachineARM64
17 |
18 |
19 | /MACHINE:ARM64 %(AdditionalOptions)
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/builds/msvc/properties/Common.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | <_PropertySheetDisplayName>Common Settings
6 | Unicode
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | x64
15 |
16 |
17 |
18 |
19 | UNICODE;_UNICODE;%(PreprocessorDefinitions)
20 |
21 |
22 |
23 | Level4
24 | false
25 | false
26 | true
27 |
28 |
29 |
30 | /Zc:__cplusplus %(AdditionalOptions)
31 | true
32 | true
33 | false
34 | false
35 | stdc11
36 | stdcpp14
37 | stdcpp17
38 | stdcpp20
39 | false
40 | true
41 | true
42 |
43 |
44 |
45 |
46 | Level4
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/builds/msvc/properties/DLL.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | <_PropertySheetDisplayName>Dynamic Library
6 | dynamic
7 | .dll
8 |
9 |
10 |
11 |
12 | _DLL;_WINDLL;%(PreprocessorDefinitions)
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/builds/msvc/properties/Debug.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | <_PropertySheetDisplayName>Debug Settings
10 | Debug
11 |
12 |
13 |
14 |
15 |
16 | EnableFastChecks
17 | ProgramDatabase
18 | true
19 | true
20 | Disabled
21 | _DEBUG;%(PreprocessorDefinitions)
22 |
23 |
24 | _DEBUG;%(PreprocessorDefinitions)
25 |
26 |
27 | true
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/builds/msvc/properties/DebugDEXE.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | <_PropertySheetDisplayName>Console Debug Dynamic
6 | dynamic
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | MultiThreadedDebugDLL
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/builds/msvc/properties/DebugDLL.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | <_PropertySheetDisplayName>Dynamic Debug Library
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | MultiThreadedDebugDLL
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/builds/msvc/properties/DebugLEXE.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | <_PropertySheetDisplayName>Console Debug Link Time Code Generation
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | MultiThreadedDebug
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/builds/msvc/properties/DebugLIB.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | <_PropertySheetDisplayName>Static Debug Library
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | MultiThreadedDebug
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/builds/msvc/properties/DebugLTCG.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | <_PropertySheetDisplayName>Static Debug Link Time Code Generation Library
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | MultiThreadedDebug
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/builds/msvc/properties/DebugSEXE.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | <_PropertySheetDisplayName>Console Debug Static
6 | static
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | MultiThreadedDebug
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/builds/msvc/properties/EXE.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | <_PropertySheetDisplayName>Console Application
6 | true
7 |
8 |
9 |
10 |
11 | _CONSOLE;%(PreprocessorDefinitions)
12 |
13 |
14 | Console
15 |
16 |
17 |
--------------------------------------------------------------------------------
/builds/msvc/properties/LIB.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | <_PropertySheetDisplayName>Static Library
6 | static
7 | .lib
8 |
9 |
10 |
11 |
12 | _LIB;%(PreprocessorDefinitions)
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/builds/msvc/properties/LTCG.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | <_PropertySheetDisplayName>Link Time Code Generation Library
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/builds/msvc/properties/Link.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | <_PropertySheetDisplayName>Link Time Code Generation Settings
6 | ltcg
7 |
8 |
9 |
10 |
11 | true
12 |
13 |
14 | UseLinkTimeCodeGeneration
15 |
16 |
17 | true
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/builds/msvc/properties/Messages.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | <_PropertySheetDisplayName>Build Messages
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/builds/msvc/properties/Output.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | <_PropertySheetDisplayName>Output Settings
6 |
7 | $(ProjectDir)..\..\
8 | $(ProjectDir)..\..\..\..\
9 | $(ProjectDir)..\..\..\..\..\
10 | $(ProjectDir)..\..\..\..\bin\$(PlatformName)\$(DebugOrRelease)\$(PlatformToolset)\$(DefaultLinkage)\
11 | $(ProjectDir)..\..\..\..\obj\$(TargetName)\$(PlatformName)\$(DebugOrRelease)\$(PlatformToolset)\$(DefaultLinkage)\
12 | $(OutDir)
13 | $(TargetName)
14 | $(TargetDir)$(TargetName)$(TargetExt)
15 |
16 |
17 |
18 |
19 | $(OutDir)$(TargetName).lib
20 |
21 |
22 | $(OutDir)$(TargetName).log
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/builds/msvc/properties/Release.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | <_PropertySheetDisplayName>Release Settings
10 | Release
11 | false
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | false
20 |
21 |
22 | false
23 | true
24 | true
25 | Speed
26 | true
27 | AnySuitable
28 | true
29 | true
30 | MaxSpeed
31 |
32 |
33 |
34 |
35 | AdvancedVectorExtensions2
36 |
37 |
38 | ProgramDatabase
39 | true
40 | NDEBUG;%(PreprocessorDefinitions)
41 |
42 |
43 | NDEBUG;%(PreprocessorDefinitions)
44 |
45 |
46 | true
47 | true
48 | true
49 |
50 |
51 |
--------------------------------------------------------------------------------
/builds/msvc/properties/ReleaseDEXE.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | <_PropertySheetDisplayName>Console Release Dynamic
6 | dynamic
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | MultiThreadedDLL
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/builds/msvc/properties/ReleaseDLL.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | <_PropertySheetDisplayName>Dynamic Release Library
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | MultiThreadedDLL
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/builds/msvc/properties/ReleaseLEXE.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | <_PropertySheetDisplayName>Console Release Link Time Code Generation
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | MultiThreaded
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/builds/msvc/properties/ReleaseLIB.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | <_PropertySheetDisplayName>Static Release Library
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | MultiThreaded
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/builds/msvc/properties/ReleaseLTCG.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | <_PropertySheetDisplayName>Static Release Link Time Code Generation Library
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | MultiThreaded
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/builds/msvc/properties/ReleaseSEXE.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | <_PropertySheetDisplayName>Console Release Static
6 | static
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | MultiThreaded
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/builds/msvc/properties/Win32.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | <_PropertySheetDisplayName>x86 Settings
6 |
7 |
8 |
9 |
10 | WIN32;_WIN32;%(PreprocessorDefinitions)
11 |
12 |
13 | MachineX86
14 |
15 |
16 | /MACHINE:X86 %(AdditionalOptions)
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/builds/msvc/properties/x64.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | <_PropertySheetDisplayName>x64 Settings
6 |
7 |
8 |
9 |
10 |
13 | WIN32;_WIN32;WIN64;_WIN64;%(PreprocessorDefinitions)
14 |
15 |
16 | MachineX64
17 |
18 |
19 | /MACHINE:X64 %(AdditionalOptions)
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/builds/msvc/vs2022/libbitcoin-database-test/libbitcoin-database-test.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | <_PropertySheetDisplayName>Libbitcoin Database Test Common Settings
6 | AllRules.ruleset
7 | false
8 |
9 |
10 |
11 |
12 |
13 |
14 | $(RepoRoot)include\;(AdditionalIncludeDirectories)
15 | false
16 |
17 |
18 | "$(TargetPath)" --log_level=warning --run_test=* --show_progress=no --build_info=yes
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | ..\..\..\..\..\.nuget\packages\
31 |
32 |
33 |
34 | dynamic
35 | dynamic
36 | dynamic
37 |
38 |
39 | ltcg
40 | ltcg
41 | ltcg
42 |
43 |
44 | static
45 | static
46 | static
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/builds/msvc/vs2022/libbitcoin-database-test/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/builds/msvc/vs2022/libbitcoin-database-tools/libbitcoin-database-tools.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | <_PropertySheetDisplayName>Libbitcoin Database Tools Common Settings
6 | AllRules.ruleset
7 | false
8 |
9 |
10 |
11 |
12 |
13 |
14 | $(RepoRoot)include\;(AdditionalIncludeDirectories)
15 | false
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | ..\..\..\..\..\.nuget\packages\
28 |
29 |
30 |
31 | dynamic
32 | dynamic
33 | dynamic
34 |
35 |
36 | ltcg
37 | ltcg
38 | ltcg
39 |
40 |
41 | static
42 | static
43 | static
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/builds/msvc/vs2022/libbitcoin-database-tools/libbitcoin-database-tools.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 | {005F2A86-F937-4AB5-0000-000000000001}
12 |
13 |
14 | {005F2A86-F937-4AB5-0000-000000000000}
15 |
16 |
17 |
18 |
19 | src
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/builds/msvc/vs2022/libbitcoin-database-tools/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/builds/msvc/vs2022/libbitcoin-database.import.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | <_PropertySheetDisplayName>Libbitcoin Database Import Settings
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | $(ProjectDir)..\..\..\..\..\libbitcoin-database\include\;%(AdditionalIncludeDirectories)
19 | BCD_STATIC;%(PreprocessorDefinitions)
20 |
21 |
22 | libbitcoin-database.lib;%(AdditionalDependencies)
23 |
24 |
25 |
26 | $(ProjectDir)..\..\..\..\..\libbitcoin-database\bin\$(PlatformName)\Debug\$(PlatformToolset)\$(Linkage-libbitcoin-database)\;
27 | $(ProjectDir)..\..\..\..\..\libbitcoin-database\obj\libbitcoin-database\$(PlatformName)\Debug\$(PlatformToolset)\$(Linkage-libbitcoin-database)\;%(AdditionalLibraryDirectories)
28 |
29 |
30 | $(ProjectDir)..\..\..\..\..\libbitcoin-database\bin\$(PlatformName)\Release\$(PlatformToolset)\$(Linkage-libbitcoin-database)\;
31 | $(ProjectDir)..\..\..\..\..\libbitcoin-database\obj\libbitcoin-database\$(PlatformName)\Release\$(PlatformToolset)\$(Linkage-libbitcoin-database)\;%(AdditionalLibraryDirectories)
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/builds/msvc/vs2022/libbitcoin-database.import.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/builds/msvc/vs2022/libbitcoin-database/libbitcoin-database.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | <_PropertySheetDisplayName>Libbitcoin Database Library Common Settings
6 | AllRules.ruleset
7 | false
8 |
9 |
10 |
11 |
12 |
13 |
14 | $(RepoRoot)include\;%(AdditionalIncludeDirectories)
15 | false
16 | WITH_CONSENSUS;%(PreprocessorDefinitions)
17 | BCD_DLL;%(PreprocessorDefinitions)
18 | BCD_STATIC;%(PreprocessorDefinitions)
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | ..\..\..\..\..\.nuget\packages\
30 |
31 |
32 |
33 | dynamic
34 | dynamic
35 |
36 |
37 | ltcg
38 | ltcg
39 |
40 |
41 | static
42 | static
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/builds/msvc/vs2022/libbitcoin-database/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/builds/msvc/vs2022/libbitcoin-system.import.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
43 |
44 |
--------------------------------------------------------------------------------
/builds/vscode/database.code-workspace:
--------------------------------------------------------------------------------
1 | {
2 | "folders": [
3 | {
4 | "path": "../../../libbitcoin-system"
5 | },
6 | {
7 | "path": "../../../libbitcoin-database"
8 | }
9 | ],
10 | "settings": {}
11 | }
12 |
--------------------------------------------------------------------------------
/include/bitcoin/database.hpp:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) 2014-2025 libbitcoin-database developers (see COPYING).
3 | //
4 | // GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY
5 | //
6 | ///////////////////////////////////////////////////////////////////////////////
7 | #ifndef LIBBITCOIN_DATABASE_HPP
8 | #define LIBBITCOIN_DATABASE_HPP
9 |
10 | /**
11 | * API Users: Include only this header. Direct use of other headers is fragile
12 | * and unsupported as header organization is subject to change.
13 | *
14 | * Maintainers: Do not include this header internal to this library.
15 | */
16 |
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 | #include
29 | #include
30 | #include
31 | #include
32 | #include
33 | #include
34 | #include
35 | #include
36 | #include
37 | #include
38 | #include
39 | #include
40 | #include
41 | #include
42 | #include
43 | #include
44 | #include
45 | #include
46 | #include
47 | #include
48 | #include
49 | #include
50 | #include
51 | #include
52 | #include
53 | #include
54 | #include
55 | #include
56 | #include
57 | #include
58 | #include
59 | #include
60 | #include
61 | #include
62 | #include
63 | #include
64 | #include
65 | #include
66 | #include
67 | #include
68 | #include
69 | #include
70 | #include
71 | #include
72 | #include
73 | #include
74 | #include
75 | #include
76 | #include
77 | #include
78 |
79 | #endif
80 |
--------------------------------------------------------------------------------
/include/bitcoin/database/boost.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
3 | *
4 | * This file is part of libbitcoin.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef LIBBITCOIN_DATABASE_BOOST_HPP
20 | #define LIBBITCOIN_DATABASE_BOOST_HPP
21 |
22 | #if defined(HAVE_MSC)
23 | #include
24 | #endif
25 | #include
26 | #include
27 | #include
28 | #include
29 | #include
30 | #include
31 | #include
32 | #include
33 |
34 | namespace libbitcoin {
35 | namespace database {
36 |
37 | namespace interprocess = boost::interprocess;
38 | namespace ipcdetail = interprocess::ipcdetail;
39 | using file_handle_t = interprocess::file_handle_t;
40 |
41 | #if defined(HAVE_MSC)
42 | const file_handle_t invalid = interprocess::winapi::invalid_handle_value;
43 | #else
44 | const file_handle_t invalid = -1;
45 | #endif
46 |
47 | inline file_handle_t open_existing_file(
48 | const std::filesystem::path& file) NOEXCEPT
49 | {
50 | constexpr auto mode = interprocess::read_write;
51 | #if defined(HAVE_MSC)
52 | const auto filename = system::to_extended_path(file);
53 | #else
54 | const auto filename = file;
55 | #endif
56 |
57 | // Does not throw (unannotated).
58 | BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT)
59 | return ipcdetail::open_existing_file(file.string().c_str(), mode);
60 | BC_POP_WARNING()
61 | }
62 |
63 | } // namespace database
64 | } // namespace libbitcoin
65 |
66 | #endif
67 |
--------------------------------------------------------------------------------
/include/bitcoin/database/define.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
3 | *
4 | * This file is part of libbitcoin.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef LIBBITCOIN_DATABASE_DEFINE_HPP
20 | #define LIBBITCOIN_DATABASE_DEFINE_HPP
21 |
22 | #include
23 |
24 | // map is able to support 32 bit, but because the database
25 | // requires a larger file this is neither validated nor supported.
26 | static_assert(sizeof(void*) == sizeof(uint64_t), "Not a 64 bit system!");
27 |
28 | /// Attributes.
29 | /// ---------------------------------------------------------------------------
30 |
31 | // Now we use the generic helper definitions in libbitcoin to
32 | // define BCD_API and BCD_INTERNAL.
33 | // BCD_API is used for the public API symbols. It either DLL imports or
34 | // DLL exports (or does nothing for static build)
35 | // BCD_INTERNAL is used for non-api symbols.
36 |
37 | #if defined BCD_STATIC
38 | #define BCD_API
39 | #define BCD_INTERNAL
40 | #elif defined BCD_DLL
41 | #define BCD_API BC_HELPER_DLL_EXPORT
42 | #define BCD_INTERNAL BC_HELPER_DLL_LOCAL
43 | #else
44 | #define BCD_API BC_HELPER_DLL_IMPORT
45 | #define BCD_INTERNAL BC_HELPER_DLL_LOCAL
46 | #endif
47 |
48 | namespace libbitcoin {
49 | namespace database {
50 |
51 | using hash_digest = system::hash_digest;
52 | using hashes = system::hashes;
53 | using code = system::code;
54 |
55 | } // namespace database
56 | } // namespace libbitcoin
57 |
58 | #endif
59 |
--------------------------------------------------------------------------------
/include/bitcoin/database/file/file.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
3 | *
4 | * This file is part of libbitcoin.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef LIBBITCOIN_DATABASE_FILE_FILE_HPP
20 | #define LIBBITCOIN_DATABASE_FILE_FILE_HPP
21 |
22 | #include
23 | #include
24 |
25 | #endif
26 |
--------------------------------------------------------------------------------
/include/bitcoin/database/file/rotator.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
3 | *
4 | * This file is part of libbitcoin.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef LIBBITCOIN_DATABASE_FILE_ROTATOR_HPP
20 | #define LIBBITCOIN_DATABASE_FILE_ROTATOR_HPP
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 |
28 | namespace libbitcoin {
29 | namespace database {
30 | namespace file {
31 |
32 | /// Because device requires std::ofstream::value_type.
33 | struct ofstream_wrap
34 | {
35 | using value_type = std::ofstream::char_type;
36 | std::ofstream& stream_;
37 | };
38 |
39 | /// Simple two file rotating stream with configurable size and file names.
40 | /// Files are rotated after full and writes are contiguous across them.
41 | class BCD_API rotator_sink
42 | : public system::device
43 | {
44 | public:
45 | using path = std::filesystem::path;
46 | struct category
47 | : system::ios::sink_tag,
48 | system::ios::flushable_tag,
49 | system::ios::optimally_buffered_tag
50 | {
51 | };
52 |
53 | rotator_sink(const path& path1, const path& path2, size_t limit) NOEXCEPT;
54 | size_type write(const char_type* buffer, size_type count) THROWS;
55 | bool flush() THROWS;
56 |
57 | protected:
58 | size_type do_optimal_buffer_size() const NOEXCEPT override;
59 |
60 | bool start() NOEXCEPT;
61 | bool stop() NOEXCEPT;
62 | bool rotate() NOEXCEPT;
63 | bool set_remaining() NOEXCEPT;
64 | bool set_stream() NOEXCEPT;
65 |
66 | private:
67 | // These are thread safe.
68 | const path path1_;
69 | const path path2_;
70 | const size_type limit_;
71 |
72 | // This is not thread safe.
73 | std::shared_ptr stream_{};
74 | };
75 |
76 | namespace stream
77 | {
78 | namespace out
79 | {
80 | using rotator = system::make_stream;
81 | }
82 | }
83 |
84 | } // namespace file
85 | } // namespace database
86 | } // namespace libbitcoin
87 |
88 | #endif
89 |
--------------------------------------------------------------------------------
/include/bitcoin/database/impl/memory/accessor.ipp:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
3 | *
4 | * This file is part of libbitcoin.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef LIBBITCOIN_DATABASE_MEMORY_ACCESSOR_IPP
20 | #define LIBBITCOIN_DATABASE_MEMORY_ACCESSOR_IPP
21 |
22 | ////#include
23 | #include
24 | #include
25 |
26 | // Zero/negative size is allowed (automatically handled by bc streams).
27 |
28 | namespace libbitcoin {
29 | namespace database {
30 |
31 | BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT)
32 |
33 | TEMPLATE
34 | inline CLASS::accessor(Mutex& mutex) NOEXCEPT
35 | : shared_lock_(mutex)
36 | {
37 | }
38 |
39 | TEMPLATE
40 | inline void CLASS::assign(uint8_t* begin, uint8_t* end) NOEXCEPT
41 | {
42 | begin_ = begin;
43 | end_ = end;
44 | ////BC_ASSERT(!system::is_negative(size()));
45 | }
46 |
47 | TEMPLATE
48 | inline uint8_t* CLASS::offset(size_t bytes) const NOEXCEPT
49 | {
50 | if (system::is_greater(bytes, size()))
51 | return nullptr;
52 |
53 | BC_PUSH_WARNING(NO_POINTER_ARITHMETIC)
54 | return begin_ + bytes;
55 | BC_POP_WARNING()
56 | ////return std::next(begin_, bytes);
57 | }
58 |
59 | TEMPLATE
60 | inline ptrdiff_t CLASS::size() const NOEXCEPT
61 | {
62 | BC_PUSH_WARNING(NO_POINTER_ARITHMETIC)
63 | return system::possible_narrow_and_sign_cast(end_ - begin_);
64 | BC_POP_WARNING()
65 | ////return std::distance(begin_, end_);
66 | }
67 |
68 | TEMPLATE
69 | inline uint8_t* CLASS::begin() NOEXCEPT
70 | {
71 | return begin_;
72 | }
73 |
74 | TEMPLATE
75 | inline uint8_t* CLASS::end() NOEXCEPT
76 | {
77 | return end_;
78 | }
79 |
80 | BC_POP_WARNING()
81 |
82 | } // namespace database
83 | } // namespace libbitcoin
84 |
85 | #endif
86 |
--------------------------------------------------------------------------------
/include/bitcoin/database/impl/primitives/linkage.ipp:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
3 | *
4 | * This file is part of libbitcoin.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef LIBBITCOIN_DATABASE_PRIMITIVES_LINKAGE_IPP
20 | #define LIBBITCOIN_DATABASE_PRIMITIVES_LINKAGE_IPP
21 |
22 | #include
23 | #include
24 |
25 | namespace libbitcoin {
26 | namespace database {
27 |
28 | TEMPLATE
29 | constexpr CLASS::linkage() NOEXCEPT
30 | : value(terminal)
31 | {
32 | }
33 |
34 | TEMPLATE
35 | constexpr CLASS::linkage(integer other) NOEXCEPT
36 | : value(other)
37 | {
38 | }
39 |
40 | TEMPLATE
41 | inline CLASS::linkage(const bytes& other) NOEXCEPT
42 | {
43 | *this = other;
44 | }
45 |
46 | TEMPLATE
47 | constexpr CLASS& CLASS::operator=(integer other) NOEXCEPT
48 | {
49 | value = other;
50 | return *this;
51 | }
52 |
53 | TEMPLATE
54 | inline CLASS& CLASS::operator=(const bytes& other) NOEXCEPT
55 | {
56 | value = 0;
57 | system::unsafe_array_cast(&value) = other;
58 | ////value = system::native_from_little_end(value);
59 | return *this;
60 | }
61 |
62 | TEMPLATE
63 | inline CLASS& CLASS::operator++() NOEXCEPT
64 | {
65 | ++value;
66 | return *this;
67 | }
68 |
69 | TEMPLATE
70 | inline CLASS CLASS::operator++(int) NOEXCEPT
71 | {
72 | auto self = *this;
73 | ++(*this);
74 | return self;
75 | }
76 |
77 | TEMPLATE
78 | constexpr CLASS::operator CLASS::integer() const NOEXCEPT
79 | {
80 | return value;
81 | }
82 |
83 | TEMPLATE
84 | inline CLASS::operator CLASS::bytes() const NOEXCEPT
85 | {
86 | ////const auto little = system::native_to_little_end(value);
87 | return system::unsafe_array_cast(&value);
88 | }
89 |
90 | TEMPLATE
91 | constexpr bool CLASS::is_terminal() const NOEXCEPT
92 | {
93 | return value == terminal;
94 | }
95 |
96 | } // namespace database
97 | } // namespace libbitcoin
98 |
99 | #endif
100 |
--------------------------------------------------------------------------------
/include/bitcoin/database/locks/file_lock.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
3 | *
4 | * This file is part of libbitcoin.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef LIBBITCOIN_DATABASE_LOCKS_FILE_LOCK_HPP
20 | #define LIBBITCOIN_DATABASE_LOCKS_FILE_LOCK_HPP
21 |
22 | #include
23 | #include
24 | #include
25 |
26 | namespace libbitcoin {
27 | namespace database {
28 |
29 | /// This class is not thread safe, and does not throw.
30 | class BCD_API file_lock
31 | {
32 | public:
33 | DELETE_COPY_MOVE_DESTRUCT(file_lock);
34 |
35 | /// Construction does not touch the file.
36 | file_lock(const std::filesystem::path& file) NOEXCEPT;
37 |
38 | /// Path to lock file.
39 | const std::filesystem::path& file() const NOEXCEPT;
40 |
41 | protected:
42 | /// True if file exists.
43 | bool exists() const NOEXCEPT;
44 |
45 | /// True if file exists or was created.
46 | bool create() NOEXCEPT;
47 |
48 | /// True if file does not exist or was deleted.
49 | bool destroy() NOEXCEPT;
50 |
51 | private:
52 | const std::filesystem::path file_;
53 | };
54 |
55 | } // namespace database
56 | } // namespace libbitcoin
57 |
58 | #endif
59 |
--------------------------------------------------------------------------------
/include/bitcoin/database/locks/flush_lock.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
3 | *
4 | * This file is part of libbitcoin.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef LIBBITCOIN_DATABASE_LOCKS_FLUSH_LOCK_HPP
20 | #define LIBBITCOIN_DATABASE_LOCKS_FLUSH_LOCK_HPP
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | namespace libbitcoin {
28 | namespace database {
29 |
30 | /// This class is not thread safe, and does not throw.
31 | class BCD_API flush_lock
32 | : public file_lock
33 | {
34 | public:
35 | /// Construction does not touch the file.
36 | /// Destruction should not be used to delete the file (needs to remain).
37 | flush_lock(const std::filesystem::path& file) NOEXCEPT;
38 |
39 | /// False if file exists or fails to create.
40 | bool try_lock() NOEXCEPT;
41 |
42 | /// False if file does not exist or fails to delete.
43 | bool try_unlock() NOEXCEPT;
44 |
45 | /// True if file exists.
46 | bool is_locked() const NOEXCEPT;
47 | };
48 |
49 | } // namespace database
50 | } // namespace libbitcoin
51 |
52 | #endif
53 |
--------------------------------------------------------------------------------
/include/bitcoin/database/locks/interprocess_lock.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
3 | *
4 | * This file is part of libbitcoin.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef LIBBITCOIN_DATABASE_LOCKS_INTERPROCESS_LOCK_HPP
20 | #define LIBBITCOIN_DATABASE_LOCKS_INTERPROCESS_LOCK_HPP
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 |
28 | namespace libbitcoin {
29 | namespace database {
30 |
31 | /// This class is not thread safe, and does not throw.
32 | /// The lock is process-exclusive in linux/macOS, globally in win32.
33 | class BCD_API interprocess_lock
34 | : public file_lock
35 | {
36 | public:
37 | /// Construction does not touch the file.
38 | interprocess_lock(const std::filesystem::path& file) NOEXCEPT;
39 |
40 | /// Destruction calls try_unlock.
41 | ~interprocess_lock() NOEXCEPT override;
42 |
43 | /// Creates the file and acquires exclusive access.
44 | /// Returns false if failed to acquire lock or lock already held.
45 | bool try_lock() NOEXCEPT;
46 |
47 | /// Releases access (if locked) and deletes the file.
48 | /// Returns true if lock not held or succesfully unlocked and deleted.
49 | bool try_unlock() NOEXCEPT;
50 |
51 | private:
52 | file_handle_t handle_;
53 | };
54 |
55 | } // namespace database
56 | } // namespace libbitcoin
57 |
58 | #endif
59 |
--------------------------------------------------------------------------------
/include/bitcoin/database/locks/locks.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
3 | *
4 | * This file is part of libbitcoin.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef LIBBITCOIN_DATABASE_LOCKS_HPP
20 | #define LIBBITCOIN_DATABASE_LOCKS_HPP
21 |
22 | #include
23 | #include
24 | #include
25 |
26 | #endif
27 |
--------------------------------------------------------------------------------
/include/bitcoin/database/memory/accessor.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
3 | *
4 | * This file is part of libbitcoin.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef LIBBITCOIN_DATABASE_MEMORY_ACCESSOR_HPP
20 | #define LIBBITCOIN_DATABASE_MEMORY_ACCESSOR_HPP
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | namespace libbitcoin {
28 | namespace database {
29 |
30 | /// Shared r/w access to a memory buffer, mutex blocks memory remap.
31 | template
32 | class accessor
33 | : public memory
34 | {
35 | public:
36 | DELETE_COPY_MOVE_DESTRUCT(accessor);
37 |
38 | /// Mutex guards against remap while object in scope.
39 | inline accessor(Mutex& mutex) NOEXCEPT;
40 |
41 | /// Set the buffer, where end is within allocated space.
42 | /// End should be initialized to logical space though that may contract or
43 | /// expand during accessor lifetime. The only guarantee offered by end is
44 | /// that it remains within allocated space and is initially logical space.
45 | inline void assign(uint8_t* begin, uint8_t* end) NOEXCEPT;
46 |
47 | /// Return an offset from begin, nullptr if end or past end.
48 | inline uint8_t* offset(size_t bytes) const NOEXCEPT override;
49 |
50 | /// The logical buffer size (from begin to end).
51 | inline ptrdiff_t size() const NOEXCEPT override;
52 |
53 | /// Get logical buffer (guarded against remap only).
54 | inline uint8_t* begin() NOEXCEPT override;
55 | inline uint8_t* end() NOEXCEPT override;
56 |
57 | /// Alias for begin.
58 | inline uint8_t* data() NOEXCEPT override { return begin(); }
59 |
60 | private:
61 | uint8_t* begin_{};
62 | uint8_t* end_{};
63 | std::shared_lock shared_lock_;
64 | };
65 |
66 | } // namespace database
67 | } // namespace libbitcoin
68 |
69 | #define TEMPLATE template
70 | #define CLASS accessor
71 |
72 | #include
73 |
74 | #undef CLASS
75 | #undef TEMPLATE
76 |
77 | #endif
78 |
--------------------------------------------------------------------------------
/include/bitcoin/database/memory/finalizer.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
3 | *
4 | * This file is part of libbitcoin.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef LIBBITCOIN_DATABASE_MEMORY_FINALIZER_HPP
20 | #define LIBBITCOIN_DATABASE_MEMORY_FINALIZER_HPP
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | namespace libbitcoin {
28 | namespace database {
29 |
30 | // This is single inheritance.
31 | BC_PUSH_WARNING(DIAMOND_INHERITANCE)
32 |
33 | /// A byte flipper with finalization extentions, that accepts an iostream.
34 | template
35 | class finalizer_
36 | : public system::byte_flipper
37 | {
38 | public:
39 | DEFAULT_COPY_MOVE_DESTRUCT(finalizer_);
40 |
41 | using finalization = std::function;
42 |
43 | finalizer_(IOStream& stream) NOEXCEPT
44 | : system::byte_flipper(stream)
45 | {
46 | }
47 |
48 | void set_finalizer(finalization&& functor) NOEXCEPT
49 | {
50 | finalize_ = std::move(functor);
51 | }
52 |
53 | // This is expected to have side effect on the stream buffer, specifically
54 | // setting the "next" pointer into beginning of the address space.
55 | bool finalize() NOEXCEPT
56 | {
57 | if (!*this) return false;
58 |
59 | // std::function does not allow for noexcept.
60 | BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT)
61 | return finalize_();
62 | BC_POP_WARNING()
63 | }
64 |
65 | private:
66 | finalization finalize_;
67 | };
68 |
69 | /// A finalizing byte reader/writer that copies data from/to a memory_ptr.
70 | using finalizer = finalizer_<>;
71 |
72 | BC_POP_WARNING()
73 |
74 | } // namespace database
75 | } // namespace libbitcoin
76 |
77 | #endif
78 |
--------------------------------------------------------------------------------
/include/bitcoin/database/memory/interfaces/memory.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
3 | *
4 | * This file is part of libbitcoin.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef LIBBITCOIN_DATABASE_MEMORY_INTERFACES_MEMORY_HPP
20 | #define LIBBITCOIN_DATABASE_MEMORY_INTERFACES_MEMORY_HPP
21 |
22 | #include
23 | #include
24 | #include
25 |
26 | namespace libbitcoin {
27 | namespace database {
28 |
29 | /// Protected memory access interface.
30 | class memory
31 | {
32 | public:
33 | typedef uint8_t value_type;
34 | typedef value_type* iterator;
35 | typedef const value_type* const_iterator;
36 | typedef std::shared_ptr ptr;
37 |
38 | /// Return an offset from begin, nullptr if end or past end.
39 | virtual uint8_t* offset(size_t value) const NOEXCEPT = 0;
40 |
41 | /// The logical buffer size (from begin to end).
42 | virtual ptrdiff_t size() const NOEXCEPT = 0;
43 |
44 | /// Get logical buffer.
45 | virtual uint8_t* begin() NOEXCEPT = 0;
46 | virtual uint8_t* end() NOEXCEPT = 0;
47 |
48 | /// Alias begin.
49 | virtual uint8_t* data() NOEXCEPT = 0;
50 | };
51 |
52 | typedef memory::ptr memory_ptr;
53 |
54 | } // namespace database
55 | } // namespace libbitcoin
56 |
57 | #endif
58 |
--------------------------------------------------------------------------------
/include/bitcoin/database/memory/memory.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
3 | *
4 | * This file is part of libbitcoin.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef LIBBITCOIN_DATABASE_MEMORY_MEMORY_HPP
20 | #define LIBBITCOIN_DATABASE_MEMORY_MEMORY_HPP
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 |
29 | #endif
30 |
--------------------------------------------------------------------------------
/include/bitcoin/database/memory/reader.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
3 | *
4 | * This file is part of libbitcoin.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef LIBBITCOIN_DATABASE_MEMORY_READER_HPP
20 | #define LIBBITCOIN_DATABASE_MEMORY_READER_HPP
21 |
22 | #include
23 | #include
24 | #include
25 |
26 | namespace libbitcoin {
27 | namespace database {
28 |
29 | /// A byte reader that copies data.
30 | using reader = system::byte_reader>;
31 |
32 | } // namespace database
33 | } // namespace libbitcoin
34 |
35 | #endif
36 |
--------------------------------------------------------------------------------
/include/bitcoin/database/memory/streamers.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
3 | *
4 | * This file is part of libbitcoin.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef LIBBITCOIN_DATABASE_MEMORY_STREAMERS_HPP
20 | #define LIBBITCOIN_DATABASE_MEMORY_STREAMERS_HPP
21 |
22 | #include
23 | #include
24 | #include
25 |
26 | namespace libbitcoin {
27 | namespace database {
28 |
29 | /// These all operate over a system::iostream.
30 |
31 | using reader = system::byte_reader>;
32 | using writer = system::byte_writer>;
33 | using flipper = system::byte_flipper>;
34 |
35 | } // namespace database
36 | } // namespace libbitcoin
37 |
38 | #endif
39 |
--------------------------------------------------------------------------------
/include/bitcoin/database/memory/utilities.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
3 | *
4 | * This file is part of libbitcoin.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef LIBBITCOIN_DATABASE_MEMORY_UTILITIES_HPP
20 | #define LIBBITCOIN_DATABASE_MEMORY_UTILITIES_HPP
21 |
22 | #include
23 |
24 | namespace libbitcoin {
25 | namespace database {
26 |
27 | /// The byte size of system pages, zero if failed.
28 | BCD_API size_t page_size() NOEXCEPT;
29 |
30 | /// The bytes of physical memory, zero if failed.
31 | BCD_API uint64_t system_memory() NOEXCEPT;
32 |
33 | } // namespace database
34 | } // namespace libbitcoin
35 |
36 | #endif
37 |
--------------------------------------------------------------------------------
/include/bitcoin/database/primitives/keys.hpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/libbitcoin/libbitcoin-database/514ee1eed9c94ecdb3f33af430c6e095ca354ba2/include/bitcoin/database/primitives/keys.hpp
--------------------------------------------------------------------------------
/include/bitcoin/database/primitives/linkage.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
3 | *
4 | * This file is part of libbitcoin.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef LIBBITCOIN_DATABASE_PRIMITIVES_LINKAGE_HPP
20 | #define LIBBITCOIN_DATABASE_PRIMITIVES_LINKAGE_HPP
21 |
22 | #include
23 | #include
24 |
25 | namespace libbitcoin {
26 | namespace database {
27 |
28 | /// Link serialization is non-endian.
29 | /// TODO: phase out the Size argument in favor of just Bits.
30 | template If = true>
32 | struct linkage
33 | {
34 | using integer = unsigned_type;
35 | using bytes = std_array;
36 | using self = linkage;
37 |
38 | // Terminal is also a mask to read Bits from Bytes.
39 | static constexpr auto terminal = system::unmask_right(Bits);
40 | static constexpr auto size = Size;
41 | static constexpr auto bits = Bits;
42 |
43 | /// Construct a terminal link.
44 | constexpr linkage() NOEXCEPT;
45 |
46 | /// Integral and array constructors.
47 | constexpr linkage(integer other) NOEXCEPT;
48 | inline linkage(const bytes& other) NOEXCEPT;
49 |
50 | /// Integral and array assignment operators.
51 | constexpr self& operator=(integer other) NOEXCEPT;
52 | inline self& operator=(const bytes& other) NOEXCEPT;
53 |
54 | /// Increment operators (not for use with slab links).
55 | inline self& operator++() NOEXCEPT;
56 | inline self operator++(int) NOEXCEPT;
57 |
58 | /// Integral and array cast operators.
59 | constexpr operator integer() const NOEXCEPT;
60 | inline operator bytes() const NOEXCEPT;
61 |
62 | /// True when value is terminal.
63 | constexpr bool is_terminal() const NOEXCEPT;
64 |
65 | integer value;
66 | };
67 |
68 | template If = true>
70 | bool operator==(const linkage& left,
71 | const linkage& right) NOEXCEPT
72 | {
73 | return left.value == right.value;
74 | }
75 |
76 | template If = true>
78 | bool operator!=(const linkage& left,
79 | const linkage& right) NOEXCEPT
80 | {
81 | return !(left == right);
82 | }
83 |
84 | } // namespace database
85 | } // namespace libbitcoin
86 |
87 | #define TEMPLATE template If>
89 | #define CLASS linkage
90 |
91 | #include
92 |
93 | #undef CLASS
94 | #undef TEMPLATE
95 |
96 | #endif
97 |
--------------------------------------------------------------------------------
/include/bitcoin/database/primitives/primitives.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
3 | *
4 | * This file is part of libbitcoin.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef LIBBITCOIN_DATABASE_PRIMITIVES_PRIMITIVES_HPP
20 | #define LIBBITCOIN_DATABASE_PRIMITIVES_PRIMITIVES_HPP
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 | #include
29 | #include
30 | #include
31 |
32 | #endif
33 |
--------------------------------------------------------------------------------
/include/bitcoin/database/settings.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
3 | *
4 | * This file is part of libbitcoin.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef LIBBITCOIN_DATABASE_SETTINGS_HPP
20 | #define LIBBITCOIN_DATABASE_SETTINGS_HPP
21 |
22 | #include
23 | #include
24 | #include
25 |
26 | namespace libbitcoin {
27 | namespace database {
28 |
29 | /// 32 bit builds will warn on size downcasts.
30 | /// TODO: helper methods to embed/construct full paths (see store()).
31 | /// Common database configuration settings, properties not thread safe.
32 | struct BCD_API settings
33 | {
34 | DEFAULT_COPY_MOVE_DESTRUCT(settings);
35 |
36 | settings() NOEXCEPT;
37 | settings(system::chain::selection context) NOEXCEPT;
38 |
39 | /// Properties.
40 | std::filesystem::path path;
41 |
42 | /// Archives.
43 | /// -----------------------------------------------------------------------
44 |
45 | uint32_t header_buckets;
46 | uint64_t header_size;
47 | uint16_t header_rate;
48 |
49 | uint64_t input_size;
50 | uint16_t input_rate;
51 |
52 | uint64_t output_size;
53 | uint16_t output_rate;
54 |
55 | uint32_t point_buckets;
56 | uint64_t point_size;
57 | uint16_t point_rate;
58 |
59 | uint64_t ins_size;
60 | uint16_t ins_rate;
61 |
62 | uint64_t outs_size;
63 | uint16_t outs_rate;
64 |
65 | uint32_t tx_buckets;
66 | uint64_t tx_size;
67 | uint16_t tx_rate;
68 |
69 | uint32_t txs_buckets;
70 | uint64_t txs_size;
71 | uint16_t txs_rate;
72 |
73 | /// Indexes.
74 | /// -----------------------------------------------------------------------
75 |
76 | uint64_t candidate_size;
77 | uint16_t candidate_rate;
78 |
79 | uint64_t confirmed_size;
80 | uint16_t confirmed_rate;
81 |
82 | uint32_t strong_tx_buckets;
83 | uint64_t strong_tx_size;
84 | uint16_t strong_tx_rate;
85 |
86 | /// Caches.
87 | /// -----------------------------------------------------------------------
88 |
89 | // This one is 16 bit (could use table link::integer) for these.
90 | uint16_t duplicate_buckets;
91 | uint64_t duplicate_size;
92 | uint16_t duplicate_rate;
93 |
94 | uint32_t prevout_buckets;
95 | uint64_t prevout_size;
96 | uint16_t prevout_rate;
97 |
98 | uint32_t validated_bk_buckets;
99 | uint64_t validated_bk_size;
100 | uint16_t validated_bk_rate;
101 |
102 | uint32_t validated_tx_buckets;
103 | uint64_t validated_tx_size;
104 | uint16_t validated_tx_rate;
105 |
106 | /// Optionals.
107 | /// -----------------------------------------------------------------------
108 |
109 | uint32_t address_buckets;
110 | uint64_t address_size;
111 | uint16_t address_rate;
112 |
113 | uint32_t filter_bk_buckets;
114 | uint64_t filter_bk_size;
115 | uint16_t filter_bk_rate;
116 |
117 | uint32_t filter_tx_buckets;
118 | uint64_t filter_tx_size;
119 | uint16_t filter_tx_rate;
120 | };
121 |
122 | } // namespace database
123 | } // namespace libbitcoin
124 |
125 | #endif
126 |
--------------------------------------------------------------------------------
/include/bitcoin/database/tables/archives/point.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
3 | *
4 | * This file is part of libbitcoin.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef LIBBITCOIN_DATABASE_TABLES_ARCHIVES_POINT_HPP
20 | #define LIBBITCOIN_DATABASE_TABLES_ARCHIVES_POINT_HPP
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 |
29 | namespace libbitcoin {
30 | namespace database {
31 | namespace table {
32 |
33 | struct point
34 | : public hash_map
35 | {
36 | using hash_map::hashmap;
37 | using ix = linkage;
38 |
39 | struct record
40 | : public schema::point
41 | {
42 | inline bool from_data(reader& source) NOEXCEPT
43 | {
44 | source.rewind_bytes(schema::point::sk);
45 | hash = source.read_hash();
46 | index = source.read_little_endian();
47 |
48 | if (index == ix::terminal)
49 | index = system::chain::point::null_index;
50 |
51 | BC_ASSERT(!source || source.get_read_position() == minrow);
52 | return source;
53 | }
54 |
55 | inline bool to_data(flipper& sink) const NOEXCEPT
56 | {
57 | BC_ASSERT(!sink || sink.get_write_position() == minrow);
58 | return sink;
59 | }
60 |
61 | inline bool is_null() const NOEXCEPT
62 | {
63 | return index == system::chain::point::null_index;
64 | }
65 |
66 | inline bool operator==(const record& other) const NOEXCEPT
67 | {
68 | return hash == other.hash
69 | && index == other.index;
70 | }
71 |
72 | hash_digest hash{};
73 | ix::integer index{};
74 | };
75 |
76 | struct get_composed
77 | : public schema::point
78 | {
79 | inline bool from_data(reader& source) NOEXCEPT
80 | {
81 | source.rewind_bytes(schema::point::sk);
82 | key =
83 | {
84 | source.read_hash(),
85 | source.read_little_endian()
86 | };
87 | BC_ASSERT(!source || source.get_read_position() == minrow);
88 | return source;
89 | }
90 |
91 | system::chain::point key{};
92 | };
93 | };
94 |
95 | } // namespace table
96 | } // namespace database
97 | } // namespace libbitcoin
98 |
99 | #endif
100 |
--------------------------------------------------------------------------------
/include/bitcoin/database/tables/association.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
3 | *
4 | * This file is part of libbitcoin.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef LIBBITCOIN_DATABASE_TABLES_ASSOCIATION_HPP
20 | #define LIBBITCOIN_DATABASE_TABLES_ASSOCIATION_HPP
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | namespace libbitcoin {
28 | namespace database {
29 |
30 | /// Association between block hash and context.
31 | struct association
32 | {
33 | schema::height::link::integer link;
34 | system::hash_digest hash;
35 | system::chain::context context;
36 |
37 | struct key{};
38 | struct pos{};
39 |
40 | struct name_extractor
41 | {
42 | using result_type = size_t;
43 |
44 | inline const result_type& operator()(
45 | const association& item) const NOEXCEPT
46 | {
47 | return item.context.height;
48 | }
49 |
50 | inline result_type& operator()(association* item) const NOEXCEPT
51 | {
52 | BC_ASSERT_MSG(item, "null pointer");
53 | return item->context.height;
54 | }
55 | };
56 | };
57 |
58 | } // namespace database
59 | } // namespace libbitcoin
60 |
61 | #endif
62 |
--------------------------------------------------------------------------------
/include/bitcoin/database/tables/associations.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
3 | *
4 | * This file is part of libbitcoin.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef LIBBITCOIN_DATABASE_TABLES_ASSOCIATIONS_HPP
20 | #define LIBBITCOIN_DATABASE_TABLES_ASSOCIATIONS_HPP
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | namespace libbitcoin {
28 | namespace database {
29 |
30 | typedef boost::multi_index_container
31 | <
32 | association,
33 | boost::multi_index::indexed_by
34 | <
35 | boost::multi_index::hashed_unique
36 | <
37 | boost::multi_index::tag,
38 | boost::multi_index::key<&association::hash>
39 | >,
40 | boost::multi_index::ordered_unique
41 | <
42 | boost::multi_index::tag,
43 | association::name_extractor
44 | >
45 | >
46 | > associations_;
47 |
48 | /// Collection of association between block hash and context.
49 | /// Indexed by unique block hash and by unique block height.
50 | class associations
51 | : public associations_
52 | {
53 | public:
54 | /// Use base class constructors.
55 | using associations_::associations_;
56 |
57 | /// Forward iterator for the ordered_unique index.
58 | inline auto pos_begin() const NOEXCEPT
59 | {
60 | return get().begin();
61 | }
62 |
63 | /// Forward end iterator for the ordered_unique index.
64 | inline auto pos_end() const NOEXCEPT
65 | {
66 | return get().end();
67 | }
68 |
69 | /// Returns a pointer to an association instance, or .end().
70 | inline auto find(const system::hash_digest& hash) const NOEXCEPT
71 | {
72 | BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT)
73 | return get().find(hash);
74 | BC_POP_WARNING()
75 | }
76 |
77 | /// Returns a pointer to an association instance, or .pos_end().
78 | inline auto find(size_t height) const NOEXCEPT
79 | {
80 | BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT)
81 | return get().find(height);
82 | BC_POP_WARNING()
83 | }
84 |
85 | /// Hash identifies an element in the hashed_unique index.
86 | inline bool exists(const system::hash_digest& hash) const NOEXCEPT
87 | {
88 | return find(hash) != end();
89 | }
90 |
91 | /// Height identifies an element in the ordered_unique index.
92 | inline bool exists(size_t height) const NOEXCEPT
93 | {
94 | return find(height) != pos_end();
95 | }
96 |
97 | /// The context of the maximum ordered_unique index (must not be empty).
98 | inline const system::chain::context& top() const NOEXCEPT
99 | {
100 | BC_ASSERT(!empty());
101 |
102 | BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT)
103 | return get().rbegin()->context;
104 | BC_POP_WARNING()
105 | }
106 | };
107 |
108 | } // namespace database
109 | } // namespace libbitcoin
110 |
111 | #endif
112 |
--------------------------------------------------------------------------------
/include/bitcoin/database/tables/caches/duplicate.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
3 | *
4 | * This file is part of libbitcoin.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef LIBBITCOIN_DATABASE_TABLES_CACHES_DOUBLES_HPP
20 | #define LIBBITCOIN_DATABASE_TABLES_CACHES_DOUBLES_HPP
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | namespace libbitcoin {
28 | namespace database {
29 | namespace table {
30 |
31 | struct duplicate
32 | : public hash_map
33 | {
34 | using hash_map::hashmap;
35 |
36 | struct record
37 | : public schema::duplicate
38 | {
39 | inline bool from_data(reader& source) NOEXCEPT
40 | {
41 | return source;
42 | }
43 |
44 | inline bool to_data(finalizer& sink) const NOEXCEPT
45 | {
46 | BC_ASSERT(!sink || sink.get_write_position() == count() * minrow);
47 | return sink;
48 | }
49 | };
50 | };
51 |
52 | } // namespace table
53 | } // namespace database
54 | } // namespace libbitcoin
55 |
56 | #endif
57 |
--------------------------------------------------------------------------------
/include/bitcoin/database/tables/caches/validated_bk.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
3 | *
4 | * This file is part of libbitcoin.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef LIBBITCOIN_DATABASE_TABLES_CACHES_VALIDATED_BK_HPP
20 | #define LIBBITCOIN_DATABASE_TABLES_CACHES_VALIDATED_BK_HPP
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | namespace libbitcoin {
28 | namespace database {
29 | namespace table {
30 |
31 | /// validated_bk is a slab arraymap of block state, indexed by header.fk.
32 | struct validated_bk
33 | : public array_map
34 | {
35 | using coding = linkage;
36 | using array_map::arraymap;
37 |
38 | struct slab
39 | : public schema::validated_bk
40 | {
41 | link count() const NOEXCEPT
42 | {
43 | using namespace system;
44 | return possible_narrow_cast(coding::size +
45 | variable_size(fees));
46 | }
47 |
48 | inline bool from_data(reader& source) NOEXCEPT
49 | {
50 | code = source.read_little_endian();
51 | fees = source.read_variable();
52 | BC_ASSERT(!source || source.get_read_position() == count());
53 | return source;
54 | }
55 |
56 | inline bool to_data(finalizer& sink) const NOEXCEPT
57 | {
58 | sink.write_little_endian(code);
59 | sink.write_variable(fees);
60 | BC_ASSERT(!sink || sink.get_write_position() == count());
61 | return sink;
62 | }
63 |
64 | inline bool operator==(const slab& other) const NOEXCEPT
65 | {
66 | return code == other.code
67 | && fees == other.fees;
68 | }
69 |
70 | coding::integer code{};
71 | uint64_t fees{};
72 | };
73 |
74 | struct slab_get_code
75 | : public schema::validated_bk
76 | {
77 | link count() const NOEXCEPT
78 | {
79 | BC_ASSERT(false);
80 | return {};
81 | }
82 |
83 | inline bool from_data(reader& source) NOEXCEPT
84 | {
85 | code = source.read_little_endian();
86 | return source;
87 | }
88 |
89 | coding::integer code{};
90 | };
91 | };
92 |
93 | } // namespace table
94 | } // namespace database
95 | } // namespace libbitcoin
96 |
97 | #endif
98 |
--------------------------------------------------------------------------------
/include/bitcoin/database/tables/context.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
3 | *
4 | * This file is part of libbitcoin.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef LIBBITCOIN_DATABASE_CONTEXT_HPP
20 | #define LIBBITCOIN_DATABASE_CONTEXT_HPP
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | namespace libbitcoin {
28 | namespace database {
29 |
30 | struct context
31 | {
32 | using height_t = linkage;
33 | using flag_t = linkage;
34 | using mtp_t = uint32_t;
35 | static constexpr auto size = flag_t::size + height_t::size + sizeof(mtp_t);
36 |
37 | static inline void from_data(reader& source, context& context) NOEXCEPT
38 | {
39 | context.flags = source.template read_little_endian();
40 | context.height = source.template read_little_endian();
41 | context.mtp = source.template read_little_endian();
42 | };
43 |
44 | static inline void to_data(finalizer& sink, const context& context) NOEXCEPT
45 | {
46 | sink.template write_little_endian(context.flags);
47 | sink.template write_little_endian(context.height);
48 | sink.template write_little_endian(context.mtp);
49 | };
50 |
51 | constexpr bool is_enabled(system::chain::flags rule) const NOEXCEPT
52 | {
53 | return system::chain::script::is_enabled(flags, rule);
54 | }
55 |
56 | inline bool operator==(const context& other) const NOEXCEPT
57 | {
58 | return flags == other.flags
59 | && height == other.height
60 | && mtp == other.mtp;
61 | }
62 |
63 | height_t::integer flags{};
64 | flag_t::integer height{};
65 | mtp_t mtp{};
66 | };
67 |
68 | } // namespace database
69 | } // namespace libbitcoin
70 |
71 | #endif
72 |
--------------------------------------------------------------------------------
/include/bitcoin/database/tables/event.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
3 | *
4 | * This file is part of libbitcoin.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef LIBBITCOIN_DATABASE_TABLES_EVENT_HPP
20 | #define LIBBITCOIN_DATABASE_TABLES_EVENT_HPP
21 |
22 | namespace libbitcoin {
23 | namespace database {
24 |
25 | enum class event_t
26 | {
27 | create_file,
28 | open_file,
29 | load_file,
30 | unload_file,
31 | close_file,
32 |
33 | create_table,
34 | verify_table,
35 | close_table,
36 |
37 | wait_lock,
38 | flush_body,
39 | backup_table,
40 | copy_header,
41 | archive_snapshot,
42 |
43 | restore_table,
44 | recover_snapshot
45 | };
46 |
47 | } // namespace database
48 | } // namespace libbitcoin
49 |
50 | #endif
51 |
--------------------------------------------------------------------------------
/include/bitcoin/database/tables/indexes/height.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
3 | *
4 | * This file is part of libbitcoin.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef LIBBITCOIN_DATABASE_TABLES_INDEXES_HEIGHT_HPP
20 | #define LIBBITCOIN_DATABASE_TABLES_INDEXES_HEIGHT_HPP
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | namespace libbitcoin {
28 | namespace database {
29 | namespace table {
30 |
31 | /// height is an array of header fk records.
32 | struct height
33 | : public no_map
34 | {
35 | using header = schema::header::link;
36 | using no_map::nomap;
37 |
38 | struct record
39 | : public schema::height
40 | {
41 | inline bool from_data(reader& source) NOEXCEPT
42 | {
43 | header_fk = source.read_little_endian();
44 | BC_ASSERT(!source || source.get_read_position() == minrow);
45 | return source;
46 | }
47 |
48 | inline bool to_data(flipper& sink) const NOEXCEPT
49 | {
50 | sink.write_little_endian(header_fk);
51 | BC_ASSERT(!sink || sink.get_write_position() == minrow);
52 | return sink;
53 | }
54 |
55 | inline bool operator==(const record& other) const NOEXCEPT
56 | {
57 | return header_fk == other.header_fk;
58 | }
59 |
60 | header::integer header_fk{};
61 | };
62 | };
63 |
64 | } // namespace table
65 | } // namespace database
66 | } // namespace libbitcoin
67 |
68 | #endif
69 |
--------------------------------------------------------------------------------
/include/bitcoin/database/tables/indexes/strong_tx.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
3 | *
4 | * This file is part of libbitcoin.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef LIBBITCOIN_DATABASE_TABLES_INDEXES_STRONG_TX_HPP
20 | #define LIBBITCOIN_DATABASE_TABLES_INDEXES_STRONG_TX_HPP
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | namespace libbitcoin {
28 | namespace database {
29 | namespace table {
30 |
31 | /// strong_tx is a record hashmap of tx confirmation state.
32 | struct strong_tx
33 | : public hash_map
34 | {
35 | using header = schema::header::link;
36 | using hash_map::hashmap;
37 | static constexpr auto offset = header::bits;
38 | static_assert(offset < to_bits(header::size));
39 |
40 | static constexpr header::integer merge(bool positive,
41 | header::integer header_fk) NOEXCEPT
42 | {
43 | using namespace system;
44 | BC_ASSERT_MSG(!get_right(header_fk, offset), "overflow");
45 | return set_right(header_fk, offset, positive);
46 | }
47 |
48 | struct record
49 | : public schema::strong_tx
50 | {
51 | inline bool positive() const NOEXCEPT
52 | {
53 | return system::get_right(block_fk, offset);
54 | }
55 |
56 | inline header::integer header_fk() const NOEXCEPT
57 | {
58 | return system::set_right(block_fk, offset, false);
59 | }
60 |
61 | inline bool from_data(reader& source) NOEXCEPT
62 | {
63 | block_fk = source.read_little_endian();
64 | BC_ASSERT(!source || source.get_read_position() == minrow);
65 | return source;
66 | }
67 |
68 | inline bool to_data(finalizer& sink) const NOEXCEPT
69 | {
70 | sink.write_little_endian(block_fk);
71 | BC_ASSERT(!sink || sink.get_write_position() == minrow);
72 | return sink;
73 | }
74 |
75 | inline bool operator==(const record& other) const NOEXCEPT
76 | {
77 | return positive() == other.positive()
78 | && header_fk() == other.header_fk();
79 | }
80 |
81 | header::integer block_fk{};
82 | };
83 | };
84 |
85 | } // namespace table
86 | } // namespace database
87 | } // namespace libbitcoin
88 |
89 | #endif
90 |
--------------------------------------------------------------------------------
/include/bitcoin/database/tables/names.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
3 | *
4 | * This file is part of libbitcoin.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef LIBBITCOIN_DATABASE_TABLES_NAMES_HPP
20 | #define LIBBITCOIN_DATABASE_TABLES_NAMES_HPP
21 |
22 | #include
23 | #include
24 |
25 | namespace libbitcoin {
26 | namespace database {
27 | namespace schema {
28 |
29 | namespace dir
30 | {
31 | constexpr auto heads = "heads";
32 | constexpr auto primary = "primary";
33 | constexpr auto secondary = "secondary";
34 | }
35 |
36 | namespace archive
37 | {
38 | constexpr auto header = "archive_header";
39 | constexpr auto input = "archive_input";
40 | constexpr auto output = "archive_output";
41 | constexpr auto point = "archive_point";
42 | constexpr auto ins = "archive_ins";
43 | constexpr auto outs = "archive_outs";
44 | constexpr auto spend = "archive_spend";
45 | constexpr auto tx = "archive_tx";
46 | constexpr auto txs = "archive_txs";
47 | }
48 |
49 | namespace indexes
50 | {
51 | constexpr auto candidate = "candidate";
52 | constexpr auto confirmed = "confirmed";
53 | constexpr auto strong_tx = "strong_tx";
54 | }
55 |
56 | namespace caches
57 | {
58 | constexpr auto duplicate = "duplicate";
59 | constexpr auto prevout = "prevout";
60 | constexpr auto validated_bk = "validated_bk";
61 | constexpr auto validated_tx = "validated_tx";
62 | }
63 |
64 | namespace optionals
65 | {
66 | constexpr auto address = "address";
67 | constexpr auto filter_bk = "filter_bk";
68 | constexpr auto filter_tx = "filter_tx";
69 | }
70 |
71 | namespace locks
72 | {
73 | constexpr auto flush = "flush";
74 | constexpr auto process = "process";
75 | }
76 |
77 | namespace ext
78 | {
79 | constexpr auto head = ".head";
80 | constexpr auto data = ".data";
81 | constexpr auto lock = ".lock";
82 | }
83 |
84 | } // namespace schema
85 | } // namespace database
86 | } // namespace libbitcoin
87 |
88 | #endif
89 |
--------------------------------------------------------------------------------
/include/bitcoin/database/tables/optionals/address.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
3 | *
4 | * This file is part of libbitcoin.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef LIBBITCOIN_DATABASE_TABLES_OPTIONALS_ADDRESS_HPP
20 | #define LIBBITCOIN_DATABASE_TABLES_OPTIONALS_ADDRESS_HPP
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | namespace libbitcoin {
28 | namespace database {
29 | namespace table {
30 |
31 | /// address is a record multimap of output fk records.
32 | struct address
33 | : public hash_map
34 | {
35 | using out = schema::output::link;
36 | using hash_map::hashmap;
37 |
38 | struct record
39 | : public schema::address
40 | {
41 | inline bool from_data(reader& source) NOEXCEPT
42 | {
43 | output_fk = source.read_little_endian();
44 | return source;
45 | }
46 |
47 | inline bool to_data(finalizer& sink) const NOEXCEPT
48 | {
49 | sink.write_little_endian(output_fk);
50 | return sink;
51 | }
52 |
53 | inline bool operator==(const record& other) const NOEXCEPT
54 | {
55 | return output_fk == other.output_fk;
56 | }
57 |
58 | out::integer output_fk{};
59 | };
60 | };
61 |
62 | } // namespace table
63 | } // namespace database
64 | } // namespace libbitcoin
65 |
66 | #endif
67 |
--------------------------------------------------------------------------------
/include/bitcoin/database/tables/optionals/filter_bk.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
3 | *
4 | * This file is part of libbitcoin.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 | #ifndef LIBBITCOIN_DATABASE_TABLES_OPTIONALS_FILTER_BK_HPP
20 | #define LIBBITCOIN_DATABASE_TABLES_OPTIONALS_FILTER_BK_HPP
21 |
22 | #include
23 | #include
24 | #include
25 | #include