mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-06-26 22:24:30 -07:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 810cdbd790 | |||
| 0d4f4aec4e | |||
| 6b1863d3b4 | |||
| 27f5a3b16b | |||
| 876cd8291b | |||
| d0c46e4ef3 | |||
| feb8898ebf |
@@ -0,0 +1,291 @@
|
||||
# This file was autogenerated by dist: https://opensource.axo.dev/cargo-dist/
|
||||
#
|
||||
# Copyright 2022-2024, axodotdev
|
||||
# SPDX-License-Identifier: MIT or Apache-2.0
|
||||
#
|
||||
# CI that:
|
||||
#
|
||||
# * checks for a Git Tag that looks like a release
|
||||
# * builds artifacts with dist (archives, installers, hashes)
|
||||
# * uploads those artifacts to temporary workflow zip
|
||||
# * on success, uploads the artifacts to a GitHub Release
|
||||
#
|
||||
# Note that the GitHub Release will be created with a generated
|
||||
# title/body based on your changelogs.
|
||||
|
||||
name: Release
|
||||
permissions:
|
||||
"contents": "write"
|
||||
|
||||
# This task will run whenever you push a git tag that looks like a version
|
||||
# like "1.0.0", "v0.1.0-prerelease.1", "my-app/0.1.0", "releases/v1.0.0", etc.
|
||||
# Various formats will be parsed into a VERSION and an optional PACKAGE_NAME, where
|
||||
# PACKAGE_NAME must be the name of a Cargo package in your workspace, and VERSION
|
||||
# must be a Cargo-style SemVer Version (must have at least major.minor.patch).
|
||||
#
|
||||
# If PACKAGE_NAME is specified, then the announcement will be for that
|
||||
# package (erroring out if it doesn't have the given version or isn't dist-able).
|
||||
#
|
||||
# If PACKAGE_NAME isn't specified, then the announcement will be for all
|
||||
# (dist-able) packages in the workspace with that version (this mode is
|
||||
# intended for workspaces with only one dist-able package, or with all dist-able
|
||||
# packages versioned/released in lockstep).
|
||||
#
|
||||
# If you push multiple tags at once, separate instances of this workflow will
|
||||
# spin up, creating an independent announcement for each one. However, GitHub
|
||||
# will hard limit this to 3 tags per commit, as it will assume more tags is a
|
||||
# mistake.
|
||||
#
|
||||
# If there's a prerelease-style suffix to the version, then the release(s)
|
||||
# will be marked as a prerelease.
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
tags:
|
||||
- '**[0-9]+.[0-9]+.[0-9]+*'
|
||||
|
||||
jobs:
|
||||
# Run 'dist plan' (or host) to determine what tasks we need to do
|
||||
plan:
|
||||
runs-on: "ubuntu-20.04"
|
||||
outputs:
|
||||
val: ${{ steps.plan.outputs.manifest }}
|
||||
tag: ${{ !github.event.pull_request && github.ref_name || '' }}
|
||||
tag-flag: ${{ !github.event.pull_request && format('--tag={0}', github.ref_name) || '' }}
|
||||
publishing: ${{ !github.event.pull_request }}
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Install dist
|
||||
# we specify bash to get pipefail; it guards against the `curl` command
|
||||
# failing. otherwise `sh` won't catch that `curl` returned non-0
|
||||
shell: bash
|
||||
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/cargo-dist-installer.sh | sh"
|
||||
- name: Cache dist
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: cargo-dist-cache
|
||||
path: ~/.cargo/bin/dist
|
||||
# sure would be cool if github gave us proper conditionals...
|
||||
# so here's a doubly-nested ternary-via-truthiness to try to provide the best possible
|
||||
# functionality based on whether this is a pull_request, and whether it's from a fork.
|
||||
# (PRs run on the *source* but secrets are usually on the *target* -- that's *good*
|
||||
# but also really annoying to build CI around when it needs secrets to work right.)
|
||||
- id: plan
|
||||
run: |
|
||||
dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} --output-format=json > plan-dist-manifest.json
|
||||
echo "dist ran successfully"
|
||||
cat plan-dist-manifest.json
|
||||
echo "manifest=$(jq -c "." plan-dist-manifest.json)" >> "$GITHUB_OUTPUT"
|
||||
- name: "Upload dist-manifest.json"
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: artifacts-plan-dist-manifest
|
||||
path: plan-dist-manifest.json
|
||||
|
||||
# Build and packages all the platform-specific things
|
||||
build-local-artifacts:
|
||||
name: build-local-artifacts (${{ join(matrix.targets, ', ') }})
|
||||
# Let the initial task tell us to not run (currently very blunt)
|
||||
needs:
|
||||
- plan
|
||||
if: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix.include != null && (needs.plan.outputs.publishing == 'true' || fromJson(needs.plan.outputs.val).ci.github.pr_run_mode == 'upload') }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
# Target platforms/runners are computed by dist in create-release.
|
||||
# Each member of the matrix has the following arguments:
|
||||
#
|
||||
# - runner: the github runner
|
||||
# - dist-args: cli flags to pass to dist
|
||||
# - install-dist: expression to run to install dist on the runner
|
||||
#
|
||||
# Typically there will be:
|
||||
# - 1 "global" task that builds universal installers
|
||||
# - N "local" tasks that build each platform's binaries and platform-specific installers
|
||||
matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }}
|
||||
runs-on: ${{ matrix.runner }}
|
||||
container: ${{ matrix.container && matrix.container.image || null }}
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json
|
||||
steps:
|
||||
- name: enable windows longpaths
|
||||
run: |
|
||||
git config --global core.longpaths true
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Install Rust non-interactively if not already installed
|
||||
if: ${{ matrix.container }}
|
||||
run: |
|
||||
if ! command -v cargo > /dev/null 2>&1; then
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
||||
fi
|
||||
- name: Install dist
|
||||
run: ${{ matrix.install_dist.run }}
|
||||
# Get the dist-manifest
|
||||
- name: Fetch local artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: artifacts-*
|
||||
path: target/distrib/
|
||||
merge-multiple: true
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
${{ matrix.packages_install }}
|
||||
- name: Build artifacts
|
||||
run: |
|
||||
# Actually do builds and make zips and whatnot
|
||||
dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json
|
||||
echo "dist ran successfully"
|
||||
- id: cargo-dist
|
||||
name: Post-build
|
||||
# We force bash here just because github makes it really hard to get values up
|
||||
# to "real" actions without writing to env-vars, and writing to env-vars has
|
||||
# inconsistent syntax between shell and powershell.
|
||||
shell: bash
|
||||
run: |
|
||||
# Parse out what we just built and upload it to scratch storage
|
||||
echo "paths<<EOF" >> "$GITHUB_OUTPUT"
|
||||
dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT"
|
||||
echo "EOF" >> "$GITHUB_OUTPUT"
|
||||
|
||||
cp dist-manifest.json "$BUILD_MANIFEST_NAME"
|
||||
- name: "Upload artifacts"
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: artifacts-build-local-${{ join(matrix.targets, '_') }}
|
||||
path: |
|
||||
${{ steps.cargo-dist.outputs.paths }}
|
||||
${{ env.BUILD_MANIFEST_NAME }}
|
||||
|
||||
# Build and package all the platform-agnostic(ish) things
|
||||
build-global-artifacts:
|
||||
needs:
|
||||
- plan
|
||||
- build-local-artifacts
|
||||
runs-on: "ubuntu-20.04"
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
BUILD_MANIFEST_NAME: target/distrib/global-dist-manifest.json
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Install cached dist
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: cargo-dist-cache
|
||||
path: ~/.cargo/bin/
|
||||
- run: chmod +x ~/.cargo/bin/dist
|
||||
# Get all the local artifacts for the global tasks to use (for e.g. checksums)
|
||||
- name: Fetch local artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: artifacts-*
|
||||
path: target/distrib/
|
||||
merge-multiple: true
|
||||
- id: cargo-dist
|
||||
shell: bash
|
||||
run: |
|
||||
dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json
|
||||
echo "dist ran successfully"
|
||||
|
||||
# Parse out what we just built and upload it to scratch storage
|
||||
echo "paths<<EOF" >> "$GITHUB_OUTPUT"
|
||||
jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT"
|
||||
echo "EOF" >> "$GITHUB_OUTPUT"
|
||||
|
||||
cp dist-manifest.json "$BUILD_MANIFEST_NAME"
|
||||
- name: "Upload artifacts"
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: artifacts-build-global
|
||||
path: |
|
||||
${{ steps.cargo-dist.outputs.paths }}
|
||||
${{ env.BUILD_MANIFEST_NAME }}
|
||||
# Determines if we should publish/announce
|
||||
host:
|
||||
needs:
|
||||
- plan
|
||||
- build-local-artifacts
|
||||
- build-global-artifacts
|
||||
# Only run if we're "publishing", and only if local and global didn't fail (skipped is fine)
|
||||
if: ${{ always() && needs.plan.outputs.publishing == 'true' && (needs.build-global-artifacts.result == 'skipped' || needs.build-global-artifacts.result == 'success') && (needs.build-local-artifacts.result == 'skipped' || needs.build-local-artifacts.result == 'success') }}
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
runs-on: "ubuntu-20.04"
|
||||
outputs:
|
||||
val: ${{ steps.host.outputs.manifest }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Install cached dist
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: cargo-dist-cache
|
||||
path: ~/.cargo/bin/
|
||||
- run: chmod +x ~/.cargo/bin/dist
|
||||
# Fetch artifacts from scratch-storage
|
||||
- name: Fetch artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: artifacts-*
|
||||
path: target/distrib/
|
||||
merge-multiple: true
|
||||
- id: host
|
||||
shell: bash
|
||||
run: |
|
||||
dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --output-format=json > dist-manifest.json
|
||||
echo "artifacts uploaded and released successfully"
|
||||
cat dist-manifest.json
|
||||
echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT"
|
||||
- name: "Upload dist-manifest.json"
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
# Overwrite the previous copy
|
||||
name: artifacts-dist-manifest
|
||||
path: dist-manifest.json
|
||||
# Create a GitHub Release while uploading all files to it
|
||||
- name: "Download GitHub Artifacts"
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: artifacts-*
|
||||
path: artifacts
|
||||
merge-multiple: true
|
||||
- name: Cleanup
|
||||
run: |
|
||||
# Remove the granular manifests
|
||||
rm -f artifacts/*-dist-manifest.json
|
||||
- name: Create GitHub Release
|
||||
env:
|
||||
PRERELEASE_FLAG: "${{ fromJson(steps.host.outputs.manifest).announcement_is_prerelease && '--prerelease' || '' }}"
|
||||
ANNOUNCEMENT_TITLE: "${{ fromJson(steps.host.outputs.manifest).announcement_title }}"
|
||||
ANNOUNCEMENT_BODY: "${{ fromJson(steps.host.outputs.manifest).announcement_github_body }}"
|
||||
RELEASE_COMMIT: "${{ github.sha }}"
|
||||
run: |
|
||||
# Write and read notes from a file to avoid quoting breaking things
|
||||
echo "$ANNOUNCEMENT_BODY" > $RUNNER_TEMP/notes.txt
|
||||
|
||||
gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/*
|
||||
|
||||
announce:
|
||||
needs:
|
||||
- plan
|
||||
- host
|
||||
# use "always() && ..." to allow us to wait for all publish jobs while
|
||||
# still allowing individual publish jobs to skip themselves (for prereleases).
|
||||
# "host" however must run to completion, no skipping allowed!
|
||||
if: ${{ always() && needs.host.result == 'success' }}
|
||||
runs-on: "ubuntu-20.04"
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
Generated
+22
-75
@@ -368,7 +368,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "brk"
|
||||
version = "0.0.14"
|
||||
version = "0.0.18"
|
||||
dependencies = [
|
||||
"brk_cli",
|
||||
"brk_computer",
|
||||
@@ -385,7 +385,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "brk_cli"
|
||||
version = "0.0.14"
|
||||
version = "0.0.18"
|
||||
dependencies = [
|
||||
"brk_computer",
|
||||
"brk_core",
|
||||
@@ -406,7 +406,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "brk_computer"
|
||||
version = "0.0.14"
|
||||
version = "0.0.18"
|
||||
dependencies = [
|
||||
"brk_core",
|
||||
"brk_exit",
|
||||
@@ -421,7 +421,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "brk_core"
|
||||
version = "0.0.14"
|
||||
version = "0.0.18"
|
||||
dependencies = [
|
||||
"bitcoin",
|
||||
"bitcoincore-rpc",
|
||||
@@ -438,7 +438,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "brk_exit"
|
||||
version = "0.0.14"
|
||||
version = "0.0.18"
|
||||
dependencies = [
|
||||
"brk_logger",
|
||||
"ctrlc",
|
||||
@@ -447,7 +447,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "brk_fetcher"
|
||||
version = "0.0.14"
|
||||
version = "0.0.18"
|
||||
dependencies = [
|
||||
"brk_core",
|
||||
"brk_logger",
|
||||
@@ -460,7 +460,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "brk_indexer"
|
||||
version = "0.0.14"
|
||||
version = "0.0.18"
|
||||
dependencies = [
|
||||
"bitcoin",
|
||||
"bitcoincore-rpc",
|
||||
@@ -479,7 +479,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "brk_logger"
|
||||
version = "0.0.14"
|
||||
version = "0.0.18"
|
||||
dependencies = [
|
||||
"color-eyre",
|
||||
"env_logger",
|
||||
@@ -489,7 +489,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "brk_parser"
|
||||
version = "0.0.14"
|
||||
version = "0.0.18"
|
||||
dependencies = [
|
||||
"bitcoin",
|
||||
"bitcoincore-rpc",
|
||||
@@ -504,7 +504,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "brk_query"
|
||||
version = "0.0.14"
|
||||
version = "0.0.18"
|
||||
dependencies = [
|
||||
"brk_computer",
|
||||
"brk_indexer",
|
||||
@@ -520,7 +520,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "brk_server"
|
||||
version = "0.0.14"
|
||||
version = "0.0.18"
|
||||
dependencies = [
|
||||
"axum",
|
||||
"brk_computer",
|
||||
@@ -541,13 +541,12 @@ dependencies = [
|
||||
"tokio",
|
||||
"tower-http",
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
"zip",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "brk_vec"
|
||||
version = "0.0.14"
|
||||
version = "0.0.18"
|
||||
dependencies = [
|
||||
"memmap2",
|
||||
"rayon",
|
||||
@@ -1413,9 +1412,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.8.0"
|
||||
version = "2.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058"
|
||||
checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown 0.15.2",
|
||||
@@ -1713,16 +1712,6 @@ version = "0.5.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "610a5acd306ec67f907abe5567859a3c693fb9886eb1f012ab8f2a47bef3db51"
|
||||
|
||||
[[package]]
|
||||
name = "nu-ansi-term"
|
||||
version = "0.46.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84"
|
||||
dependencies = [
|
||||
"overload",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-bigint"
|
||||
version = "0.4.6"
|
||||
@@ -1778,12 +1767,6 @@ version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1a80800c0488c3a21695ea981a54918fbb37abf04f4d0720c453632255e2ff0e"
|
||||
|
||||
[[package]]
|
||||
name = "overload"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
|
||||
|
||||
[[package]]
|
||||
name = "owo-colors"
|
||||
version = "3.5.0"
|
||||
@@ -2213,7 +2196,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3672b37090dbd86368a4145bc067582552b29c27377cad4e0a306c97f9bd7772"
|
||||
dependencies = [
|
||||
"fixedbitset",
|
||||
"indexmap 2.8.0",
|
||||
"indexmap 2.9.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2675,7 +2658,7 @@ dependencies = [
|
||||
"chrono",
|
||||
"hex",
|
||||
"indexmap 1.9.3",
|
||||
"indexmap 2.8.0",
|
||||
"indexmap 2.9.0",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
@@ -2750,9 +2733,9 @@ checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d"
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.14.0"
|
||||
version = "1.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd"
|
||||
checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9"
|
||||
|
||||
[[package]]
|
||||
name = "smawk"
|
||||
@@ -2999,7 +2982,7 @@ version = "0.22.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474"
|
||||
dependencies = [
|
||||
"indexmap 2.8.0",
|
||||
"indexmap 2.9.0",
|
||||
"serde",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
@@ -3097,29 +3080,15 @@ dependencies = [
|
||||
"tracing-subscriber",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-log"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3"
|
||||
dependencies = [
|
||||
"log",
|
||||
"once_cell",
|
||||
"tracing-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-subscriber"
|
||||
version = "0.3.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008"
|
||||
dependencies = [
|
||||
"nu-ansi-term",
|
||||
"sharded-slab",
|
||||
"smallvec",
|
||||
"thread_local",
|
||||
"tracing-core",
|
||||
"tracing-log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3284,28 +3253,6 @@ version = "0.25.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
||||
dependencies = [
|
||||
"winapi-i686-pc-windows-gnu",
|
||||
"winapi-x86_64-pc-windows-gnu",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-i686-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "windows-core"
|
||||
version = "0.61.0"
|
||||
@@ -3522,9 +3469,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zip"
|
||||
version = "2.6.0"
|
||||
version = "2.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "febbe83a485467affa75a75d28dc7494acd2f819e549536c47d46b3089b56164"
|
||||
checksum = "1dcb24d0152526ae49b9b96c1dcf71850ca1e0b882e4e28ed898a93c41334744"
|
||||
dependencies = [
|
||||
"aes",
|
||||
"arbitrary",
|
||||
@@ -3536,7 +3483,7 @@ dependencies = [
|
||||
"flate2",
|
||||
"getrandom 0.3.2",
|
||||
"hmac",
|
||||
"indexmap 2.8.0",
|
||||
"indexmap 2.9.0",
|
||||
"lzma-rs",
|
||||
"memchr",
|
||||
"pbkdf2",
|
||||
|
||||
+19
-1
@@ -4,7 +4,7 @@ members = ["crates/*"]
|
||||
package.description = "The Bitcoin Research Kit is a suite of tools designed to extract, compute and display data stored on a Bitcoin Core node"
|
||||
package.license = "MIT"
|
||||
package.edition = "2024"
|
||||
package.version = "0.0.14"
|
||||
package.version = "0.0.18"
|
||||
package.repository = "https://github.com/bitcoinresearchkit/brk"
|
||||
|
||||
[profile.release]
|
||||
@@ -12,6 +12,9 @@ lto = "fat"
|
||||
codegen-units = 1
|
||||
panic = "abort"
|
||||
|
||||
[profile.dist]
|
||||
inherits = "release"
|
||||
|
||||
[workspace.dependencies]
|
||||
bitcoin = { version = "0.32.5", features = ["serde"] }
|
||||
bitcoincore-rpc = "0.19.0"
|
||||
@@ -39,3 +42,18 @@ serde = { version = "1.0.219", features = ["derive"] }
|
||||
serde_json = { version = "1.0.140", features = ["float_roundtrip"] }
|
||||
tabled = "0.18.0"
|
||||
zerocopy = { version = "0.8.24", features = ["derive"] }
|
||||
|
||||
[workspace.metadata.release]
|
||||
shared-version = true
|
||||
tag-name = "v{{version}}"
|
||||
|
||||
[workspace.metadata.dist]
|
||||
cargo-dist-version = "0.28.0"
|
||||
ci = "github"
|
||||
installers = []
|
||||
targets = [
|
||||
"aarch64-apple-darwin",
|
||||
"aarch64-unknown-linux-gnu",
|
||||
"x86_64-apple-darwin",
|
||||
"x86_64-unknown-linux-gnu",
|
||||
]
|
||||
|
||||
@@ -26,3 +26,6 @@ toml = "0.8.20"
|
||||
[[bin]]
|
||||
name = "brk"
|
||||
path = "src/main.rs"
|
||||
|
||||
[package.metadata.dist]
|
||||
dist = false
|
||||
|
||||
@@ -9,17 +9,19 @@ use std::{
|
||||
|
||||
use brk_core::CheckedSub;
|
||||
use brk_exit::Exit;
|
||||
use brk_vec::{AnyStorableVec, Compressed, Error, Result, StoredIndex, StoredType, Version};
|
||||
use brk_vec::{
|
||||
AnyStorableVec, Compressed, Error, Result, StorableVec, StoredIndex, StoredType, Version,
|
||||
};
|
||||
|
||||
const FLUSH_EVERY: usize = 10_000;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct StorableVec<I, T> {
|
||||
pub struct ComputedVec<I, T> {
|
||||
computed_version: Option<Version>,
|
||||
vec: brk_vec::StorableVec<I, T>,
|
||||
vec: StorableVec<I, T>,
|
||||
}
|
||||
|
||||
impl<I, T> StorableVec<I, T>
|
||||
impl<I, T> ComputedVec<I, T>
|
||||
where
|
||||
I: StoredIndex,
|
||||
T: StoredType,
|
||||
@@ -316,7 +318,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<I, T> Clone for StorableVec<I, T>
|
||||
impl<I, T> Clone for ComputedVec<I, T>
|
||||
where
|
||||
I: StoredIndex,
|
||||
T: StoredType,
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
use std::{fs, path::Path};
|
||||
|
||||
use brk_core::{CheckedSub, Dateindex, Height, Timestamp};
|
||||
use brk_core::{CheckedSub, Dateindex, Timestamp};
|
||||
use brk_exit::Exit;
|
||||
use brk_indexer::Indexer;
|
||||
use brk_vec::{AnyStorableVec, Compressed, Version};
|
||||
|
||||
use super::{
|
||||
Indexes, StorableVec, indexes,
|
||||
stats::{StorableVecGeneatorOptions, StorableVecsStatsFromHeight},
|
||||
ComputedVec, Indexes,
|
||||
grouped::{ComputedVecsFromHeight, StorableVecGeneatorOptions},
|
||||
indexes,
|
||||
};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Vecs {
|
||||
pub height_to_block_interval: StorableVec<Height, Timestamp>,
|
||||
pub indexes_to_block_interval_stats: StorableVecsStatsFromHeight<Timestamp>,
|
||||
pub dateindex_to_block_count: StorableVec<Dateindex, u16>,
|
||||
pub dateindex_to_total_block_count: StorableVec<Dateindex, u32>,
|
||||
pub indexes_to_block_interval: ComputedVecsFromHeight<Timestamp>,
|
||||
pub dateindex_to_block_count: ComputedVec<Dateindex, u16>,
|
||||
pub dateindex_to_total_block_count: ComputedVec<Dateindex, u32>,
|
||||
}
|
||||
|
||||
impl Vecs {
|
||||
@@ -23,25 +23,22 @@ impl Vecs {
|
||||
fs::create_dir_all(path)?;
|
||||
|
||||
Ok(Self {
|
||||
height_to_block_interval: StorableVec::forced_import(
|
||||
&path.join("height_to_block_interval"),
|
||||
indexes_to_block_interval: ComputedVecsFromHeight::forced_import(
|
||||
path,
|
||||
"block_interval",
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
indexes_to_block_interval_stats: StorableVecsStatsFromHeight::forced_import(
|
||||
&path.join("block_interval"),
|
||||
compressed,
|
||||
StorableVecGeneatorOptions::default()
|
||||
.add_percentiles()
|
||||
.add_minmax()
|
||||
.add_average(),
|
||||
)?,
|
||||
dateindex_to_block_count: StorableVec::forced_import(
|
||||
dateindex_to_block_count: ComputedVec::forced_import(
|
||||
&path.join("dateindex_to_block_count"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
dateindex_to_total_block_count: StorableVec::forced_import(
|
||||
dateindex_to_total_block_count: ComputedVec::forced_import(
|
||||
&path.join("dateindex_to_total_block_count"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
@@ -58,23 +55,23 @@ impl Vecs {
|
||||
) -> color_eyre::Result<()> {
|
||||
let indexer_vecs = indexer.mut_vecs();
|
||||
|
||||
self.height_to_block_interval.compute_transform(
|
||||
starting_indexes.height,
|
||||
indexer_vecs.height_to_timestamp.mut_vec(),
|
||||
|(height, timestamp, _, height_to_timestamp)| {
|
||||
let interval = height.decremented().map_or(Timestamp::ZERO, |prev_h| {
|
||||
let prev_timestamp = *height_to_timestamp.get(prev_h).unwrap().unwrap();
|
||||
timestamp
|
||||
.checked_sub(prev_timestamp)
|
||||
.unwrap_or(Timestamp::ZERO)
|
||||
});
|
||||
(height, interval)
|
||||
self.indexes_to_block_interval.compute(
|
||||
|v| {
|
||||
v.compute_transform(
|
||||
starting_indexes.height,
|
||||
indexer_vecs.height_to_timestamp.mut_vec(),
|
||||
|(height, timestamp, _, height_to_timestamp)| {
|
||||
let interval = height.decremented().map_or(Timestamp::ZERO, |prev_h| {
|
||||
let prev_timestamp = *height_to_timestamp.get(prev_h).unwrap().unwrap();
|
||||
timestamp
|
||||
.checked_sub(prev_timestamp)
|
||||
.unwrap_or(Timestamp::ZERO)
|
||||
});
|
||||
(height, interval)
|
||||
},
|
||||
exit,
|
||||
)
|
||||
},
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.indexes_to_block_interval_stats.compute(
|
||||
&mut self.height_to_block_interval,
|
||||
indexes,
|
||||
starting_indexes,
|
||||
exit,
|
||||
@@ -86,11 +83,10 @@ impl Vecs {
|
||||
pub fn as_any_vecs(&self) -> Vec<&dyn AnyStorableVec> {
|
||||
[
|
||||
vec![
|
||||
self.height_to_block_interval.any_vec(),
|
||||
self.dateindex_to_block_count.any_vec(),
|
||||
self.dateindex_to_total_block_count.any_vec(),
|
||||
],
|
||||
self.indexes_to_block_interval_stats.as_any_vecs(),
|
||||
self.indexes_to_block_interval.any_vecs(),
|
||||
]
|
||||
.concat()
|
||||
}
|
||||
|
||||
+31
-34
@@ -3,40 +3,41 @@ use std::path::Path;
|
||||
use brk_exit::Exit;
|
||||
use brk_vec::{AnyStorableVec, Compressed, Result, StoredIndex, StoredType, Version};
|
||||
|
||||
use crate::storage::vecs::base::StorableVec;
|
||||
use crate::storage::vecs::base::ComputedVec;
|
||||
|
||||
use super::ComputedType;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct StorableVecBuilder<I, T>
|
||||
pub struct ComputedVecBuilder<I, T>
|
||||
where
|
||||
I: StoredIndex,
|
||||
T: ComputedType,
|
||||
{
|
||||
pub first: Option<StorableVec<I, T>>,
|
||||
pub average: Option<StorableVec<I, T>>,
|
||||
pub sum: Option<StorableVec<I, T>>,
|
||||
pub max: Option<StorableVec<I, T>>,
|
||||
pub _90p: Option<StorableVec<I, T>>,
|
||||
pub _75p: Option<StorableVec<I, T>>,
|
||||
pub median: Option<StorableVec<I, T>>,
|
||||
pub _25p: Option<StorableVec<I, T>>,
|
||||
pub _10p: Option<StorableVec<I, T>>,
|
||||
pub min: Option<StorableVec<I, T>>,
|
||||
pub last: Option<StorableVec<I, T>>,
|
||||
pub first: Option<ComputedVec<I, T>>,
|
||||
pub average: Option<ComputedVec<I, T>>,
|
||||
pub sum: Option<ComputedVec<I, T>>,
|
||||
pub max: Option<ComputedVec<I, T>>,
|
||||
pub _90p: Option<ComputedVec<I, T>>,
|
||||
pub _75p: Option<ComputedVec<I, T>>,
|
||||
pub median: Option<ComputedVec<I, T>>,
|
||||
pub _25p: Option<ComputedVec<I, T>>,
|
||||
pub _10p: Option<ComputedVec<I, T>>,
|
||||
pub min: Option<ComputedVec<I, T>>,
|
||||
pub last: Option<ComputedVec<I, T>>,
|
||||
}
|
||||
|
||||
impl<I, T> StorableVecBuilder<I, T>
|
||||
impl<I, T> ComputedVecBuilder<I, T>
|
||||
where
|
||||
I: StoredIndex,
|
||||
T: ComputedType,
|
||||
{
|
||||
pub fn forced_import(
|
||||
path: &Path,
|
||||
name: &str,
|
||||
compressed: Compressed,
|
||||
options: StorableVecGeneatorOptions,
|
||||
) -> color_eyre::Result<Self> {
|
||||
let name = path.file_name().unwrap().to_str().unwrap().to_string();
|
||||
// let name = path.file_name().unwrap().to_str().unwrap().to_string();
|
||||
let key = I::to_string().split("::").last().unwrap().to_lowercase();
|
||||
|
||||
let only_one_active = options.is_only_one_active();
|
||||
@@ -59,10 +60,10 @@ where
|
||||
|
||||
let s = Self {
|
||||
first: options.first.then(|| {
|
||||
StorableVec::forced_import(&prefix("first"), Version::ONE, compressed).unwrap()
|
||||
ComputedVec::forced_import(&prefix("first"), Version::ONE, compressed).unwrap()
|
||||
}),
|
||||
last: options.last.then(|| {
|
||||
StorableVec::forced_import(
|
||||
ComputedVec::forced_import(
|
||||
&path.with_file_name(format!("{key}_to_{name}")),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
@@ -70,31 +71,31 @@ where
|
||||
.unwrap()
|
||||
}),
|
||||
min: options.min.then(|| {
|
||||
StorableVec::forced_import(&suffix("min"), Version::ONE, compressed).unwrap()
|
||||
ComputedVec::forced_import(&suffix("min"), Version::ONE, compressed).unwrap()
|
||||
}),
|
||||
max: options.max.then(|| {
|
||||
StorableVec::forced_import(&suffix("max"), Version::ONE, compressed).unwrap()
|
||||
ComputedVec::forced_import(&suffix("max"), Version::ONE, compressed).unwrap()
|
||||
}),
|
||||
median: options.median.then(|| {
|
||||
StorableVec::forced_import(&suffix("median"), Version::ONE, compressed).unwrap()
|
||||
ComputedVec::forced_import(&suffix("median"), Version::ONE, compressed).unwrap()
|
||||
}),
|
||||
average: options.average.then(|| {
|
||||
StorableVec::forced_import(&suffix("average"), Version::ONE, compressed).unwrap()
|
||||
ComputedVec::forced_import(&suffix("average"), Version::ONE, compressed).unwrap()
|
||||
}),
|
||||
sum: options.sum.then(|| {
|
||||
StorableVec::forced_import(&suffix("sum"), Version::ONE, compressed).unwrap()
|
||||
ComputedVec::forced_import(&suffix("sum"), Version::ONE, compressed).unwrap()
|
||||
}),
|
||||
_90p: options._90p.then(|| {
|
||||
StorableVec::forced_import(&suffix("90p"), Version::ONE, compressed).unwrap()
|
||||
ComputedVec::forced_import(&suffix("90p"), Version::ONE, compressed).unwrap()
|
||||
}),
|
||||
_75p: options._75p.then(|| {
|
||||
StorableVec::forced_import(&suffix("75p"), Version::ONE, compressed).unwrap()
|
||||
ComputedVec::forced_import(&suffix("75p"), Version::ONE, compressed).unwrap()
|
||||
}),
|
||||
_25p: options._25p.then(|| {
|
||||
StorableVec::forced_import(&suffix("25p"), Version::ONE, compressed).unwrap()
|
||||
ComputedVec::forced_import(&suffix("25p"), Version::ONE, compressed).unwrap()
|
||||
}),
|
||||
_10p: options._10p.then(|| {
|
||||
StorableVec::forced_import(&suffix("10p"), Version::ONE, compressed).unwrap()
|
||||
ComputedVec::forced_import(&suffix("10p"), Version::ONE, compressed).unwrap()
|
||||
}),
|
||||
};
|
||||
|
||||
@@ -104,7 +105,7 @@ where
|
||||
pub fn compute<I2>(
|
||||
&mut self,
|
||||
max_from: I,
|
||||
source: &mut StorableVec<I2, T>,
|
||||
source: &mut ComputedVec<I2, T>,
|
||||
first_indexes: &mut brk_vec::StorableVec<I, I2>,
|
||||
last_indexes: &mut brk_vec::StorableVec<I, I2>,
|
||||
exit: &Exit,
|
||||
@@ -211,7 +212,7 @@ where
|
||||
pub fn from_aligned<I2>(
|
||||
&mut self,
|
||||
max_from: I,
|
||||
source: &mut StorableVecBuilder<I2, T>,
|
||||
source: &mut ComputedVecBuilder<I2, T>,
|
||||
first_indexes: &mut brk_vec::StorableVec<I, I2>,
|
||||
last_indexes: &mut brk_vec::StorableVec<I, I2>,
|
||||
exit: &Exit,
|
||||
@@ -352,15 +353,11 @@ where
|
||||
|
||||
fn starting_index(&self, max_from: I) -> I {
|
||||
max_from.min(I::from(
|
||||
self.as_any_vecs()
|
||||
.into_iter()
|
||||
.map(|v| v.len())
|
||||
.min()
|
||||
.unwrap(),
|
||||
self.any_vecs().into_iter().map(|v| v.len()).min().unwrap(),
|
||||
))
|
||||
}
|
||||
|
||||
pub fn as_any_vecs(&self) -> Vec<&dyn AnyStorableVec> {
|
||||
pub fn any_vecs(&self) -> Vec<&dyn AnyStorableVec> {
|
||||
let mut v: Vec<&dyn AnyStorableVec> = vec![];
|
||||
|
||||
if let Some(first) = self.first.as_ref() {
|
||||
+40
-26
@@ -2,55 +2,68 @@ use std::path::Path;
|
||||
|
||||
use brk_core::{Dateindex, Decadeindex, Monthindex, Quarterindex, Weekindex, Yearindex};
|
||||
use brk_exit::Exit;
|
||||
use brk_vec::{AnyStorableVec, Compressed};
|
||||
use brk_vec::{AnyStorableVec, Compressed, Result, Version};
|
||||
|
||||
use crate::storage::vecs::{Indexes, base::StorableVec, indexes};
|
||||
use crate::storage::vecs::{Indexes, base::ComputedVec, indexes};
|
||||
|
||||
use super::{ComputedType, StorableVecBuilder, StorableVecGeneatorOptions};
|
||||
use super::{ComputedType, ComputedVecBuilder, StorableVecGeneatorOptions};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct StorableVecsStatsFromDate<T>
|
||||
pub struct ComputedVecsFromDateindex<T>
|
||||
where
|
||||
T: ComputedType + PartialOrd,
|
||||
{
|
||||
pub weekindex: StorableVecBuilder<Weekindex, T>,
|
||||
pub monthindex: StorableVecBuilder<Monthindex, T>,
|
||||
pub quarterindex: StorableVecBuilder<Quarterindex, T>,
|
||||
pub yearindex: StorableVecBuilder<Yearindex, T>,
|
||||
pub decadeindex: StorableVecBuilder<Decadeindex, T>,
|
||||
pub dateindex: ComputedVec<Dateindex, T>,
|
||||
pub weekindex: ComputedVecBuilder<Weekindex, T>,
|
||||
pub monthindex: ComputedVecBuilder<Monthindex, T>,
|
||||
pub quarterindex: ComputedVecBuilder<Quarterindex, T>,
|
||||
pub yearindex: ComputedVecBuilder<Yearindex, T>,
|
||||
pub decadeindex: ComputedVecBuilder<Decadeindex, T>,
|
||||
}
|
||||
|
||||
impl<T> StorableVecsStatsFromDate<T>
|
||||
impl<T> ComputedVecsFromDateindex<T>
|
||||
where
|
||||
T: ComputedType + Ord + From<f64>,
|
||||
f64: From<T>,
|
||||
{
|
||||
pub fn forced_import(
|
||||
path: &Path,
|
||||
name: &str,
|
||||
version: Version,
|
||||
compressed: Compressed,
|
||||
options: StorableVecGeneatorOptions,
|
||||
) -> color_eyre::Result<Self> {
|
||||
let options = options.remove_percentiles();
|
||||
|
||||
Ok(Self {
|
||||
weekindex: StorableVecBuilder::forced_import(path, compressed, options)?,
|
||||
monthindex: StorableVecBuilder::forced_import(path, compressed, options)?,
|
||||
quarterindex: StorableVecBuilder::forced_import(path, compressed, options)?,
|
||||
yearindex: StorableVecBuilder::forced_import(path, compressed, options)?,
|
||||
decadeindex: StorableVecBuilder::forced_import(path, compressed, options)?,
|
||||
dateindex: ComputedVec::forced_import(
|
||||
&path.join(format!("dateindex_to_{name}")),
|
||||
version,
|
||||
compressed,
|
||||
)?,
|
||||
weekindex: ComputedVecBuilder::forced_import(path, name, compressed, options)?,
|
||||
monthindex: ComputedVecBuilder::forced_import(path, name, compressed, options)?,
|
||||
quarterindex: ComputedVecBuilder::forced_import(path, name, compressed, options)?,
|
||||
yearindex: ComputedVecBuilder::forced_import(path, name, compressed, options)?,
|
||||
decadeindex: ComputedVecBuilder::forced_import(path, name, compressed, options)?,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn compute(
|
||||
pub fn compute<F>(
|
||||
&mut self,
|
||||
source: &mut StorableVec<Dateindex, T>,
|
||||
mut compute: F,
|
||||
indexes: &mut indexes::Vecs,
|
||||
starting_indexes: &Indexes,
|
||||
exit: &Exit,
|
||||
) -> color_eyre::Result<()> {
|
||||
) -> color_eyre::Result<()>
|
||||
where
|
||||
F: FnMut(&mut ComputedVec<Dateindex, T>) -> Result<()>,
|
||||
{
|
||||
compute(&mut self.dateindex)?;
|
||||
|
||||
self.weekindex.compute(
|
||||
starting_indexes.weekindex,
|
||||
source,
|
||||
&mut self.dateindex,
|
||||
indexes.weekindex_to_first_dateindex.mut_vec(),
|
||||
indexes.weekindex_to_last_dateindex.mut_vec(),
|
||||
exit,
|
||||
@@ -58,7 +71,7 @@ where
|
||||
|
||||
self.monthindex.compute(
|
||||
starting_indexes.monthindex,
|
||||
source,
|
||||
&mut self.dateindex,
|
||||
indexes.monthindex_to_first_dateindex.mut_vec(),
|
||||
indexes.monthindex_to_last_dateindex.mut_vec(),
|
||||
exit,
|
||||
@@ -91,13 +104,14 @@ where
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn as_any_vecs(&self) -> Vec<&dyn AnyStorableVec> {
|
||||
pub fn any_vecs(&self) -> Vec<&dyn AnyStorableVec> {
|
||||
[
|
||||
self.weekindex.as_any_vecs(),
|
||||
self.monthindex.as_any_vecs(),
|
||||
self.quarterindex.as_any_vecs(),
|
||||
self.yearindex.as_any_vecs(),
|
||||
self.decadeindex.as_any_vecs(),
|
||||
vec![self.dateindex.any_vec()],
|
||||
self.weekindex.any_vecs(),
|
||||
self.monthindex.any_vecs(),
|
||||
self.quarterindex.any_vecs(),
|
||||
self.yearindex.any_vecs(),
|
||||
self.decadeindex.any_vecs(),
|
||||
]
|
||||
.concat()
|
||||
}
|
||||
+49
-33
@@ -4,63 +4,78 @@ use brk_core::{
|
||||
Dateindex, Decadeindex, Difficultyepoch, Height, Monthindex, Quarterindex, Weekindex, Yearindex,
|
||||
};
|
||||
use brk_exit::Exit;
|
||||
use brk_vec::{AnyStorableVec, Compressed};
|
||||
use brk_vec::{AnyStorableVec, Compressed, Result, Version};
|
||||
|
||||
use crate::storage::vecs::{Indexes, base::StorableVec, indexes};
|
||||
use crate::storage::vecs::{Indexes, base::ComputedVec, indexes};
|
||||
|
||||
use super::{ComputedType, StorableVecBuilder, StorableVecGeneatorOptions};
|
||||
use super::{ComputedType, ComputedVecBuilder, StorableVecGeneatorOptions};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct StorableVecsStatsFromHeight<T>
|
||||
pub struct ComputedVecsFromHeight<T>
|
||||
where
|
||||
T: ComputedType + PartialOrd,
|
||||
{
|
||||
pub dateindex: StorableVecBuilder<Dateindex, T>,
|
||||
pub weekindex: StorableVecBuilder<Weekindex, T>,
|
||||
pub difficultyepoch: StorableVecBuilder<Difficultyepoch, T>,
|
||||
pub monthindex: StorableVecBuilder<Monthindex, T>,
|
||||
pub quarterindex: StorableVecBuilder<Quarterindex, T>,
|
||||
pub yearindex: StorableVecBuilder<Yearindex, T>,
|
||||
pub height: ComputedVec<Height, T>,
|
||||
pub dateindex: ComputedVecBuilder<Dateindex, T>,
|
||||
pub weekindex: ComputedVecBuilder<Weekindex, T>,
|
||||
pub difficultyepoch: ComputedVecBuilder<Difficultyepoch, T>,
|
||||
pub monthindex: ComputedVecBuilder<Monthindex, T>,
|
||||
pub quarterindex: ComputedVecBuilder<Quarterindex, T>,
|
||||
pub yearindex: ComputedVecBuilder<Yearindex, T>,
|
||||
// TODO: pub halvingepoch: StorableVecGeneator<Halvingepoch, T>,
|
||||
pub decadeindex: StorableVecBuilder<Decadeindex, T>,
|
||||
pub decadeindex: ComputedVecBuilder<Decadeindex, T>,
|
||||
}
|
||||
|
||||
impl<T> StorableVecsStatsFromHeight<T>
|
||||
impl<T> ComputedVecsFromHeight<T>
|
||||
where
|
||||
T: ComputedType + Ord + From<f64>,
|
||||
f64: From<T>,
|
||||
{
|
||||
pub fn forced_import(
|
||||
path: &Path,
|
||||
name: &str,
|
||||
version: Version,
|
||||
compressed: Compressed,
|
||||
options: StorableVecGeneatorOptions,
|
||||
) -> color_eyre::Result<Self> {
|
||||
let dateindex = StorableVecBuilder::forced_import(path, compressed, options)?;
|
||||
let height = ComputedVec::forced_import(
|
||||
&path.join(format!("height_to_{name}")),
|
||||
version,
|
||||
compressed,
|
||||
)?;
|
||||
|
||||
let dateindex = ComputedVecBuilder::forced_import(path, name, compressed, options)?;
|
||||
|
||||
let options = options.remove_percentiles();
|
||||
|
||||
Ok(Self {
|
||||
height,
|
||||
dateindex,
|
||||
weekindex: StorableVecBuilder::forced_import(path, compressed, options)?,
|
||||
difficultyepoch: StorableVecBuilder::forced_import(path, compressed, options)?,
|
||||
monthindex: StorableVecBuilder::forced_import(path, compressed, options)?,
|
||||
quarterindex: StorableVecBuilder::forced_import(path, compressed, options)?,
|
||||
yearindex: StorableVecBuilder::forced_import(path, compressed, options)?,
|
||||
// halvingepoch: StorableVecGeneator::forced_import(path, compressed, options)?,
|
||||
decadeindex: StorableVecBuilder::forced_import(path, compressed, options)?,
|
||||
weekindex: ComputedVecBuilder::forced_import(path, name, compressed, options)?,
|
||||
difficultyepoch: ComputedVecBuilder::forced_import(path, name, compressed, options)?,
|
||||
monthindex: ComputedVecBuilder::forced_import(path, name, compressed, options)?,
|
||||
quarterindex: ComputedVecBuilder::forced_import(path, name, compressed, options)?,
|
||||
yearindex: ComputedVecBuilder::forced_import(path, name, compressed, options)?,
|
||||
// halvingepoch: StorableVecGeneator::forced_import(path, name, compressed, options)?,
|
||||
decadeindex: ComputedVecBuilder::forced_import(path, name, compressed, options)?,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn compute(
|
||||
pub fn compute<F>(
|
||||
&mut self,
|
||||
source: &mut StorableVec<Height, T>,
|
||||
mut compute: F,
|
||||
indexes: &mut indexes::Vecs,
|
||||
starting_indexes: &Indexes,
|
||||
exit: &Exit,
|
||||
) -> color_eyre::Result<()> {
|
||||
) -> color_eyre::Result<()>
|
||||
where
|
||||
F: FnMut(&mut ComputedVec<Height, T>) -> Result<()>,
|
||||
{
|
||||
compute(&mut self.height)?;
|
||||
|
||||
self.dateindex.compute(
|
||||
starting_indexes.dateindex,
|
||||
source,
|
||||
&mut self.height,
|
||||
indexes.dateindex_to_first_height.mut_vec(),
|
||||
indexes.dateindex_to_last_height.mut_vec(),
|
||||
exit,
|
||||
@@ -108,7 +123,7 @@ where
|
||||
|
||||
self.difficultyepoch.compute(
|
||||
starting_indexes.difficultyepoch,
|
||||
source,
|
||||
&mut self.height,
|
||||
indexes.difficultyepoch_to_first_height.mut_vec(),
|
||||
indexes.difficultyepoch_to_last_height.mut_vec(),
|
||||
exit,
|
||||
@@ -117,16 +132,17 @@ where
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn as_any_vecs(&self) -> Vec<&dyn AnyStorableVec> {
|
||||
pub fn any_vecs(&self) -> Vec<&dyn AnyStorableVec> {
|
||||
[
|
||||
self.dateindex.as_any_vecs(),
|
||||
self.weekindex.as_any_vecs(),
|
||||
self.difficultyepoch.as_any_vecs(),
|
||||
self.monthindex.as_any_vecs(),
|
||||
self.quarterindex.as_any_vecs(),
|
||||
self.yearindex.as_any_vecs(),
|
||||
vec![self.height.any_vec()],
|
||||
self.dateindex.any_vecs(),
|
||||
self.weekindex.any_vecs(),
|
||||
self.difficultyepoch.any_vecs(),
|
||||
self.monthindex.any_vecs(),
|
||||
self.quarterindex.any_vecs(),
|
||||
self.yearindex.any_vecs(),
|
||||
// self.halvingepoch.as_any_vecs(),
|
||||
self.decadeindex.as_any_vecs(),
|
||||
self.decadeindex.any_vecs(),
|
||||
]
|
||||
.concat()
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
use std::path::Path;
|
||||
|
||||
use brk_core::{Difficultyepoch, Height};
|
||||
use brk_exit::Exit;
|
||||
use brk_vec::{AnyStorableVec, Compressed, Result, Version};
|
||||
|
||||
use crate::storage::vecs::{Indexes, base::ComputedVec, indexes};
|
||||
|
||||
use super::{ComputedType, ComputedVecBuilder, StorableVecGeneatorOptions};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ComputedVecsFromHeightStrict<T>
|
||||
where
|
||||
T: ComputedType + PartialOrd,
|
||||
{
|
||||
pub height: ComputedVec<Height, T>,
|
||||
pub difficultyepoch: ComputedVecBuilder<Difficultyepoch, T>,
|
||||
// TODO: pub halvingepoch: StorableVecGeneator<Halvingepoch, T>,
|
||||
}
|
||||
|
||||
impl<T> ComputedVecsFromHeightStrict<T>
|
||||
where
|
||||
T: ComputedType + Ord + From<f64>,
|
||||
f64: From<T>,
|
||||
{
|
||||
pub fn forced_import(
|
||||
path: &Path,
|
||||
name: &str,
|
||||
version: Version,
|
||||
compressed: Compressed,
|
||||
options: StorableVecGeneatorOptions,
|
||||
) -> color_eyre::Result<Self> {
|
||||
let height = ComputedVec::forced_import(
|
||||
&path.join(format!("height_to_{name}")),
|
||||
version,
|
||||
compressed,
|
||||
)?;
|
||||
|
||||
let options = options.remove_percentiles();
|
||||
|
||||
Ok(Self {
|
||||
height,
|
||||
difficultyepoch: ComputedVecBuilder::forced_import(path, name, compressed, options)?,
|
||||
// halvingepoch: StorableVecGeneator::forced_import(path, name, compressed, options)?,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn compute<F>(
|
||||
&mut self,
|
||||
mut compute: F,
|
||||
indexes: &mut indexes::Vecs,
|
||||
starting_indexes: &Indexes,
|
||||
exit: &Exit,
|
||||
) -> color_eyre::Result<()>
|
||||
where
|
||||
F: FnMut(&mut ComputedVec<Height, T>) -> Result<()>,
|
||||
{
|
||||
compute(&mut self.height)?;
|
||||
|
||||
self.difficultyepoch.compute(
|
||||
starting_indexes.difficultyepoch,
|
||||
&mut self.height,
|
||||
indexes.difficultyepoch_to_first_height.mut_vec(),
|
||||
indexes.difficultyepoch_to_last_height.mut_vec(),
|
||||
exit,
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn any_vecs(&self) -> Vec<&dyn AnyStorableVec> {
|
||||
[
|
||||
vec![self.height.any_vec()],
|
||||
self.difficultyepoch.any_vecs(),
|
||||
// self.halvingepoch.as_any_vecs(),
|
||||
]
|
||||
.concat()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
use std::path::Path;
|
||||
|
||||
use brk_core::{
|
||||
Dateindex, Decadeindex, Difficultyepoch, Height, Monthindex, Quarterindex, Txindex, Weekindex,
|
||||
Yearindex,
|
||||
};
|
||||
use brk_exit::Exit;
|
||||
use brk_indexer::Indexer;
|
||||
use brk_vec::{AnyStorableVec, Compressed, Result, Version};
|
||||
|
||||
use crate::storage::vecs::{Indexes, base::ComputedVec, indexes};
|
||||
|
||||
use super::{ComputedType, ComputedVecBuilder, StorableVecGeneatorOptions};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ComputedVecsFromTxindex<T>
|
||||
where
|
||||
T: ComputedType + PartialOrd,
|
||||
{
|
||||
pub txindex: ComputedVec<Txindex, T>,
|
||||
pub height: ComputedVecBuilder<Height, T>,
|
||||
pub dateindex: ComputedVecBuilder<Dateindex, T>,
|
||||
pub weekindex: ComputedVecBuilder<Weekindex, T>,
|
||||
pub difficultyepoch: ComputedVecBuilder<Difficultyepoch, T>,
|
||||
pub monthindex: ComputedVecBuilder<Monthindex, T>,
|
||||
pub quarterindex: ComputedVecBuilder<Quarterindex, T>,
|
||||
pub yearindex: ComputedVecBuilder<Yearindex, T>,
|
||||
// TODO: pub halvingepoch: StorableVecGeneator<Halvingepoch, T>,
|
||||
pub decadeindex: ComputedVecBuilder<Decadeindex, T>,
|
||||
}
|
||||
|
||||
impl<T> ComputedVecsFromTxindex<T>
|
||||
where
|
||||
T: ComputedType + Ord + From<f64>,
|
||||
f64: From<T>,
|
||||
{
|
||||
pub fn forced_import(
|
||||
path: &Path,
|
||||
name: &str,
|
||||
version: Version,
|
||||
compressed: Compressed,
|
||||
options: StorableVecGeneatorOptions,
|
||||
) -> color_eyre::Result<Self> {
|
||||
let txindex = ComputedVec::forced_import(
|
||||
&path.join(format!("txindex_to_{name}")),
|
||||
version,
|
||||
compressed,
|
||||
)?;
|
||||
|
||||
let height = ComputedVecBuilder::forced_import(path, name, compressed, options)?;
|
||||
let dateindex = ComputedVecBuilder::forced_import(path, name, compressed, options)?;
|
||||
|
||||
let options = options.remove_percentiles();
|
||||
|
||||
Ok(Self {
|
||||
txindex,
|
||||
height,
|
||||
dateindex,
|
||||
weekindex: ComputedVecBuilder::forced_import(path, name, compressed, options)?,
|
||||
difficultyepoch: ComputedVecBuilder::forced_import(path, name, compressed, options)?,
|
||||
monthindex: ComputedVecBuilder::forced_import(path, name, compressed, options)?,
|
||||
quarterindex: ComputedVecBuilder::forced_import(path, name, compressed, options)?,
|
||||
yearindex: ComputedVecBuilder::forced_import(path, name, compressed, options)?,
|
||||
// halvingepoch: StorableVecGeneator::forced_import(path, name, compressed, options)?,
|
||||
decadeindex: ComputedVecBuilder::forced_import(path, name, compressed, options)?,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn compute<F>(
|
||||
&mut self,
|
||||
mut compute: F,
|
||||
indexer: &mut Indexer,
|
||||
indexes: &mut indexes::Vecs,
|
||||
starting_indexes: &Indexes,
|
||||
exit: &Exit,
|
||||
) -> color_eyre::Result<()>
|
||||
where
|
||||
F: FnMut(&mut ComputedVec<Txindex, T>) -> Result<()>,
|
||||
{
|
||||
compute(&mut self.txindex)?;
|
||||
|
||||
self.height.compute(
|
||||
starting_indexes.height,
|
||||
&mut self.txindex,
|
||||
indexer.mut_vecs().height_to_first_txindex.mut_vec(),
|
||||
indexes.height_to_last_txindex.mut_vec(),
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.dateindex.from_aligned(
|
||||
starting_indexes.dateindex,
|
||||
&mut self.height,
|
||||
indexes.dateindex_to_first_height.mut_vec(),
|
||||
indexes.dateindex_to_last_height.mut_vec(),
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.weekindex.from_aligned(
|
||||
starting_indexes.weekindex,
|
||||
&mut self.dateindex,
|
||||
indexes.weekindex_to_first_dateindex.mut_vec(),
|
||||
indexes.weekindex_to_last_dateindex.mut_vec(),
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.monthindex.from_aligned(
|
||||
starting_indexes.monthindex,
|
||||
&mut self.dateindex,
|
||||
indexes.monthindex_to_first_dateindex.mut_vec(),
|
||||
indexes.monthindex_to_last_dateindex.mut_vec(),
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.quarterindex.from_aligned(
|
||||
starting_indexes.quarterindex,
|
||||
&mut self.monthindex,
|
||||
indexes.quarterindex_to_first_monthindex.mut_vec(),
|
||||
indexes.quarterindex_to_last_monthindex.mut_vec(),
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.yearindex.from_aligned(
|
||||
starting_indexes.yearindex,
|
||||
&mut self.monthindex,
|
||||
indexes.yearindex_to_first_monthindex.mut_vec(),
|
||||
indexes.yearindex_to_last_monthindex.mut_vec(),
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.decadeindex.from_aligned(
|
||||
starting_indexes.decadeindex,
|
||||
&mut self.yearindex,
|
||||
indexes.decadeindex_to_first_yearindex.mut_vec(),
|
||||
indexes.decadeindex_to_last_yearindex.mut_vec(),
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.difficultyepoch.from_aligned(
|
||||
starting_indexes.difficultyepoch,
|
||||
&mut self.height,
|
||||
indexes.difficultyepoch_to_first_height.mut_vec(),
|
||||
indexes.difficultyepoch_to_last_height.mut_vec(),
|
||||
exit,
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn any_vecs(&self) -> Vec<&dyn AnyStorableVec> {
|
||||
[
|
||||
vec![self.txindex.any_vec()],
|
||||
self.height.any_vecs(),
|
||||
self.dateindex.any_vecs(),
|
||||
self.weekindex.any_vecs(),
|
||||
self.difficultyepoch.any_vecs(),
|
||||
self.monthindex.any_vecs(),
|
||||
self.quarterindex.any_vecs(),
|
||||
self.yearindex.any_vecs(),
|
||||
// self.halvingepoch.as_any_vecs(),
|
||||
self.decadeindex.any_vecs(),
|
||||
]
|
||||
.concat()
|
||||
}
|
||||
}
|
||||
+6
-4
@@ -1,11 +1,13 @@
|
||||
mod from_date;
|
||||
mod builder;
|
||||
mod from_dateindex;
|
||||
mod from_height;
|
||||
mod from_height_strict;
|
||||
mod generic;
|
||||
mod from_txindex;
|
||||
mod stored_type;
|
||||
|
||||
pub use from_date::*;
|
||||
pub use builder::*;
|
||||
pub use from_dateindex::*;
|
||||
pub use from_height::*;
|
||||
pub use from_height_strict::*;
|
||||
pub use generic::*;
|
||||
pub use from_txindex::*;
|
||||
pub use stored_type::*;
|
||||
@@ -8,60 +8,60 @@ use brk_exit::Exit;
|
||||
use brk_indexer::Indexer;
|
||||
use brk_vec::{AnyStorableVec, Compressed, Version};
|
||||
|
||||
use super::StorableVec;
|
||||
use super::ComputedVec;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Vecs {
|
||||
// pub height_to_last_addressindex: StorableVec<Height, Addressindex>,
|
||||
// pub height_to_last_txoutindex: StorableVec<Height, Txoutindex>,
|
||||
pub dateindex_to_date: StorableVec<Dateindex, Date>,
|
||||
pub dateindex_to_dateindex: StorableVec<Dateindex, Dateindex>,
|
||||
pub dateindex_to_first_height: StorableVec<Dateindex, Height>,
|
||||
pub dateindex_to_last_height: StorableVec<Dateindex, Height>,
|
||||
pub dateindex_to_monthindex: StorableVec<Dateindex, Monthindex>,
|
||||
pub dateindex_to_timestamp: StorableVec<Dateindex, Timestamp>,
|
||||
pub dateindex_to_weekindex: StorableVec<Dateindex, Weekindex>,
|
||||
pub decadeindex_to_decadeindex: StorableVec<Decadeindex, Decadeindex>,
|
||||
pub decadeindex_to_first_yearindex: StorableVec<Decadeindex, Yearindex>,
|
||||
pub decadeindex_to_last_yearindex: StorableVec<Decadeindex, Yearindex>,
|
||||
pub decadeindex_to_timestamp: StorableVec<Decadeindex, Timestamp>,
|
||||
pub difficultyepoch_to_difficultyepoch: StorableVec<Difficultyepoch, Difficultyepoch>,
|
||||
pub difficultyepoch_to_first_height: StorableVec<Difficultyepoch, Height>,
|
||||
pub difficultyepoch_to_last_height: StorableVec<Difficultyepoch, Height>,
|
||||
pub difficultyepoch_to_timestamp: StorableVec<Difficultyepoch, Timestamp>,
|
||||
pub halvingepoch_to_first_height: StorableVec<Halvingepoch, Height>,
|
||||
pub halvingepoch_to_halvingepoch: StorableVec<Halvingepoch, Halvingepoch>,
|
||||
pub halvingepoch_to_last_height: StorableVec<Halvingepoch, Height>,
|
||||
pub halvingepoch_to_timestamp: StorableVec<Halvingepoch, Timestamp>,
|
||||
pub height_to_dateindex: StorableVec<Height, Dateindex>,
|
||||
pub height_to_difficultyepoch: StorableVec<Height, Difficultyepoch>,
|
||||
pub height_to_fixed_date: StorableVec<Height, Date>,
|
||||
pub height_to_fixed_timestamp: StorableVec<Height, Timestamp>,
|
||||
pub height_to_halvingepoch: StorableVec<Height, Halvingepoch>,
|
||||
pub height_to_height: StorableVec<Height, Height>,
|
||||
pub height_to_last_txindex: StorableVec<Height, Txindex>,
|
||||
pub height_to_real_date: StorableVec<Height, Date>,
|
||||
pub monthindex_to_first_dateindex: StorableVec<Monthindex, Dateindex>,
|
||||
pub monthindex_to_last_dateindex: StorableVec<Monthindex, Dateindex>,
|
||||
pub monthindex_to_monthindex: StorableVec<Monthindex, Monthindex>,
|
||||
pub monthindex_to_quarterindex: StorableVec<Monthindex, Quarterindex>,
|
||||
pub monthindex_to_timestamp: StorableVec<Monthindex, Timestamp>,
|
||||
pub monthindex_to_yearindex: StorableVec<Monthindex, Yearindex>,
|
||||
pub quarterindex_to_first_monthindex: StorableVec<Quarterindex, Monthindex>,
|
||||
pub quarterindex_to_last_monthindex: StorableVec<Quarterindex, Monthindex>,
|
||||
pub quarterindex_to_quarterindex: StorableVec<Quarterindex, Quarterindex>,
|
||||
pub quarterindex_to_timestamp: StorableVec<Quarterindex, Timestamp>,
|
||||
pub txindex_to_last_txinindex: StorableVec<Txindex, Txinindex>,
|
||||
pub txindex_to_last_txoutindex: StorableVec<Txindex, Txoutindex>,
|
||||
pub weekindex_to_first_dateindex: StorableVec<Weekindex, Dateindex>,
|
||||
pub weekindex_to_last_dateindex: StorableVec<Weekindex, Dateindex>,
|
||||
pub weekindex_to_timestamp: StorableVec<Weekindex, Timestamp>,
|
||||
pub weekindex_to_weekindex: StorableVec<Weekindex, Weekindex>,
|
||||
pub yearindex_to_decadeindex: StorableVec<Yearindex, Decadeindex>,
|
||||
pub yearindex_to_first_monthindex: StorableVec<Yearindex, Monthindex>,
|
||||
pub yearindex_to_last_monthindex: StorableVec<Yearindex, Monthindex>,
|
||||
pub yearindex_to_timestamp: StorableVec<Yearindex, Timestamp>,
|
||||
pub yearindex_to_yearindex: StorableVec<Yearindex, Yearindex>,
|
||||
pub dateindex_to_date: ComputedVec<Dateindex, Date>,
|
||||
pub dateindex_to_dateindex: ComputedVec<Dateindex, Dateindex>,
|
||||
pub dateindex_to_first_height: ComputedVec<Dateindex, Height>,
|
||||
pub dateindex_to_last_height: ComputedVec<Dateindex, Height>,
|
||||
pub dateindex_to_monthindex: ComputedVec<Dateindex, Monthindex>,
|
||||
pub dateindex_to_timestamp: ComputedVec<Dateindex, Timestamp>,
|
||||
pub dateindex_to_weekindex: ComputedVec<Dateindex, Weekindex>,
|
||||
pub decadeindex_to_decadeindex: ComputedVec<Decadeindex, Decadeindex>,
|
||||
pub decadeindex_to_first_yearindex: ComputedVec<Decadeindex, Yearindex>,
|
||||
pub decadeindex_to_last_yearindex: ComputedVec<Decadeindex, Yearindex>,
|
||||
pub decadeindex_to_timestamp: ComputedVec<Decadeindex, Timestamp>,
|
||||
pub difficultyepoch_to_difficultyepoch: ComputedVec<Difficultyepoch, Difficultyepoch>,
|
||||
pub difficultyepoch_to_first_height: ComputedVec<Difficultyepoch, Height>,
|
||||
pub difficultyepoch_to_last_height: ComputedVec<Difficultyepoch, Height>,
|
||||
pub difficultyepoch_to_timestamp: ComputedVec<Difficultyepoch, Timestamp>,
|
||||
pub halvingepoch_to_first_height: ComputedVec<Halvingepoch, Height>,
|
||||
pub halvingepoch_to_halvingepoch: ComputedVec<Halvingepoch, Halvingepoch>,
|
||||
pub halvingepoch_to_last_height: ComputedVec<Halvingepoch, Height>,
|
||||
pub halvingepoch_to_timestamp: ComputedVec<Halvingepoch, Timestamp>,
|
||||
pub height_to_dateindex: ComputedVec<Height, Dateindex>,
|
||||
pub height_to_difficultyepoch: ComputedVec<Height, Difficultyepoch>,
|
||||
pub height_to_fixed_date: ComputedVec<Height, Date>,
|
||||
pub height_to_fixed_timestamp: ComputedVec<Height, Timestamp>,
|
||||
pub height_to_halvingepoch: ComputedVec<Height, Halvingepoch>,
|
||||
pub height_to_height: ComputedVec<Height, Height>,
|
||||
pub height_to_last_txindex: ComputedVec<Height, Txindex>,
|
||||
pub height_to_real_date: ComputedVec<Height, Date>,
|
||||
pub monthindex_to_first_dateindex: ComputedVec<Monthindex, Dateindex>,
|
||||
pub monthindex_to_last_dateindex: ComputedVec<Monthindex, Dateindex>,
|
||||
pub monthindex_to_monthindex: ComputedVec<Monthindex, Monthindex>,
|
||||
pub monthindex_to_quarterindex: ComputedVec<Monthindex, Quarterindex>,
|
||||
pub monthindex_to_timestamp: ComputedVec<Monthindex, Timestamp>,
|
||||
pub monthindex_to_yearindex: ComputedVec<Monthindex, Yearindex>,
|
||||
pub quarterindex_to_first_monthindex: ComputedVec<Quarterindex, Monthindex>,
|
||||
pub quarterindex_to_last_monthindex: ComputedVec<Quarterindex, Monthindex>,
|
||||
pub quarterindex_to_quarterindex: ComputedVec<Quarterindex, Quarterindex>,
|
||||
pub quarterindex_to_timestamp: ComputedVec<Quarterindex, Timestamp>,
|
||||
pub txindex_to_last_txinindex: ComputedVec<Txindex, Txinindex>,
|
||||
pub txindex_to_last_txoutindex: ComputedVec<Txindex, Txoutindex>,
|
||||
pub weekindex_to_first_dateindex: ComputedVec<Weekindex, Dateindex>,
|
||||
pub weekindex_to_last_dateindex: ComputedVec<Weekindex, Dateindex>,
|
||||
pub weekindex_to_timestamp: ComputedVec<Weekindex, Timestamp>,
|
||||
pub weekindex_to_weekindex: ComputedVec<Weekindex, Weekindex>,
|
||||
pub yearindex_to_decadeindex: ComputedVec<Yearindex, Decadeindex>,
|
||||
pub yearindex_to_first_monthindex: ComputedVec<Yearindex, Monthindex>,
|
||||
pub yearindex_to_last_monthindex: ComputedVec<Yearindex, Monthindex>,
|
||||
pub yearindex_to_timestamp: ComputedVec<Yearindex, Timestamp>,
|
||||
pub yearindex_to_yearindex: ComputedVec<Yearindex, Yearindex>,
|
||||
}
|
||||
|
||||
impl Vecs {
|
||||
@@ -69,242 +69,242 @@ impl Vecs {
|
||||
fs::create_dir_all(path)?;
|
||||
|
||||
Ok(Self {
|
||||
dateindex_to_date: StorableVec::forced_import(
|
||||
dateindex_to_date: ComputedVec::forced_import(
|
||||
&path.join("dateindex_to_date"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
dateindex_to_dateindex: StorableVec::forced_import(
|
||||
dateindex_to_dateindex: ComputedVec::forced_import(
|
||||
&path.join("dateindex_to_dateindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
dateindex_to_first_height: StorableVec::forced_import(
|
||||
dateindex_to_first_height: ComputedVec::forced_import(
|
||||
&path.join("dateindex_to_first_height"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
dateindex_to_last_height: StorableVec::forced_import(
|
||||
dateindex_to_last_height: ComputedVec::forced_import(
|
||||
&path.join("dateindex_to_last_height"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_real_date: StorableVec::forced_import(
|
||||
height_to_real_date: ComputedVec::forced_import(
|
||||
&path.join("height_to_real_date"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_fixed_date: StorableVec::forced_import(
|
||||
height_to_fixed_date: ComputedVec::forced_import(
|
||||
&path.join("height_to_fixed_date"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_dateindex: StorableVec::forced_import(
|
||||
height_to_dateindex: ComputedVec::forced_import(
|
||||
&path.join("height_to_dateindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_height: StorableVec::forced_import(
|
||||
height_to_height: ComputedVec::forced_import(
|
||||
&path.join("height_to_height"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_last_txindex: StorableVec::forced_import(
|
||||
height_to_last_txindex: ComputedVec::forced_import(
|
||||
&path.join("height_to_last_txindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
txindex_to_last_txinindex: StorableVec::forced_import(
|
||||
txindex_to_last_txinindex: ComputedVec::forced_import(
|
||||
&path.join("txindex_to_last_txinindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
txindex_to_last_txoutindex: StorableVec::forced_import(
|
||||
txindex_to_last_txoutindex: ComputedVec::forced_import(
|
||||
&path.join("txindex_to_last_txoutindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
difficultyepoch_to_first_height: StorableVec::forced_import(
|
||||
difficultyepoch_to_first_height: ComputedVec::forced_import(
|
||||
&path.join("difficultyepoch_to_first_height"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
difficultyepoch_to_last_height: StorableVec::forced_import(
|
||||
difficultyepoch_to_last_height: ComputedVec::forced_import(
|
||||
&path.join("difficultyepoch_to_last_height"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
halvingepoch_to_first_height: StorableVec::forced_import(
|
||||
halvingepoch_to_first_height: ComputedVec::forced_import(
|
||||
&path.join("halvingepoch_to_first_height"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
halvingepoch_to_last_height: StorableVec::forced_import(
|
||||
halvingepoch_to_last_height: ComputedVec::forced_import(
|
||||
&path.join("halvingepoch_to_last_height"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
weekindex_to_first_dateindex: StorableVec::forced_import(
|
||||
weekindex_to_first_dateindex: ComputedVec::forced_import(
|
||||
&path.join("weekindex_to_first_dateindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
weekindex_to_last_dateindex: StorableVec::forced_import(
|
||||
weekindex_to_last_dateindex: ComputedVec::forced_import(
|
||||
&path.join("weekindex_to_last_dateindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
monthindex_to_first_dateindex: StorableVec::forced_import(
|
||||
monthindex_to_first_dateindex: ComputedVec::forced_import(
|
||||
&path.join("monthindex_to_first_dateindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
monthindex_to_last_dateindex: StorableVec::forced_import(
|
||||
monthindex_to_last_dateindex: ComputedVec::forced_import(
|
||||
&path.join("monthindex_to_last_dateindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
yearindex_to_first_monthindex: StorableVec::forced_import(
|
||||
yearindex_to_first_monthindex: ComputedVec::forced_import(
|
||||
&path.join("yearindex_to_first_monthindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
yearindex_to_last_monthindex: StorableVec::forced_import(
|
||||
yearindex_to_last_monthindex: ComputedVec::forced_import(
|
||||
&path.join("yearindex_to_last_monthindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
decadeindex_to_first_yearindex: StorableVec::forced_import(
|
||||
decadeindex_to_first_yearindex: ComputedVec::forced_import(
|
||||
&path.join("decadeindex_to_first_yearindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
decadeindex_to_last_yearindex: StorableVec::forced_import(
|
||||
decadeindex_to_last_yearindex: ComputedVec::forced_import(
|
||||
&path.join("decadeindex_to_last_yearindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
dateindex_to_weekindex: StorableVec::forced_import(
|
||||
dateindex_to_weekindex: ComputedVec::forced_import(
|
||||
&path.join("dateindex_to_weekindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
dateindex_to_monthindex: StorableVec::forced_import(
|
||||
dateindex_to_monthindex: ComputedVec::forced_import(
|
||||
&path.join("dateindex_to_monthindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
monthindex_to_yearindex: StorableVec::forced_import(
|
||||
monthindex_to_yearindex: ComputedVec::forced_import(
|
||||
&path.join("monthindex_to_yearindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
yearindex_to_decadeindex: StorableVec::forced_import(
|
||||
yearindex_to_decadeindex: ComputedVec::forced_import(
|
||||
&path.join("yearindex_to_decadeindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_difficultyepoch: StorableVec::forced_import(
|
||||
height_to_difficultyepoch: ComputedVec::forced_import(
|
||||
&path.join("height_to_difficultyepoch"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_halvingepoch: StorableVec::forced_import(
|
||||
height_to_halvingepoch: ComputedVec::forced_import(
|
||||
&path.join("height_to_halvingepoch"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
weekindex_to_weekindex: StorableVec::forced_import(
|
||||
weekindex_to_weekindex: ComputedVec::forced_import(
|
||||
&path.join("weekindex_to_weekindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
monthindex_to_monthindex: StorableVec::forced_import(
|
||||
monthindex_to_monthindex: ComputedVec::forced_import(
|
||||
&path.join("monthindex_to_monthindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
yearindex_to_yearindex: StorableVec::forced_import(
|
||||
yearindex_to_yearindex: ComputedVec::forced_import(
|
||||
&path.join("yearindex_to_yearindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
decadeindex_to_decadeindex: StorableVec::forced_import(
|
||||
decadeindex_to_decadeindex: ComputedVec::forced_import(
|
||||
&path.join("decadeindex_to_decadeindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
difficultyepoch_to_difficultyepoch: StorableVec::forced_import(
|
||||
difficultyepoch_to_difficultyepoch: ComputedVec::forced_import(
|
||||
&path.join("difficultyepoch_to_difficultyepoch"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
halvingepoch_to_halvingepoch: StorableVec::forced_import(
|
||||
halvingepoch_to_halvingepoch: ComputedVec::forced_import(
|
||||
&path.join("halvingepoch_to_halvingepoch"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
dateindex_to_timestamp: StorableVec::forced_import(
|
||||
dateindex_to_timestamp: ComputedVec::forced_import(
|
||||
&path.join("dateindex_to_timestamp"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
decadeindex_to_timestamp: StorableVec::forced_import(
|
||||
decadeindex_to_timestamp: ComputedVec::forced_import(
|
||||
&path.join("decadeindex_to_timestamp"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
difficultyepoch_to_timestamp: StorableVec::forced_import(
|
||||
difficultyepoch_to_timestamp: ComputedVec::forced_import(
|
||||
&path.join("difficultyepoch_to_timestamp"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
halvingepoch_to_timestamp: StorableVec::forced_import(
|
||||
halvingepoch_to_timestamp: ComputedVec::forced_import(
|
||||
&path.join("halvingepoch_to_timestamp"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
monthindex_to_timestamp: StorableVec::forced_import(
|
||||
monthindex_to_timestamp: ComputedVec::forced_import(
|
||||
&path.join("monthindex_to_timestamp"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
weekindex_to_timestamp: StorableVec::forced_import(
|
||||
weekindex_to_timestamp: ComputedVec::forced_import(
|
||||
&path.join("weekindex_to_timestamp"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
yearindex_to_timestamp: StorableVec::forced_import(
|
||||
yearindex_to_timestamp: ComputedVec::forced_import(
|
||||
&path.join("yearindex_to_timestamp"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_fixed_timestamp: StorableVec::forced_import(
|
||||
height_to_fixed_timestamp: ComputedVec::forced_import(
|
||||
&path.join("height_to_fixed_timestamp"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
monthindex_to_quarterindex: StorableVec::forced_import(
|
||||
monthindex_to_quarterindex: ComputedVec::forced_import(
|
||||
&path.join("monthindex_to_quarterindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
quarterindex_to_first_monthindex: StorableVec::forced_import(
|
||||
quarterindex_to_first_monthindex: ComputedVec::forced_import(
|
||||
&path.join("quarterindex_to_first_monthindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
quarterindex_to_last_monthindex: StorableVec::forced_import(
|
||||
quarterindex_to_last_monthindex: ComputedVec::forced_import(
|
||||
&path.join("quarterindex_to_last_monthindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
quarterindex_to_quarterindex: StorableVec::forced_import(
|
||||
quarterindex_to_quarterindex: ComputedVec::forced_import(
|
||||
&path.join("quarterindex_to_quarterindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
quarterindex_to_timestamp: StorableVec::forced_import(
|
||||
quarterindex_to_timestamp: ComputedVec::forced_import(
|
||||
&path.join("quarterindex_to_timestamp"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
|
||||
@@ -10,53 +10,45 @@ use brk_indexer::Indexer;
|
||||
use brk_vec::{AnyStorableVec, Compressed, Version};
|
||||
|
||||
use super::{
|
||||
Indexes, StorableVec, indexes,
|
||||
stats::{
|
||||
StorableVecGeneatorOptions, StorableVecsStatsFromDate, StorableVecsStatsFromHeightStrict,
|
||||
ComputedVec, Indexes,
|
||||
grouped::{
|
||||
ComputedVecsFromDateindex, ComputedVecsFromHeightStrict, StorableVecGeneatorOptions,
|
||||
},
|
||||
indexes,
|
||||
};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Vecs {
|
||||
pub dateindex_to_close: StorableVec<Dateindex, Close<Dollars>>,
|
||||
pub dateindex_to_close_in_cents: StorableVec<Dateindex, Close<Cents>>,
|
||||
pub dateindex_to_high: StorableVec<Dateindex, High<Dollars>>,
|
||||
pub dateindex_to_high_in_cents: StorableVec<Dateindex, High<Cents>>,
|
||||
pub dateindex_to_low: StorableVec<Dateindex, Low<Dollars>>,
|
||||
pub dateindex_to_low_in_cents: StorableVec<Dateindex, Low<Cents>>,
|
||||
pub dateindex_to_ohlc: StorableVec<Dateindex, OHLCDollars>,
|
||||
pub dateindex_to_ohlc_in_cents: StorableVec<Dateindex, OHLCCents>,
|
||||
pub dateindex_to_open: StorableVec<Dateindex, Open<Dollars>>,
|
||||
pub dateindex_to_open_in_cents: StorableVec<Dateindex, Open<Cents>>,
|
||||
pub dateindex_to_sats_per_dollar: StorableVec<Dateindex, Close<Sats>>,
|
||||
pub height_to_close: StorableVec<Height, Close<Dollars>>,
|
||||
pub height_to_close_in_cents: StorableVec<Height, Close<Cents>>,
|
||||
pub height_to_high: StorableVec<Height, High<Dollars>>,
|
||||
pub height_to_high_in_cents: StorableVec<Height, High<Cents>>,
|
||||
pub height_to_low: StorableVec<Height, Low<Dollars>>,
|
||||
pub height_to_low_in_cents: StorableVec<Height, Low<Cents>>,
|
||||
pub height_to_ohlc: StorableVec<Height, OHLCDollars>,
|
||||
pub height_to_ohlc_in_cents: StorableVec<Height, OHLCCents>,
|
||||
pub height_to_open: StorableVec<Height, Open<Dollars>>,
|
||||
pub height_to_open_in_cents: StorableVec<Height, Open<Cents>>,
|
||||
pub height_to_sats_per_dollar: StorableVec<Height, Close<Sats>>,
|
||||
pub timeindexes_to_close: StorableVecsStatsFromDate<Close<Dollars>>,
|
||||
pub timeindexes_to_high: StorableVecsStatsFromDate<High<Dollars>>,
|
||||
pub timeindexes_to_low: StorableVecsStatsFromDate<Low<Dollars>>,
|
||||
pub timeindexes_to_open: StorableVecsStatsFromDate<Open<Dollars>>,
|
||||
pub timeindexes_to_sats_per_dollar: StorableVecsStatsFromDate<Close<Sats>>,
|
||||
pub chainindexes_to_close: StorableVecsStatsFromHeightStrict<Close<Dollars>>,
|
||||
pub chainindexes_to_high: StorableVecsStatsFromHeightStrict<High<Dollars>>,
|
||||
pub chainindexes_to_low: StorableVecsStatsFromHeightStrict<Low<Dollars>>,
|
||||
pub chainindexes_to_open: StorableVecsStatsFromHeightStrict<Open<Dollars>>,
|
||||
pub chainindexes_to_sats_per_dollar: StorableVecsStatsFromHeightStrict<Close<Sats>>,
|
||||
pub weekindex_to_ohlc: StorableVec<Weekindex, OHLCDollars>,
|
||||
pub difficultyepoch_to_ohlc: StorableVec<Difficultyepoch, OHLCDollars>,
|
||||
pub monthindex_to_ohlc: StorableVec<Monthindex, OHLCDollars>,
|
||||
pub quarterindex_to_ohlc: StorableVec<Quarterindex, OHLCDollars>,
|
||||
pub yearindex_to_ohlc: StorableVec<Yearindex, OHLCDollars>,
|
||||
// pub dateindex_to_close: ComputedVec<Dateindex, Close<Dollars>>,
|
||||
pub dateindex_to_close_in_cents: ComputedVec<Dateindex, Close<Cents>>,
|
||||
pub dateindex_to_high_in_cents: ComputedVec<Dateindex, High<Cents>>,
|
||||
pub dateindex_to_low_in_cents: ComputedVec<Dateindex, Low<Cents>>,
|
||||
pub dateindex_to_ohlc: ComputedVec<Dateindex, OHLCDollars>,
|
||||
pub dateindex_to_ohlc_in_cents: ComputedVec<Dateindex, OHLCCents>,
|
||||
pub dateindex_to_open_in_cents: ComputedVec<Dateindex, Open<Cents>>,
|
||||
pub height_to_close_in_cents: ComputedVec<Height, Close<Cents>>,
|
||||
pub height_to_high_in_cents: ComputedVec<Height, High<Cents>>,
|
||||
pub height_to_low_in_cents: ComputedVec<Height, Low<Cents>>,
|
||||
pub height_to_ohlc: ComputedVec<Height, OHLCDollars>,
|
||||
pub height_to_ohlc_in_cents: ComputedVec<Height, OHLCCents>,
|
||||
pub height_to_open_in_cents: ComputedVec<Height, Open<Cents>>,
|
||||
pub timeindexes_to_close: ComputedVecsFromDateindex<Close<Dollars>>,
|
||||
pub timeindexes_to_high: ComputedVecsFromDateindex<High<Dollars>>,
|
||||
pub timeindexes_to_low: ComputedVecsFromDateindex<Low<Dollars>>,
|
||||
pub timeindexes_to_open: ComputedVecsFromDateindex<Open<Dollars>>,
|
||||
pub timeindexes_to_sats_per_dollar: ComputedVecsFromDateindex<Close<Sats>>,
|
||||
pub chainindexes_to_close: ComputedVecsFromHeightStrict<Close<Dollars>>,
|
||||
pub chainindexes_to_high: ComputedVecsFromHeightStrict<High<Dollars>>,
|
||||
pub chainindexes_to_low: ComputedVecsFromHeightStrict<Low<Dollars>>,
|
||||
pub chainindexes_to_open: ComputedVecsFromHeightStrict<Open<Dollars>>,
|
||||
pub chainindexes_to_sats_per_dollar: ComputedVecsFromHeightStrict<Close<Sats>>,
|
||||
pub weekindex_to_ohlc: ComputedVec<Weekindex, OHLCDollars>,
|
||||
pub difficultyepoch_to_ohlc: ComputedVec<Difficultyepoch, OHLCDollars>,
|
||||
pub monthindex_to_ohlc: ComputedVec<Monthindex, OHLCDollars>,
|
||||
pub quarterindex_to_ohlc: ComputedVec<Quarterindex, OHLCDollars>,
|
||||
pub yearindex_to_ohlc: ComputedVec<Yearindex, OHLCDollars>,
|
||||
// pub halvingepoch_to_ohlc: StorableVec<Halvingepoch, OHLCDollars>,
|
||||
pub decadeindex_to_ohlc: StorableVec<Decadeindex, OHLCDollars>,
|
||||
pub decadeindex_to_ohlc: ComputedVec<Decadeindex, OHLCDollars>,
|
||||
}
|
||||
|
||||
impl Vecs {
|
||||
@@ -64,193 +56,163 @@ impl Vecs {
|
||||
fs::create_dir_all(path)?;
|
||||
|
||||
Ok(Self {
|
||||
dateindex_to_ohlc_in_cents: StorableVec::forced_import(
|
||||
dateindex_to_ohlc_in_cents: ComputedVec::forced_import(
|
||||
&path.join("dateindex_to_ohlc_in_cents"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
dateindex_to_ohlc: StorableVec::forced_import(
|
||||
dateindex_to_ohlc: ComputedVec::forced_import(
|
||||
&path.join("dateindex_to_ohlc"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
dateindex_to_close_in_cents: StorableVec::forced_import(
|
||||
dateindex_to_close_in_cents: ComputedVec::forced_import(
|
||||
&path.join("dateindex_to_close_in_cents"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
dateindex_to_close: StorableVec::forced_import(
|
||||
&path.join("dateindex_to_close"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
dateindex_to_high_in_cents: StorableVec::forced_import(
|
||||
dateindex_to_high_in_cents: ComputedVec::forced_import(
|
||||
&path.join("dateindex_to_high_in_cents"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
dateindex_to_high: StorableVec::forced_import(
|
||||
&path.join("dateindex_to_high"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
dateindex_to_low_in_cents: StorableVec::forced_import(
|
||||
dateindex_to_low_in_cents: ComputedVec::forced_import(
|
||||
&path.join("dateindex_to_low_in_cents"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
dateindex_to_low: StorableVec::forced_import(
|
||||
&path.join("dateindex_to_low"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
dateindex_to_open_in_cents: StorableVec::forced_import(
|
||||
dateindex_to_open_in_cents: ComputedVec::forced_import(
|
||||
&path.join("dateindex_to_open_in_cents"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
dateindex_to_open: StorableVec::forced_import(
|
||||
&path.join("dateindex_to_open"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
dateindex_to_sats_per_dollar: StorableVec::forced_import(
|
||||
&path.join("dateindex_to_sats_per_dollar"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_ohlc_in_cents: StorableVec::forced_import(
|
||||
height_to_ohlc_in_cents: ComputedVec::forced_import(
|
||||
&path.join("height_to_ohlc_in_cents"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_ohlc: StorableVec::forced_import(
|
||||
height_to_ohlc: ComputedVec::forced_import(
|
||||
&path.join("height_to_ohlc"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_close_in_cents: StorableVec::forced_import(
|
||||
height_to_close_in_cents: ComputedVec::forced_import(
|
||||
&path.join("height_to_close_in_cents"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_close: StorableVec::forced_import(
|
||||
&path.join("height_to_close"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_high_in_cents: StorableVec::forced_import(
|
||||
height_to_high_in_cents: ComputedVec::forced_import(
|
||||
&path.join("height_to_high_in_cents"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_high: StorableVec::forced_import(
|
||||
&path.join("height_to_high"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_low_in_cents: StorableVec::forced_import(
|
||||
height_to_low_in_cents: ComputedVec::forced_import(
|
||||
&path.join("height_to_low_in_cents"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_low: StorableVec::forced_import(
|
||||
&path.join("height_to_low"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_open_in_cents: StorableVec::forced_import(
|
||||
height_to_open_in_cents: ComputedVec::forced_import(
|
||||
&path.join("height_to_open_in_cents"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_open: StorableVec::forced_import(
|
||||
&path.join("height_to_open"),
|
||||
timeindexes_to_open: ComputedVecsFromDateindex::forced_import(
|
||||
path,
|
||||
"open",
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_sats_per_dollar: StorableVec::forced_import(
|
||||
&path.join("height_to_sats_per_dollar"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
timeindexes_to_open: StorableVecsStatsFromDate::forced_import(
|
||||
&path.join("open"),
|
||||
compressed,
|
||||
StorableVecGeneatorOptions::default().add_first(),
|
||||
)?,
|
||||
timeindexes_to_high: StorableVecsStatsFromDate::forced_import(
|
||||
&path.join("high"),
|
||||
timeindexes_to_high: ComputedVecsFromDateindex::forced_import(
|
||||
path,
|
||||
"high",
|
||||
Version::ONE,
|
||||
compressed,
|
||||
StorableVecGeneatorOptions::default().add_max(),
|
||||
)?,
|
||||
timeindexes_to_low: StorableVecsStatsFromDate::forced_import(
|
||||
&path.join("low"),
|
||||
timeindexes_to_low: ComputedVecsFromDateindex::forced_import(
|
||||
path,
|
||||
"low",
|
||||
Version::ONE,
|
||||
compressed,
|
||||
StorableVecGeneatorOptions::default().add_min(),
|
||||
)?,
|
||||
timeindexes_to_close: StorableVecsStatsFromDate::forced_import(
|
||||
&path.join("close"),
|
||||
timeindexes_to_close: ComputedVecsFromDateindex::forced_import(
|
||||
path,
|
||||
"close",
|
||||
Version::ONE,
|
||||
compressed,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
)?,
|
||||
timeindexes_to_sats_per_dollar: StorableVecsStatsFromDate::forced_import(
|
||||
&path.join("sats_per_dollar"),
|
||||
timeindexes_to_sats_per_dollar: ComputedVecsFromDateindex::forced_import(
|
||||
path,
|
||||
"sats_per_dollar",
|
||||
Version::ONE,
|
||||
compressed,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
)?,
|
||||
chainindexes_to_open: StorableVecsStatsFromHeightStrict::forced_import(
|
||||
&path.join("open"),
|
||||
chainindexes_to_open: ComputedVecsFromHeightStrict::forced_import(
|
||||
path,
|
||||
"open",
|
||||
Version::ONE,
|
||||
compressed,
|
||||
StorableVecGeneatorOptions::default().add_first(),
|
||||
)?,
|
||||
chainindexes_to_high: StorableVecsStatsFromHeightStrict::forced_import(
|
||||
&path.join("high"),
|
||||
chainindexes_to_high: ComputedVecsFromHeightStrict::forced_import(
|
||||
path,
|
||||
"high",
|
||||
Version::ONE,
|
||||
compressed,
|
||||
StorableVecGeneatorOptions::default().add_max(),
|
||||
)?,
|
||||
chainindexes_to_low: StorableVecsStatsFromHeightStrict::forced_import(
|
||||
&path.join("low"),
|
||||
chainindexes_to_low: ComputedVecsFromHeightStrict::forced_import(
|
||||
path,
|
||||
"low",
|
||||
Version::ONE,
|
||||
compressed,
|
||||
StorableVecGeneatorOptions::default().add_min(),
|
||||
)?,
|
||||
chainindexes_to_close: StorableVecsStatsFromHeightStrict::forced_import(
|
||||
&path.join("close"),
|
||||
chainindexes_to_close: ComputedVecsFromHeightStrict::forced_import(
|
||||
path,
|
||||
"close",
|
||||
Version::ONE,
|
||||
compressed,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
)?,
|
||||
chainindexes_to_sats_per_dollar: StorableVecsStatsFromHeightStrict::forced_import(
|
||||
&path.join("sats_per_dollar"),
|
||||
chainindexes_to_sats_per_dollar: ComputedVecsFromHeightStrict::forced_import(
|
||||
path,
|
||||
"sats_per_dollar",
|
||||
Version::ONE,
|
||||
compressed,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
)?,
|
||||
weekindex_to_ohlc: StorableVec::forced_import(
|
||||
weekindex_to_ohlc: ComputedVec::forced_import(
|
||||
&path.join("weekindex_to_ohlc"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
difficultyepoch_to_ohlc: StorableVec::forced_import(
|
||||
difficultyepoch_to_ohlc: ComputedVec::forced_import(
|
||||
&path.join("difficultyepoch_to_ohlc"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
monthindex_to_ohlc: StorableVec::forced_import(
|
||||
monthindex_to_ohlc: ComputedVec::forced_import(
|
||||
&path.join("monthindex_to_ohlc"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
quarterindex_to_ohlc: StorableVec::forced_import(
|
||||
quarterindex_to_ohlc: ComputedVec::forced_import(
|
||||
&path.join("quarterindex_to_ohlc"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
yearindex_to_ohlc: StorableVec::forced_import(
|
||||
yearindex_to_ohlc: ComputedVec::forced_import(
|
||||
&path.join("yearindex_to_ohlc"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
// halvingepoch_to_ohlc: StorableVec::forced_import(&path.join("halvingepoch_to_ohlc"), Version::ONE, compressed)?,
|
||||
decadeindex_to_ohlc: StorableVec::forced_import(
|
||||
decadeindex_to_ohlc: ComputedVec::forced_import(
|
||||
&path.join("decadeindex_to_ohlc"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
@@ -320,41 +282,6 @@ impl Vecs {
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.height_to_open.compute_transform(
|
||||
starting_indexes.height,
|
||||
self.height_to_ohlc.mut_vec(),
|
||||
|(di, ohlc, ..)| (di, ohlc.open),
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.height_to_high.compute_transform(
|
||||
starting_indexes.height,
|
||||
self.height_to_ohlc.mut_vec(),
|
||||
|(di, ohlc, ..)| (di, ohlc.high),
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.height_to_low.compute_transform(
|
||||
starting_indexes.height,
|
||||
self.height_to_ohlc.mut_vec(),
|
||||
|(di, ohlc, ..)| (di, ohlc.low),
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.height_to_close.compute_transform(
|
||||
starting_indexes.height,
|
||||
self.height_to_ohlc.mut_vec(),
|
||||
|(di, ohlc, ..)| (di, ohlc.close),
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.height_to_sats_per_dollar.compute_transform(
|
||||
starting_indexes.height,
|
||||
self.height_to_close.mut_vec(),
|
||||
|(di, close, ..)| (di, Close::from(Sats::ONE_BTC / *close)),
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.dateindex_to_ohlc_in_cents.compute_transform(
|
||||
starting_indexes.dateindex,
|
||||
indexes.dateindex_to_date.mut_vec(),
|
||||
@@ -400,92 +327,113 @@ impl Vecs {
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.dateindex_to_open.compute_transform(
|
||||
starting_indexes.dateindex,
|
||||
self.dateindex_to_ohlc.mut_vec(),
|
||||
|(di, ohlc, ..)| (di, ohlc.open),
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.dateindex_to_high.compute_transform(
|
||||
starting_indexes.dateindex,
|
||||
self.dateindex_to_ohlc.mut_vec(),
|
||||
|(di, ohlc, ..)| (di, ohlc.high),
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.dateindex_to_low.compute_transform(
|
||||
starting_indexes.dateindex,
|
||||
self.dateindex_to_ohlc.mut_vec(),
|
||||
|(di, ohlc, ..)| (di, ohlc.low),
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.dateindex_to_close.compute_transform(
|
||||
starting_indexes.dateindex,
|
||||
self.dateindex_to_ohlc.mut_vec(),
|
||||
|(di, ohlc, ..)| (di, ohlc.close),
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.dateindex_to_sats_per_dollar.compute_transform(
|
||||
starting_indexes.dateindex,
|
||||
self.dateindex_to_close.mut_vec(),
|
||||
|(di, close, ..)| (di, Close::from(Sats::ONE_BTC / *close)),
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.timeindexes_to_close.compute(
|
||||
&mut self.dateindex_to_close,
|
||||
|v| {
|
||||
v.compute_transform(
|
||||
starting_indexes.dateindex,
|
||||
self.dateindex_to_ohlc.mut_vec(),
|
||||
|(di, ohlc, ..)| (di, ohlc.close),
|
||||
exit,
|
||||
)
|
||||
},
|
||||
indexes,
|
||||
starting_indexes,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.timeindexes_to_high.compute(
|
||||
&mut self.dateindex_to_high,
|
||||
|v| {
|
||||
v.compute_transform(
|
||||
starting_indexes.dateindex,
|
||||
self.dateindex_to_ohlc.mut_vec(),
|
||||
|(di, ohlc, ..)| (di, ohlc.high),
|
||||
exit,
|
||||
)
|
||||
},
|
||||
indexes,
|
||||
starting_indexes,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.timeindexes_to_low.compute(
|
||||
&mut self.dateindex_to_low,
|
||||
|v| {
|
||||
v.compute_transform(
|
||||
starting_indexes.dateindex,
|
||||
self.dateindex_to_ohlc.mut_vec(),
|
||||
|(di, ohlc, ..)| (di, ohlc.low),
|
||||
exit,
|
||||
)
|
||||
},
|
||||
indexes,
|
||||
starting_indexes,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.timeindexes_to_open.compute(
|
||||
&mut self.dateindex_to_open,
|
||||
|v| {
|
||||
v.compute_transform(
|
||||
starting_indexes.dateindex,
|
||||
self.dateindex_to_ohlc.mut_vec(),
|
||||
|(di, ohlc, ..)| (di, ohlc.open),
|
||||
exit,
|
||||
)
|
||||
},
|
||||
indexes,
|
||||
starting_indexes,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.chainindexes_to_close.compute(
|
||||
&mut self.height_to_close,
|
||||
|v| {
|
||||
v.compute_transform(
|
||||
starting_indexes.height,
|
||||
self.height_to_ohlc.mut_vec(),
|
||||
|(di, ohlc, ..)| (di, ohlc.close),
|
||||
exit,
|
||||
)
|
||||
},
|
||||
indexes,
|
||||
starting_indexes,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.chainindexes_to_high.compute(
|
||||
&mut self.height_to_high,
|
||||
|v| {
|
||||
v.compute_transform(
|
||||
starting_indexes.height,
|
||||
self.height_to_ohlc.mut_vec(),
|
||||
|(di, ohlc, ..)| (di, ohlc.high),
|
||||
exit,
|
||||
)
|
||||
},
|
||||
indexes,
|
||||
starting_indexes,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.chainindexes_to_low.compute(
|
||||
&mut self.height_to_low,
|
||||
|v| {
|
||||
v.compute_transform(
|
||||
starting_indexes.height,
|
||||
self.height_to_ohlc.mut_vec(),
|
||||
|(di, ohlc, ..)| (di, ohlc.low),
|
||||
exit,
|
||||
)
|
||||
},
|
||||
indexes,
|
||||
starting_indexes,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.chainindexes_to_open.compute(
|
||||
&mut self.height_to_open,
|
||||
|v| {
|
||||
v.compute_transform(
|
||||
starting_indexes.height,
|
||||
self.height_to_ohlc.mut_vec(),
|
||||
|(di, ohlc, ..)| (di, ohlc.open),
|
||||
exit,
|
||||
)
|
||||
},
|
||||
indexes,
|
||||
starting_indexes,
|
||||
exit,
|
||||
@@ -771,34 +719,52 @@ impl Vecs {
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.chainindexes_to_sats_per_dollar.compute(
|
||||
|v| {
|
||||
v.compute_transform(
|
||||
starting_indexes.height,
|
||||
self.chainindexes_to_close.height.mut_vec(),
|
||||
|(i, close, ..)| (i, Close::from(Sats::ONE_BTC / *close)),
|
||||
exit,
|
||||
)
|
||||
},
|
||||
indexes,
|
||||
starting_indexes,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.timeindexes_to_sats_per_dollar.compute(
|
||||
|v| {
|
||||
v.compute_transform(
|
||||
starting_indexes.dateindex,
|
||||
self.timeindexes_to_close.dateindex.mut_vec(),
|
||||
|(i, close, ..)| (i, Close::from(Sats::ONE_BTC / *close)),
|
||||
exit,
|
||||
)
|
||||
},
|
||||
indexes,
|
||||
starting_indexes,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn as_any_vecs(&self) -> Vec<&dyn AnyStorableVec> {
|
||||
vec![
|
||||
vec![
|
||||
self.dateindex_to_close.any_vec(),
|
||||
self.dateindex_to_close_in_cents.any_vec(),
|
||||
self.dateindex_to_high.any_vec(),
|
||||
self.dateindex_to_high_in_cents.any_vec(),
|
||||
self.dateindex_to_low.any_vec(),
|
||||
self.dateindex_to_low_in_cents.any_vec(),
|
||||
self.dateindex_to_ohlc.any_vec(),
|
||||
self.dateindex_to_ohlc_in_cents.any_vec(),
|
||||
self.dateindex_to_open.any_vec(),
|
||||
self.dateindex_to_open_in_cents.any_vec(),
|
||||
self.dateindex_to_sats_per_dollar.any_vec(),
|
||||
self.height_to_close.any_vec(),
|
||||
self.height_to_close_in_cents.any_vec(),
|
||||
self.height_to_high.any_vec(),
|
||||
self.height_to_high_in_cents.any_vec(),
|
||||
self.height_to_low.any_vec(),
|
||||
self.height_to_low_in_cents.any_vec(),
|
||||
self.height_to_ohlc.any_vec(),
|
||||
self.height_to_ohlc_in_cents.any_vec(),
|
||||
self.height_to_open.any_vec(),
|
||||
self.height_to_open_in_cents.any_vec(),
|
||||
self.height_to_sats_per_dollar.any_vec(),
|
||||
self.weekindex_to_ohlc.any_vec(),
|
||||
self.difficultyepoch_to_ohlc.any_vec(),
|
||||
self.monthindex_to_ohlc.any_vec(),
|
||||
@@ -807,14 +773,16 @@ impl Vecs {
|
||||
// self.halvingepoch_to_ohlc.any_vec(),
|
||||
self.decadeindex_to_ohlc.any_vec(),
|
||||
],
|
||||
self.timeindexes_to_close.as_any_vecs(),
|
||||
self.timeindexes_to_high.as_any_vecs(),
|
||||
self.timeindexes_to_low.as_any_vecs(),
|
||||
self.timeindexes_to_open.as_any_vecs(),
|
||||
self.chainindexes_to_close.as_any_vecs(),
|
||||
self.chainindexes_to_high.as_any_vecs(),
|
||||
self.chainindexes_to_low.as_any_vecs(),
|
||||
self.chainindexes_to_open.as_any_vecs(),
|
||||
self.chainindexes_to_sats_per_dollar.any_vecs(),
|
||||
self.timeindexes_to_sats_per_dollar.any_vecs(),
|
||||
self.timeindexes_to_close.any_vecs(),
|
||||
self.timeindexes_to_high.any_vecs(),
|
||||
self.timeindexes_to_low.any_vecs(),
|
||||
self.timeindexes_to_open.any_vecs(),
|
||||
self.chainindexes_to_close.any_vecs(),
|
||||
self.chainindexes_to_high.any_vecs(),
|
||||
self.chainindexes_to_low.any_vecs(),
|
||||
self.chainindexes_to_open.any_vecs(),
|
||||
]
|
||||
.concat()
|
||||
}
|
||||
|
||||
@@ -7,9 +7,9 @@ use brk_vec::{AnyStorableVec, Compressed};
|
||||
|
||||
mod base;
|
||||
mod blocks;
|
||||
mod grouped;
|
||||
mod indexes;
|
||||
mod marketprice;
|
||||
mod stats;
|
||||
mod transactions;
|
||||
|
||||
use base::*;
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
use std::path::Path;
|
||||
|
||||
use brk_core::{Difficultyepoch, Height};
|
||||
use brk_exit::Exit;
|
||||
use brk_vec::{AnyStorableVec, Compressed};
|
||||
|
||||
use crate::storage::vecs::{Indexes, base::StorableVec, indexes};
|
||||
|
||||
use super::{ComputedType, StorableVecBuilder, StorableVecGeneatorOptions};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct StorableVecsStatsFromHeightStrict<T>
|
||||
where
|
||||
T: ComputedType + PartialOrd,
|
||||
{
|
||||
pub difficultyepoch: StorableVecBuilder<Difficultyepoch, T>,
|
||||
// TODO: pub halvingepoch: StorableVecGeneator<Halvingepoch, T>,
|
||||
}
|
||||
|
||||
impl<T> StorableVecsStatsFromHeightStrict<T>
|
||||
where
|
||||
T: ComputedType + Ord + From<f64>,
|
||||
f64: From<T>,
|
||||
{
|
||||
pub fn forced_import(
|
||||
path: &Path,
|
||||
compressed: Compressed,
|
||||
options: StorableVecGeneatorOptions,
|
||||
) -> color_eyre::Result<Self> {
|
||||
let options = options.remove_percentiles();
|
||||
|
||||
Ok(Self {
|
||||
difficultyepoch: StorableVecBuilder::forced_import(path, compressed, options)?,
|
||||
// halvingepoch: StorableVecGeneator::forced_import(path, compressed, options)?,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn compute(
|
||||
&mut self,
|
||||
source: &mut StorableVec<Height, T>,
|
||||
indexes: &mut indexes::Vecs,
|
||||
starting_indexes: &Indexes,
|
||||
exit: &Exit,
|
||||
) -> color_eyre::Result<()> {
|
||||
self.difficultyepoch.compute(
|
||||
starting_indexes.difficultyepoch,
|
||||
source,
|
||||
indexes.difficultyepoch_to_first_height.mut_vec(),
|
||||
indexes.difficultyepoch_to_last_height.mut_vec(),
|
||||
exit,
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn as_any_vecs(&self) -> Vec<&dyn AnyStorableVec> {
|
||||
[
|
||||
self.difficultyepoch.as_any_vecs(),
|
||||
// self.halvingepoch.as_any_vecs(),
|
||||
]
|
||||
.concat()
|
||||
}
|
||||
}
|
||||
@@ -5,27 +5,27 @@ use brk_exit::Exit;
|
||||
use brk_indexer::Indexer;
|
||||
use brk_vec::{AnyStorableVec, Compressed, Version};
|
||||
|
||||
use super::{Indexes, StorableVec, indexes};
|
||||
use super::{ComputedVec, Indexes, indexes};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Vecs {
|
||||
// pub height_to_fee: StorableVec<Txindex, Sats>,
|
||||
// pub height_to_inputcount: StorableVec<Height, u32>,
|
||||
// pub height_to_maxfeerate: StorableVec<Height, Feerate>,
|
||||
// pub height_to_medianfeerate: StorableVec<Height, Feerate>,
|
||||
// pub height_to_minfeerate: StorableVec<Height, Feerate>,
|
||||
// pub height_to_outputcount: StorableVec<Height, u32>,
|
||||
// pub height_to_subsidy: StorableVec<Height, u32>,
|
||||
// pub height_to_totalfees: StorableVec<Height, Sats>,
|
||||
// pub height_to_txcount: StorableVec<Height, u32>,
|
||||
// pub txindex_to_fee: StorableVec<Txindex, Sats>,
|
||||
pub txindex_to_is_coinbase: StorableVec<Txindex, bool>,
|
||||
// pub txindex_to_feerate: StorableVec<Txindex, Feerate>,
|
||||
pub txindex_to_inputs_count: StorableVec<Txindex, u32>,
|
||||
// pub txindex_to_inputs_sum: StorableVec<Txindex, Sats>,
|
||||
pub txindex_to_outputs_count: StorableVec<Txindex, u32>,
|
||||
// pub txindex_to_outputs_sum: StorableVec<Txindex, Sats>,
|
||||
// pub txinindex_to_value: StorableVec<Txinindex, Sats>,
|
||||
// pub height_to_fee: ComputedVec<Txindex, Sats>,
|
||||
// pub height_to_inputcount: ComputedVec<Height, u32>,
|
||||
// pub height_to_maxfeerate: ComputedVec<Height, Feerate>,
|
||||
// pub height_to_medianfeerate: ComputedVec<Height, Feerate>,
|
||||
// pub height_to_minfeerate: ComputedVec<Height, Feerate>,
|
||||
// pub height_to_outputcount: ComputedVec<Height, u32>,
|
||||
// pub height_to_subsidy: ComputedVec<Height, u32>,
|
||||
// pub height_to_totalfees: ComputedVec<Height, Sats>,
|
||||
// pub height_to_txcount: ComputedVec<Height, u32>,
|
||||
// pub txindex_to_fee: ComputedVec<Txindex, Sats>,
|
||||
pub txindex_to_is_coinbase: ComputedVec<Txindex, bool>,
|
||||
// pub txindex_to_feerate: ComputedVec<Txindex, Feerate>,
|
||||
pub txindex_to_inputs_count: ComputedVec<Txindex, u32>,
|
||||
// pub txindex_to_inputs_sum: ComputedVec<Txindex, Sats>,
|
||||
pub txindex_to_outputs_count: ComputedVec<Txindex, u32>,
|
||||
// pub txindex_to_outputs_sum: ComputedVec<Txindex, Sats>,
|
||||
// pub txinindex_to_value: ComputedVec<Txinindex, Sats>,
|
||||
}
|
||||
|
||||
impl Vecs {
|
||||
@@ -52,13 +52,13 @@ impl Vecs {
|
||||
// &path.join("txindex_to_fee"),
|
||||
// Version::ONE,
|
||||
// )?,
|
||||
txindex_to_is_coinbase: StorableVec::forced_import(
|
||||
txindex_to_is_coinbase: ComputedVec::forced_import(
|
||||
&path.join("txindex_to_is_coinbase"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
// txindex_to_feerate: StorableVec::forced_import(&path.join("txindex_to_feerate"), Version::ONE)?,
|
||||
txindex_to_inputs_count: StorableVec::forced_import(
|
||||
txindex_to_inputs_count: ComputedVec::forced_import(
|
||||
&path.join("txindex_to_inputs_count"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
@@ -67,7 +67,7 @@ impl Vecs {
|
||||
// &path.join("txindex_to_inputs_sum"),
|
||||
// Version::ONE,
|
||||
// )?,
|
||||
txindex_to_outputs_count: StorableVec::forced_import(
|
||||
txindex_to_outputs_count: ComputedVec::forced_import(
|
||||
&path.join("txindex_to_outputs_count"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
|
||||
@@ -6,19 +6,19 @@ use std::{
|
||||
};
|
||||
|
||||
use brk_vec::{
|
||||
AnyStorableVec, Compressed, Error, MAX_CACHE_SIZE, MAX_PAGE_SIZE, Result, StoredIndex,
|
||||
StoredType, Value, Version,
|
||||
AnyStorableVec, Compressed, Error, MAX_CACHE_SIZE, MAX_PAGE_SIZE, Result, StorableVec,
|
||||
StoredIndex, StoredType, Value, Version,
|
||||
};
|
||||
|
||||
use super::Height;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct StorableVec<I, T> {
|
||||
pub struct IndexedVec<I, T> {
|
||||
height: Option<Height>,
|
||||
vec: brk_vec::StorableVec<I, T>,
|
||||
vec: StorableVec<I, T>,
|
||||
}
|
||||
|
||||
impl<I, T> StorableVec<I, T>
|
||||
impl<I, T> IndexedVec<I, T>
|
||||
where
|
||||
I: StoredIndex,
|
||||
T: StoredType,
|
||||
@@ -162,7 +162,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<I, T> Clone for StorableVec<I, T>
|
||||
impl<I, T> Clone for IndexedVec<I, T>
|
||||
where
|
||||
I: StoredIndex,
|
||||
T: StoredType,
|
||||
@@ -180,7 +180,7 @@ pub trait AnyIndexedVec: Send + Sync {
|
||||
fn flush(&mut self, height: Height) -> io::Result<()>;
|
||||
}
|
||||
|
||||
impl<I, T> AnyIndexedVec for StorableVec<I, T>
|
||||
impl<I, T> AnyIndexedVec for IndexedVec<I, T>
|
||||
where
|
||||
I: StoredIndex,
|
||||
T: StoredType,
|
||||
|
||||
@@ -18,50 +18,50 @@ pub use base::*;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Vecs {
|
||||
pub addressindex_to_addresstype: StorableVec<Addressindex, Addresstype>,
|
||||
pub addressindex_to_addresstypeindex: StorableVec<Addressindex, Addresstypeindex>,
|
||||
pub addressindex_to_height: StorableVec<Addressindex, Height>,
|
||||
pub height_to_blockhash: StorableVec<Height, BlockHash>,
|
||||
pub height_to_difficulty: StorableVec<Height, f64>,
|
||||
pub height_to_first_addressindex: StorableVec<Height, Addressindex>,
|
||||
pub height_to_first_emptyindex: StorableVec<Height, Emptyindex>,
|
||||
pub height_to_first_multisigindex: StorableVec<Height, Multisigindex>,
|
||||
pub height_to_first_opreturnindex: StorableVec<Height, Opreturnindex>,
|
||||
pub height_to_first_pushonlyindex: StorableVec<Height, Pushonlyindex>,
|
||||
pub height_to_first_txindex: StorableVec<Height, Txindex>,
|
||||
pub height_to_first_txinindex: StorableVec<Height, Txinindex>,
|
||||
pub height_to_first_txoutindex: StorableVec<Height, Txoutindex>,
|
||||
pub height_to_first_unknownindex: StorableVec<Height, Unknownindex>,
|
||||
pub height_to_first_p2pk33index: StorableVec<Height, P2PK33index>,
|
||||
pub height_to_first_p2pk65index: StorableVec<Height, P2PK65index>,
|
||||
pub height_to_first_p2pkhindex: StorableVec<Height, P2PKHindex>,
|
||||
pub height_to_first_p2shindex: StorableVec<Height, P2SHindex>,
|
||||
pub height_to_first_p2trindex: StorableVec<Height, P2TRindex>,
|
||||
pub height_to_first_p2wpkhindex: StorableVec<Height, P2WPKHindex>,
|
||||
pub height_to_first_p2wshindex: StorableVec<Height, P2WSHindex>,
|
||||
pub height_to_size: StorableVec<Height, usize>,
|
||||
pub height_to_timestamp: StorableVec<Height, Timestamp>,
|
||||
pub height_to_weight: StorableVec<Height, Weight>,
|
||||
pub p2pk33index_to_p2pk33addressbytes: StorableVec<P2PK33index, P2PK33AddressBytes>,
|
||||
pub p2pk65index_to_p2pk65addressbytes: StorableVec<P2PK65index, P2PK65AddressBytes>,
|
||||
pub p2pkhindex_to_p2pkhaddressbytes: StorableVec<P2PKHindex, P2PKHAddressBytes>,
|
||||
pub p2shindex_to_p2shaddressbytes: StorableVec<P2SHindex, P2SHAddressBytes>,
|
||||
pub p2trindex_to_p2traddressbytes: StorableVec<P2TRindex, P2TRAddressBytes>,
|
||||
pub p2wpkhindex_to_p2wpkhaddressbytes: StorableVec<P2WPKHindex, P2WPKHAddressBytes>,
|
||||
pub p2wshindex_to_p2wshaddressbytes: StorableVec<P2WSHindex, P2WSHAddressBytes>,
|
||||
pub txindex_to_first_txinindex: StorableVec<Txindex, Txinindex>,
|
||||
pub txindex_to_first_txoutindex: StorableVec<Txindex, Txoutindex>,
|
||||
pub txindex_to_height: StorableVec<Txindex, Height>,
|
||||
pub txindex_to_locktime: StorableVec<Txindex, LockTime>,
|
||||
pub txindex_to_txid: StorableVec<Txindex, Txid>,
|
||||
pub txindex_to_base_size: StorableVec<Txindex, usize>,
|
||||
pub txindex_to_total_size: StorableVec<Txindex, usize>,
|
||||
pub txindex_to_is_explicitly_rbf: StorableVec<Txindex, bool>,
|
||||
pub txindex_to_txversion: StorableVec<Txindex, TxVersion>,
|
||||
pub addressindex_to_addresstype: IndexedVec<Addressindex, Addresstype>,
|
||||
pub addressindex_to_addresstypeindex: IndexedVec<Addressindex, Addresstypeindex>,
|
||||
pub addressindex_to_height: IndexedVec<Addressindex, Height>,
|
||||
pub height_to_blockhash: IndexedVec<Height, BlockHash>,
|
||||
pub height_to_difficulty: IndexedVec<Height, f64>,
|
||||
pub height_to_first_addressindex: IndexedVec<Height, Addressindex>,
|
||||
pub height_to_first_emptyindex: IndexedVec<Height, Emptyindex>,
|
||||
pub height_to_first_multisigindex: IndexedVec<Height, Multisigindex>,
|
||||
pub height_to_first_opreturnindex: IndexedVec<Height, Opreturnindex>,
|
||||
pub height_to_first_pushonlyindex: IndexedVec<Height, Pushonlyindex>,
|
||||
pub height_to_first_txindex: IndexedVec<Height, Txindex>,
|
||||
pub height_to_first_txinindex: IndexedVec<Height, Txinindex>,
|
||||
pub height_to_first_txoutindex: IndexedVec<Height, Txoutindex>,
|
||||
pub height_to_first_unknownindex: IndexedVec<Height, Unknownindex>,
|
||||
pub height_to_first_p2pk33index: IndexedVec<Height, P2PK33index>,
|
||||
pub height_to_first_p2pk65index: IndexedVec<Height, P2PK65index>,
|
||||
pub height_to_first_p2pkhindex: IndexedVec<Height, P2PKHindex>,
|
||||
pub height_to_first_p2shindex: IndexedVec<Height, P2SHindex>,
|
||||
pub height_to_first_p2trindex: IndexedVec<Height, P2TRindex>,
|
||||
pub height_to_first_p2wpkhindex: IndexedVec<Height, P2WPKHindex>,
|
||||
pub height_to_first_p2wshindex: IndexedVec<Height, P2WSHindex>,
|
||||
pub height_to_size: IndexedVec<Height, usize>,
|
||||
pub height_to_timestamp: IndexedVec<Height, Timestamp>,
|
||||
pub height_to_weight: IndexedVec<Height, Weight>,
|
||||
pub p2pk33index_to_p2pk33addressbytes: IndexedVec<P2PK33index, P2PK33AddressBytes>,
|
||||
pub p2pk65index_to_p2pk65addressbytes: IndexedVec<P2PK65index, P2PK65AddressBytes>,
|
||||
pub p2pkhindex_to_p2pkhaddressbytes: IndexedVec<P2PKHindex, P2PKHAddressBytes>,
|
||||
pub p2shindex_to_p2shaddressbytes: IndexedVec<P2SHindex, P2SHAddressBytes>,
|
||||
pub p2trindex_to_p2traddressbytes: IndexedVec<P2TRindex, P2TRAddressBytes>,
|
||||
pub p2wpkhindex_to_p2wpkhaddressbytes: IndexedVec<P2WPKHindex, P2WPKHAddressBytes>,
|
||||
pub p2wshindex_to_p2wshaddressbytes: IndexedVec<P2WSHindex, P2WSHAddressBytes>,
|
||||
pub txindex_to_first_txinindex: IndexedVec<Txindex, Txinindex>,
|
||||
pub txindex_to_first_txoutindex: IndexedVec<Txindex, Txoutindex>,
|
||||
pub txindex_to_height: IndexedVec<Txindex, Height>,
|
||||
pub txindex_to_locktime: IndexedVec<Txindex, LockTime>,
|
||||
pub txindex_to_txid: IndexedVec<Txindex, Txid>,
|
||||
pub txindex_to_base_size: IndexedVec<Txindex, usize>,
|
||||
pub txindex_to_total_size: IndexedVec<Txindex, usize>,
|
||||
pub txindex_to_is_explicitly_rbf: IndexedVec<Txindex, bool>,
|
||||
pub txindex_to_txversion: IndexedVec<Txindex, TxVersion>,
|
||||
/// If txoutindex == Txoutindex MAX then is it's coinbase
|
||||
pub txinindex_to_txoutindex: StorableVec<Txinindex, Txoutindex>,
|
||||
pub txoutindex_to_addressindex: StorableVec<Txoutindex, Addressindex>,
|
||||
pub txoutindex_to_value: StorableVec<Txoutindex, Sats>,
|
||||
pub txinindex_to_txoutindex: IndexedVec<Txinindex, Txoutindex>,
|
||||
pub txoutindex_to_addressindex: IndexedVec<Txoutindex, Addressindex>,
|
||||
pub txoutindex_to_value: IndexedVec<Txoutindex, Sats>,
|
||||
}
|
||||
|
||||
impl Vecs {
|
||||
@@ -69,217 +69,217 @@ impl Vecs {
|
||||
fs::create_dir_all(path)?;
|
||||
|
||||
Ok(Self {
|
||||
addressindex_to_addresstype: StorableVec::forced_import(
|
||||
addressindex_to_addresstype: IndexedVec::forced_import(
|
||||
&path.join("addressindex_to_addresstype"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
addressindex_to_addresstypeindex: StorableVec::forced_import(
|
||||
addressindex_to_addresstypeindex: IndexedVec::forced_import(
|
||||
&path.join("addressindex_to_addresstypeindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
addressindex_to_height: StorableVec::forced_import(
|
||||
addressindex_to_height: IndexedVec::forced_import(
|
||||
&path.join("addressindex_to_height"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_blockhash: StorableVec::forced_import(
|
||||
height_to_blockhash: IndexedVec::forced_import(
|
||||
&path.join("height_to_blockhash"),
|
||||
Version::ONE,
|
||||
Compressed::NO,
|
||||
)?,
|
||||
height_to_difficulty: StorableVec::forced_import(
|
||||
height_to_difficulty: IndexedVec::forced_import(
|
||||
&path.join("height_to_difficulty"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_first_addressindex: StorableVec::forced_import(
|
||||
height_to_first_addressindex: IndexedVec::forced_import(
|
||||
&path.join("height_to_first_addressindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_first_emptyindex: StorableVec::forced_import(
|
||||
height_to_first_emptyindex: IndexedVec::forced_import(
|
||||
&path.join("height_to_first_emptyindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_first_multisigindex: StorableVec::forced_import(
|
||||
height_to_first_multisigindex: IndexedVec::forced_import(
|
||||
&path.join("height_to_first_multisigindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_first_opreturnindex: StorableVec::forced_import(
|
||||
height_to_first_opreturnindex: IndexedVec::forced_import(
|
||||
&path.join("height_to_first_opreturnindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_first_pushonlyindex: StorableVec::forced_import(
|
||||
height_to_first_pushonlyindex: IndexedVec::forced_import(
|
||||
&path.join("height_to_first_pushonlyindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_first_txindex: StorableVec::forced_import(
|
||||
height_to_first_txindex: IndexedVec::forced_import(
|
||||
&path.join("height_to_first_txindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_first_txinindex: StorableVec::forced_import(
|
||||
height_to_first_txinindex: IndexedVec::forced_import(
|
||||
&path.join("height_to_first_txinindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_first_txoutindex: StorableVec::forced_import(
|
||||
height_to_first_txoutindex: IndexedVec::forced_import(
|
||||
&path.join("height_to_first_txoutindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_first_unknownindex: StorableVec::forced_import(
|
||||
height_to_first_unknownindex: IndexedVec::forced_import(
|
||||
&path.join("height_to_first_unkownindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_first_p2pk33index: StorableVec::forced_import(
|
||||
height_to_first_p2pk33index: IndexedVec::forced_import(
|
||||
&path.join("height_to_first_p2pk33index"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_first_p2pk65index: StorableVec::forced_import(
|
||||
height_to_first_p2pk65index: IndexedVec::forced_import(
|
||||
&path.join("height_to_first_p2pk65index"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_first_p2pkhindex: StorableVec::forced_import(
|
||||
height_to_first_p2pkhindex: IndexedVec::forced_import(
|
||||
&path.join("height_to_first_p2pkhindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_first_p2shindex: StorableVec::forced_import(
|
||||
height_to_first_p2shindex: IndexedVec::forced_import(
|
||||
&path.join("height_to_first_p2shindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_first_p2trindex: StorableVec::forced_import(
|
||||
height_to_first_p2trindex: IndexedVec::forced_import(
|
||||
&path.join("height_to_first_p2trindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_first_p2wpkhindex: StorableVec::forced_import(
|
||||
height_to_first_p2wpkhindex: IndexedVec::forced_import(
|
||||
&path.join("height_to_first_p2wpkhindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_first_p2wshindex: StorableVec::forced_import(
|
||||
height_to_first_p2wshindex: IndexedVec::forced_import(
|
||||
&path.join("height_to_first_p2wshindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_size: StorableVec::forced_import(
|
||||
height_to_size: IndexedVec::forced_import(
|
||||
&path.join("height_to_size"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_timestamp: StorableVec::forced_import(
|
||||
height_to_timestamp: IndexedVec::forced_import(
|
||||
&path.join("height_to_timestamp"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_weight: StorableVec::forced_import(
|
||||
height_to_weight: IndexedVec::forced_import(
|
||||
&path.join("height_to_weight"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
p2pk33index_to_p2pk33addressbytes: StorableVec::forced_import(
|
||||
p2pk33index_to_p2pk33addressbytes: IndexedVec::forced_import(
|
||||
&path.join("p2pk33index_to_p2pk33addressbytes"),
|
||||
Version::ONE,
|
||||
Compressed::NO,
|
||||
)?,
|
||||
p2pk65index_to_p2pk65addressbytes: StorableVec::forced_import(
|
||||
p2pk65index_to_p2pk65addressbytes: IndexedVec::forced_import(
|
||||
&path.join("p2pk65index_to_p2pk65addressbytes"),
|
||||
Version::ONE,
|
||||
Compressed::NO,
|
||||
)?,
|
||||
p2pkhindex_to_p2pkhaddressbytes: StorableVec::forced_import(
|
||||
p2pkhindex_to_p2pkhaddressbytes: IndexedVec::forced_import(
|
||||
&path.join("p2pkhindex_to_p2pkhaddressbytes"),
|
||||
Version::ONE,
|
||||
Compressed::NO,
|
||||
)?,
|
||||
p2shindex_to_p2shaddressbytes: StorableVec::forced_import(
|
||||
p2shindex_to_p2shaddressbytes: IndexedVec::forced_import(
|
||||
&path.join("p2shindex_to_p2shaddressbytes"),
|
||||
Version::ONE,
|
||||
Compressed::NO,
|
||||
)?,
|
||||
p2trindex_to_p2traddressbytes: StorableVec::forced_import(
|
||||
p2trindex_to_p2traddressbytes: IndexedVec::forced_import(
|
||||
&path.join("p2trindex_to_p2traddressbytes"),
|
||||
Version::ONE,
|
||||
Compressed::NO,
|
||||
)?,
|
||||
p2wpkhindex_to_p2wpkhaddressbytes: StorableVec::forced_import(
|
||||
p2wpkhindex_to_p2wpkhaddressbytes: IndexedVec::forced_import(
|
||||
&path.join("p2wpkhindex_to_p2wpkhaddressbytes"),
|
||||
Version::ONE,
|
||||
Compressed::NO,
|
||||
)?,
|
||||
p2wshindex_to_p2wshaddressbytes: StorableVec::forced_import(
|
||||
p2wshindex_to_p2wshaddressbytes: IndexedVec::forced_import(
|
||||
&path.join("p2wshindex_to_p2wshaddressbytes"),
|
||||
Version::ONE,
|
||||
Compressed::NO,
|
||||
)?,
|
||||
txindex_to_first_txinindex: StorableVec::forced_import(
|
||||
txindex_to_first_txinindex: IndexedVec::forced_import(
|
||||
&path.join("txindex_to_first_txinindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
txindex_to_first_txoutindex: StorableVec::forced_import(
|
||||
txindex_to_first_txoutindex: IndexedVec::forced_import(
|
||||
&path.join("txindex_to_first_txoutindex"),
|
||||
Version::ONE,
|
||||
Compressed::NO,
|
||||
)?,
|
||||
txindex_to_height: StorableVec::forced_import(
|
||||
txindex_to_height: IndexedVec::forced_import(
|
||||
&path.join("txindex_to_height"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
txindex_to_locktime: StorableVec::forced_import(
|
||||
txindex_to_locktime: IndexedVec::forced_import(
|
||||
&path.join("txindex_to_locktime"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
txindex_to_txid: StorableVec::forced_import(
|
||||
txindex_to_txid: IndexedVec::forced_import(
|
||||
&path.join("txindex_to_txid"),
|
||||
Version::ONE,
|
||||
Compressed::NO,
|
||||
)?,
|
||||
txindex_to_base_size: StorableVec::forced_import(
|
||||
txindex_to_base_size: IndexedVec::forced_import(
|
||||
&path.join("txindex_to_base_size"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
txindex_to_total_size: StorableVec::forced_import(
|
||||
txindex_to_total_size: IndexedVec::forced_import(
|
||||
&path.join("txindex_to_total_size"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
txindex_to_is_explicitly_rbf: StorableVec::forced_import(
|
||||
txindex_to_is_explicitly_rbf: IndexedVec::forced_import(
|
||||
&path.join("txindex_to_is_explicitly_rbf"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
txindex_to_txversion: StorableVec::forced_import(
|
||||
txindex_to_txversion: IndexedVec::forced_import(
|
||||
&path.join("txindex_to_txversion"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
txinindex_to_txoutindex: StorableVec::forced_import(
|
||||
txinindex_to_txoutindex: IndexedVec::forced_import(
|
||||
&path.join("txinindex_to_txoutindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
txoutindex_to_addressindex: StorableVec::forced_import(
|
||||
txoutindex_to_addressindex: IndexedVec::forced_import(
|
||||
&path.join("txoutindex_to_addressindex"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
)?,
|
||||
txoutindex_to_value: StorableVec::forced_import(
|
||||
txoutindex_to_value: IndexedVec::forced_import(
|
||||
&path.join("txoutindex_to_value"),
|
||||
Version::ONE,
|
||||
compressed,
|
||||
|
||||
@@ -25,6 +25,5 @@ oxc = { version = "0.62.0", features = ["codegen", "minifier"] }
|
||||
serde = { workspace = true }
|
||||
tokio = { version = "1.44.1", features = ["full"] }
|
||||
tower-http = { version = "0.6.2", features = ["compression-full", "trace"] }
|
||||
zip = "2.6.0"
|
||||
zip = "2.6.1"
|
||||
tracing = "0.1.41"
|
||||
tracing-subscriber = "0.3.19"
|
||||
|
||||
@@ -67,14 +67,14 @@ impl Server {
|
||||
} else {
|
||||
let downloads_path = dot_brk_path().join(DOWNLOADS);
|
||||
|
||||
let downloaded_websites_path = downloads_path.join(VERSION).join(WEBSITES);
|
||||
let downloaded_websites_path =
|
||||
downloads_path.join(format!("brk-{VERSION}")).join(WEBSITES);
|
||||
|
||||
if !fs::exists(&downloaded_websites_path)? {
|
||||
info!("Downloading websites from Github...");
|
||||
|
||||
let url = format!(
|
||||
"https://github.com/bitcoinresearchkit/brk/archive/refs/tags/{}.zip",
|
||||
VERSION
|
||||
"https://github.com/bitcoinresearchkit/brk/archive/refs/tags/v{VERSION}.zip",
|
||||
);
|
||||
|
||||
let response = minreq::get(url).send()?;
|
||||
|
||||
-45
@@ -1,45 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cargo clean
|
||||
|
||||
cargo build --all-targets
|
||||
|
||||
cd crates/brk
|
||||
|
||||
cd ../brk_core
|
||||
cargo publish
|
||||
|
||||
cd ../brk_exit
|
||||
cargo publish
|
||||
|
||||
cd ../brk_vec
|
||||
cargo publish
|
||||
|
||||
cd ../brk_logger
|
||||
cargo publish
|
||||
|
||||
cd ../brk_indexer
|
||||
cargo publish
|
||||
|
||||
cd ../brk_parser
|
||||
cargo publish
|
||||
|
||||
cd ../brk_fetcher
|
||||
cargo publish
|
||||
|
||||
cd ../brk_computer
|
||||
cargo publish
|
||||
|
||||
cd ../brk_query
|
||||
cargo publish
|
||||
|
||||
cd ../brk_server
|
||||
cargo publish
|
||||
|
||||
cd ../brk_cli
|
||||
cargo publish
|
||||
|
||||
cd ../brk
|
||||
cargo publish
|
||||
|
||||
cd ../..
|
||||
@@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cargo clean
|
||||
rustup update
|
||||
cargo upgrade --incompatible
|
||||
cargo update
|
||||
cargo build --all-targets
|
||||
|
||||
@@ -124,7 +124,7 @@ export function createVecIdToIndexes() {
|
||||
p2wshaddressbytes: [P2WSHindex],
|
||||
quarterindex: [Monthindex, Quarterindex],
|
||||
"real-date": [Height],
|
||||
"sats-per-dollar": [Dateindex, Height],
|
||||
"sats-per-dollar": [Dateindex, Height, Weekindex, Monthindex, Quarterindex, Yearindex, Decadeindex, Difficultyepoch],
|
||||
size: [Height],
|
||||
timestamp: [Dateindex, Height, Weekindex, Monthindex, Quarterindex, Yearindex, Decadeindex, Difficultyepoch, Halvingepoch],
|
||||
"total-block-count": [Dateindex],
|
||||
|
||||
Reference in New Issue
Block a user