Skip to content

Commit

Permalink
Update redb dependency to 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cberner committed Mar 22, 2024
1 parent 737f414 commit 5170d19
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 33 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ miniscript = "10.0.0"
mp4 = "0.14.0"
ord-bitcoincore-rpc = "0.17.2"
ordinals = { version = "0.0.4", path = "crates/ordinals" }
redb = "1.5.0"
redb = "2.0.0"
regex = "1.6.0"
reqwest = { version = "0.11.23", features = ["blocking", "json"] }
rss = "2.0.1"
Expand Down
4 changes: 2 additions & 2 deletions src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ use {
log::log_enabled,
redb::{
Database, DatabaseError, MultimapTable, MultimapTableDefinition, MultimapTableHandle,
ReadOnlyTable, ReadableMultimapTable, ReadableTable, RepairSession, StorageError, Table,
TableDefinition, TableHandle, TableStats, WriteTransaction,
ReadOnlyTable, ReadableMultimapTable, ReadableTable, ReadableTableMetadata, RepairSession,
StorageError, Table, TableDefinition, TableHandle, TableStats, WriteTransaction,
},
std::{
collections::HashMap,
Expand Down
4 changes: 2 additions & 2 deletions src/index/rtx.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use super::*;

pub(crate) struct Rtx<'a>(pub(crate) redb::ReadTransaction<'a>);
pub(crate) struct Rtx(pub(crate) redb::ReadTransaction);

impl Rtx<'_> {
impl Rtx {
pub(crate) fn block_height(&self) -> Result<Option<Height>> {
Ok(
self
Expand Down
2 changes: 1 addition & 1 deletion src/index/updater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub(crate) struct Updater<'index> {
}

impl<'index> Updater<'index> {
pub(crate) fn update_index<'a>(&'a mut self, mut wtx: WriteTransaction<'a>) -> Result {
pub(crate) fn update_index(&mut self, mut wtx: WriteTransaction) -> Result {
let start = Instant::now();
let starting_height = u32::try_from(self.index.client.get_block_count()?).unwrap() + 1;
let starting_index_height = self.height;
Expand Down
28 changes: 13 additions & 15 deletions src/index/updater/inscription_updater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,39 +37,37 @@ enum Origin {
},
}

pub(super) struct InscriptionUpdater<'a, 'db, 'tx> {
pub(super) struct InscriptionUpdater<'a, 'tx> {
pub(super) blessed_inscription_count: u64,
pub(super) chain: Chain,
pub(super) content_type_to_count: &'a mut Table<'db, 'tx, Option<&'static [u8]>, u64>,
pub(super) content_type_to_count: &'a mut Table<'tx, Option<&'static [u8]>, u64>,
pub(super) cursed_inscription_count: u64,
pub(super) event_sender: Option<&'a Sender<Event>>,
pub(super) flotsam: Vec<Flotsam>,
pub(super) height: u32,
pub(super) home_inscription_count: u64,
pub(super) home_inscriptions: &'a mut Table<'db, 'tx, u32, InscriptionIdValue>,
pub(super) id_to_sequence_number: &'a mut Table<'db, 'tx, InscriptionIdValue, u32>,
pub(super) home_inscriptions: &'a mut Table<'tx, u32, InscriptionIdValue>,
pub(super) id_to_sequence_number: &'a mut Table<'tx, InscriptionIdValue, u32>,
pub(super) index_transactions: bool,
pub(super) inscription_number_to_sequence_number: &'a mut Table<'db, 'tx, i32, u32>,
pub(super) inscription_number_to_sequence_number: &'a mut Table<'tx, i32, u32>,
pub(super) lost_sats: u64,
pub(super) next_sequence_number: u32,
pub(super) outpoint_to_value: &'a mut Table<'db, 'tx, &'static OutPointValue, u64>,
pub(super) outpoint_to_value: &'a mut Table<'tx, &'static OutPointValue, u64>,
pub(super) reward: u64,
pub(super) transaction_buffer: Vec<u8>,
pub(super) transaction_id_to_transaction:
&'a mut Table<'db, 'tx, &'static TxidValue, &'static [u8]>,
pub(super) sat_to_sequence_number: &'a mut MultimapTable<'db, 'tx, u64, u32>,
pub(super) satpoint_to_sequence_number:
&'a mut MultimapTable<'db, 'tx, &'static SatPointValue, u32>,
pub(super) sequence_number_to_children: &'a mut MultimapTable<'db, 'tx, u32, u32>,
pub(super) sequence_number_to_entry: &'a mut Table<'db, 'tx, u32, InscriptionEntryValue>,
pub(super) sequence_number_to_satpoint: &'a mut Table<'db, 'tx, u32, &'static SatPointValue>,
pub(super) transaction_id_to_transaction: &'a mut Table<'tx, &'static TxidValue, &'static [u8]>,
pub(super) sat_to_sequence_number: &'a mut MultimapTable<'tx, u64, u32>,
pub(super) satpoint_to_sequence_number: &'a mut MultimapTable<'tx, &'static SatPointValue, u32>,
pub(super) sequence_number_to_children: &'a mut MultimapTable<'tx, u32, u32>,
pub(super) sequence_number_to_entry: &'a mut Table<'tx, u32, InscriptionEntryValue>,
pub(super) sequence_number_to_satpoint: &'a mut Table<'tx, u32, &'static SatPointValue>,
pub(super) timestamp: u32,
pub(super) unbound_inscriptions: u64,
pub(super) value_cache: &'a mut HashMap<OutPoint, u64>,
pub(super) value_receiver: &'a mut Receiver<u64>,
}

impl<'a, 'db, 'tx> InscriptionUpdater<'a, 'db, 'tx> {
impl<'a, 'db, 'tx> InscriptionUpdater<'a, 'tx> {
pub(super) fn index_inscriptions(
&mut self,
tx: &Transaction,
Expand Down
20 changes: 10 additions & 10 deletions src/index/updater/rune_updater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,23 @@ pub(crate) struct RuneUpdate {
pub(crate) supply: u128,
}

pub(super) struct RuneUpdater<'a, 'db, 'tx> {
pub(super) struct RuneUpdater<'a, 'tx> {
pub(super) height: u32,
pub(super) id_to_entry: &'a mut Table<'db, 'tx, RuneIdValue, RuneEntryValue>,
pub(super) inscription_id_to_sequence_number: &'a Table<'db, 'tx, InscriptionIdValue, u32>,
pub(super) id_to_entry: &'a mut Table<'tx, RuneIdValue, RuneEntryValue>,
pub(super) inscription_id_to_sequence_number: &'a Table<'tx, InscriptionIdValue, u32>,
pub(super) minimum: Rune,
pub(super) outpoint_to_balances: &'a mut Table<'db, 'tx, &'static OutPointValue, &'static [u8]>,
pub(super) outpoint_to_output: &'a mut Table<'db, 'tx, &'static OutPointValue, OutputValue>,
pub(super) rune_to_id: &'a mut Table<'db, 'tx, u128, RuneIdValue>,
pub(super) outpoint_to_balances: &'a mut Table<'tx, &'static OutPointValue, &'static [u8]>,
pub(super) outpoint_to_output: &'a mut Table<'tx, &'static OutPointValue, OutputValue>,
pub(super) rune_to_id: &'a mut Table<'tx, u128, RuneIdValue>,
pub(super) runes: u64,
pub(super) sequence_number_to_rune_id: &'a mut Table<'db, 'tx, u32, RuneIdValue>,
pub(super) statistic_to_count: &'a mut Table<'db, 'tx, u64, u64>,
pub(super) sequence_number_to_rune_id: &'a mut Table<'tx, u32, RuneIdValue>,
pub(super) statistic_to_count: &'a mut Table<'tx, u64, u64>,
pub(super) block_time: u32,
pub(super) transaction_id_to_rune: &'a mut Table<'db, 'tx, &'static TxidValue, u128>,
pub(super) transaction_id_to_rune: &'a mut Table<'tx, &'static TxidValue, u128>,
pub(super) updates: HashMap<RuneId, RuneUpdate>,
}

impl<'a, 'db, 'tx> RuneUpdater<'a, 'db, 'tx> {
impl<'a, 'tx> RuneUpdater<'a, 'tx> {
pub(super) fn index_runes(
&mut self,
tx_index: usize,
Expand Down

0 comments on commit 5170d19

Please sign in to comment.