mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-05-10 22:29:09 -07:00
global: adding semester + making coarser intervals computed instead of eager
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use brk_core::Version;
|
||||
use brk_core::{Height, Version};
|
||||
|
||||
use super::{BoxedVecIterator, StoredIndex, StoredType};
|
||||
|
||||
@@ -20,10 +20,10 @@ pub trait AnyVec: Send + Sync {
|
||||
}
|
||||
fn index_type_to_string(&self) -> &'static str;
|
||||
fn value_type_to_size_of(&self) -> usize;
|
||||
fn etag(&self, to: Option<i64>) -> String {
|
||||
fn etag(&self, height: Height, to: Option<i64>) -> String {
|
||||
let len = self.len();
|
||||
format!(
|
||||
"{}-{:?}",
|
||||
"{}-{}-{}",
|
||||
to.map_or(len, |to| {
|
||||
if to.is_negative() {
|
||||
len.checked_sub(to.unsigned_abs() as usize)
|
||||
@@ -32,7 +32,8 @@ pub trait AnyVec: Send + Sync {
|
||||
to as usize
|
||||
}
|
||||
}),
|
||||
self.version()
|
||||
u64::from(self.version()),
|
||||
u32::from(height),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -122,13 +122,14 @@ where
|
||||
|
||||
fn file_write_all(&mut self, file: &mut File, buf: &[u8]) -> Result<()> {
|
||||
file.write_all(buf)?;
|
||||
// file.flush()?;
|
||||
// file.sync_data()?;
|
||||
self.update_mmap(file)
|
||||
}
|
||||
|
||||
fn file_truncate_and_write_all(&mut self, file: &mut File, len: u64, buf: &[u8]) -> Result<()> {
|
||||
Self::file_set_len_(file, len)?;
|
||||
file.write_all(buf)?;
|
||||
self.update_mmap(file)
|
||||
self.file_write_all(file, buf)
|
||||
}
|
||||
|
||||
fn reset(&mut self) -> Result<()>;
|
||||
|
||||
Reference in New Issue
Block a user