mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-05-10 22:29:09 -07:00
stores: forgot some files
This commit is contained in:
@@ -72,7 +72,7 @@ impl Stores {
|
|||||||
path,
|
path,
|
||||||
"p2aaddressindex_with_outputindex",
|
"p2aaddressindex_with_outputindex",
|
||||||
version + VERSION + Version::ZERO,
|
version + VERSION + Version::ZERO,
|
||||||
Some(None),
|
Some(false),
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
let p2pk33addressindex_with_outputindex = scope.spawn(|| {
|
let p2pk33addressindex_with_outputindex = scope.spawn(|| {
|
||||||
@@ -81,7 +81,7 @@ impl Stores {
|
|||||||
path,
|
path,
|
||||||
"p2pk33addressindex_with_outputindex",
|
"p2pk33addressindex_with_outputindex",
|
||||||
version + VERSION + Version::ZERO,
|
version + VERSION + Version::ZERO,
|
||||||
Some(None),
|
Some(false),
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
let p2pk65addressindex_with_outputindex = scope.spawn(|| {
|
let p2pk65addressindex_with_outputindex = scope.spawn(|| {
|
||||||
@@ -90,7 +90,7 @@ impl Stores {
|
|||||||
path,
|
path,
|
||||||
"p2pk65addressindex_with_outputindex",
|
"p2pk65addressindex_with_outputindex",
|
||||||
version + VERSION + Version::ZERO,
|
version + VERSION + Version::ZERO,
|
||||||
Some(None),
|
Some(false),
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
let p2pkhaddressindex_with_outputindex = scope.spawn(|| {
|
let p2pkhaddressindex_with_outputindex = scope.spawn(|| {
|
||||||
@@ -99,7 +99,7 @@ impl Stores {
|
|||||||
path,
|
path,
|
||||||
"p2pkhaddressindex_with_outputindex",
|
"p2pkhaddressindex_with_outputindex",
|
||||||
version + VERSION + Version::ZERO,
|
version + VERSION + Version::ZERO,
|
||||||
Some(None),
|
Some(false),
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
let p2shaddressindex_with_outputindex = scope.spawn(|| {
|
let p2shaddressindex_with_outputindex = scope.spawn(|| {
|
||||||
@@ -108,7 +108,7 @@ impl Stores {
|
|||||||
path,
|
path,
|
||||||
"p2shaddressindex_with_outputindex",
|
"p2shaddressindex_with_outputindex",
|
||||||
version + VERSION + Version::ZERO,
|
version + VERSION + Version::ZERO,
|
||||||
Some(None),
|
Some(false),
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
let p2traddressindex_with_outputindex = scope.spawn(|| {
|
let p2traddressindex_with_outputindex = scope.spawn(|| {
|
||||||
@@ -117,7 +117,7 @@ impl Stores {
|
|||||||
path,
|
path,
|
||||||
"p2traddressindex_with_outputindex",
|
"p2traddressindex_with_outputindex",
|
||||||
version + VERSION + Version::ZERO,
|
version + VERSION + Version::ZERO,
|
||||||
Some(None),
|
Some(false),
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
let p2wpkhaddressindex_with_outputindex = scope.spawn(|| {
|
let p2wpkhaddressindex_with_outputindex = scope.spawn(|| {
|
||||||
@@ -126,7 +126,7 @@ impl Stores {
|
|||||||
path,
|
path,
|
||||||
"p2wpkhaddressindex_with_outputindex",
|
"p2wpkhaddressindex_with_outputindex",
|
||||||
version + VERSION + Version::ZERO,
|
version + VERSION + Version::ZERO,
|
||||||
Some(None),
|
Some(false),
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
let p2wshaddressindex_with_outputindex = scope.spawn(|| {
|
let p2wshaddressindex_with_outputindex = scope.spawn(|| {
|
||||||
@@ -135,7 +135,7 @@ impl Stores {
|
|||||||
path,
|
path,
|
||||||
"p2wshaddressindex_with_outputindex",
|
"p2wshaddressindex_with_outputindex",
|
||||||
version + VERSION + Version::ZERO,
|
version + VERSION + Version::ZERO,
|
||||||
Some(None),
|
Some(false),
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -34,11 +34,9 @@ pub struct Store<Key, Value> {
|
|||||||
rtx: ReadTransaction,
|
rtx: ReadTransaction,
|
||||||
puts: BTreeMap<Key, Value>,
|
puts: BTreeMap<Key, Value>,
|
||||||
dels: BTreeSet<Key>,
|
dels: BTreeSet<Key>,
|
||||||
bloom_filter_bits: Option<Option<u8>>,
|
bloom_filters: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Use default if will read
|
|
||||||
const DEFAULT_BLOOM_FILTER_BITS: Option<u8> = Some(5);
|
|
||||||
// const CHECK_COLLISIONS: bool = true;
|
// const CHECK_COLLISIONS: bool = true;
|
||||||
const MAJOR_FJALL_VERSION: Version = Version::TWO;
|
const MAJOR_FJALL_VERSION: Version = Version::TWO;
|
||||||
|
|
||||||
@@ -59,7 +57,7 @@ where
|
|||||||
path: &Path,
|
path: &Path,
|
||||||
name: &str,
|
name: &str,
|
||||||
version: Version,
|
version: Version,
|
||||||
bloom_filter_bits: Option<Option<u8>>,
|
bloom_filters: Option<bool>,
|
||||||
) -> Result<Self> {
|
) -> Result<Self> {
|
||||||
fs::create_dir_all(path)?;
|
fs::create_dir_all(path)?;
|
||||||
|
|
||||||
@@ -68,7 +66,7 @@ where
|
|||||||
&path.join(format!("meta/{name}")),
|
&path.join(format!("meta/{name}")),
|
||||||
MAJOR_FJALL_VERSION + version,
|
MAJOR_FJALL_VERSION + version,
|
||||||
|| {
|
|| {
|
||||||
Self::open_partition_handle(keyspace, name, bloom_filter_bits).inspect_err(|e| {
|
Self::open_partition_handle(keyspace, name, bloom_filters).inspect_err(|e| {
|
||||||
eprintln!("{e}");
|
eprintln!("{e}");
|
||||||
eprintln!("Delete {path:?} and try again");
|
eprintln!("Delete {path:?} and try again");
|
||||||
})
|
})
|
||||||
@@ -85,7 +83,7 @@ where
|
|||||||
rtx,
|
rtx,
|
||||||
puts: BTreeMap::new(),
|
puts: BTreeMap::new(),
|
||||||
dels: BTreeSet::new(),
|
dels: BTreeSet::new(),
|
||||||
bloom_filter_bits,
|
bloom_filters,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,17 +178,17 @@ where
|
|||||||
fn open_partition_handle(
|
fn open_partition_handle(
|
||||||
keyspace: &TransactionalKeyspace,
|
keyspace: &TransactionalKeyspace,
|
||||||
name: &str,
|
name: &str,
|
||||||
bloom_filter_bits: Option<Option<u8>>,
|
bloom_filters: Option<bool>,
|
||||||
) -> Result<TransactionalPartitionHandle> {
|
) -> Result<TransactionalPartitionHandle> {
|
||||||
keyspace
|
let mut options = PartitionCreateOptions::default()
|
||||||
.open_partition(
|
.max_memtable_size(8 * 1024 * 1024)
|
||||||
name,
|
.manual_journal_persist(true);
|
||||||
PartitionCreateOptions::default()
|
|
||||||
.bloom_filter_bits(bloom_filter_bits.unwrap_or(DEFAULT_BLOOM_FILTER_BITS))
|
if bloom_filters.is_some_and(|b| !b) {
|
||||||
.max_memtable_size(8 * 1024 * 1024)
|
options = options.bloom_filter_bits(None);
|
||||||
.manual_journal_persist(true),
|
}
|
||||||
)
|
|
||||||
.map_err(|e| e.into())
|
keyspace.open_partition(name, options).map_err(|e| e.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn commit_(
|
pub fn commit_(
|
||||||
@@ -272,8 +270,7 @@ where
|
|||||||
|
|
||||||
self.meta.reset();
|
self.meta.reset();
|
||||||
|
|
||||||
let partition =
|
let partition = Self::open_partition_handle(&self.keyspace, self.name, self.bloom_filters)?;
|
||||||
Self::open_partition_handle(&self.keyspace, self.name, self.bloom_filter_bits)?;
|
|
||||||
|
|
||||||
self.partition.replace(partition);
|
self.partition.replace(partition);
|
||||||
|
|
||||||
@@ -314,7 +311,7 @@ where
|
|||||||
rtx: self.keyspace.read_tx(),
|
rtx: self.keyspace.read_tx(),
|
||||||
puts: self.puts.clone(),
|
puts: self.puts.clone(),
|
||||||
dels: self.dels.clone(),
|
dels: self.dels.clone(),
|
||||||
bloom_filter_bits: self.bloom_filter_bits,
|
bloom_filters: self.bloom_filters,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user