global: adding semester + making coarser intervals computed instead of eager

This commit is contained in:
nym21
2025-07-10 17:44:19 +02:00
parent a66f4ad4bd
commit c229e218f6
65 changed files with 2490 additions and 1003 deletions

View File

@@ -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),
)
}

View File

@@ -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<()>;