Skip to content

Commit

Permalink
Update imbl to 5.0.0 & remove hax (#33410)
Browse files Browse the repository at this point in the history
GitOrigin-RevId: f36bd79db0362b30e1c1954c09b8760151b9e426
  • Loading branch information
goffrie authored and Convex, Inc. committed Feb 21, 2025
1 parent 61be021 commit d5c9917
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 29 deletions.
23 changes: 15 additions & 8 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 @@ -70,7 +70,7 @@ humansize = { version = "2.1.3", features = [ "impl_style" ] }
hyper = "1.3.1"
hyper-util = { version = "0.1.5", features = [ "server-graceful", "tokio" ] }
proc-macro2 = { version = "1.0" }
imbl = "3.0.0"
imbl = "5.0.0"
itertools = "0.14"
jsonschema = "0.28"
levenshtein_automata = "0.2.1"
Expand Down
2 changes: 1 addition & 1 deletion crates/convex/Cargo.oss.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ base64 = { version = "0.13" }
bytes = { version = "1.6.0" }
convex_sync_types = { path = "./sync_types", version = "=0.9.0" }
futures = { version = "0.3" }
imbl = { version = "3.0.0" }
imbl = { version = "5.0.0" }
parking_lot = { optional = true, version = "0.12", features = [ "hardware-lock-elision" ] }
proptest = { optional = true, version = "1" }
proptest-derive = { optional = true, version = "0.5.0" }
Expand Down
21 changes: 2 additions & 19 deletions crates/database/src/write_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ use errors::{
ErrorMetadataAnyhowExt,
};
use futures::Future;
use imbl::{
vector,
Vector,
};
use imbl::Vector;
use parking_lot::Mutex;
use tokio::sync::oneshot;
use value::heap_size::{
Expand Down Expand Up @@ -258,8 +255,7 @@ impl WriteLog {
Ok(i) => i,
Err(i) => i,
};
let focus = focus_after(self.by_ts.focus(), start);
let iter = focus.into_iter();
let iter = self.by_ts.focus().narrow(start..).into_iter();
Ok(iter
.map(|entry| &**entry)
.take_while(move |(t, ..)| *t <= to)
Expand Down Expand Up @@ -299,19 +295,6 @@ impl WriteLog {
}
}

// TODO: use .narrow(start..) once https://github.com/jneem/imbl/pull/89 is released
fn focus_after<T>(focus: vector::Focus<'_, T>, start: usize) -> vector::Focus<'_, T> {
if focus.is_empty() {
// split_at and narrow don't work if the vector is empty
focus
} else if focus.len() == start {
// narrow doesn't work if start is at the end
focus.split_at(0).0
} else {
focus.narrow(start..)
}
}

pub fn new_write_log(
initial_timestamp: Timestamp,
persistence_version: PersistenceVersion,
Expand Down

0 comments on commit d5c9917

Please sign in to comment.