Skip to content

Commit 34f915a

Browse files
committed
fix successor
1 parent 2791f79 commit 34f915a

File tree

3 files changed

+6
-16
lines changed

3 files changed

+6
-16
lines changed

src/store/fs.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ use serde::{Deserialize, Serialize};
8686
use smallvec::SmallVec;
8787
use tokio::io::AsyncWriteExt;
8888
use tracing::trace_span;
89-
9089
mod tables;
9190
#[doc(hidden)]
9291
pub mod test_support;

src/store/mem.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use bao_tree::{
1717
use bytes::{Bytes, BytesMut};
1818
use futures_lite::{Stream, StreamExt};
1919
use iroh_io::AsyncSliceReader;
20+
use tracing::info;
2021

2122
use super::{
2223
temp_name, BaoBatchWriter, ConsistencyCheckProgress, ExportMode, ExportProgressCb, ImportMode,
@@ -215,6 +216,8 @@ impl super::Store for Store {
215216

216217
async fn delete_tags(&self, from: Option<Tag>, to: Option<Tag>) -> io::Result<()> {
217218
let mut state = self.write_lock();
219+
info!("deleting tags from {:?} to {:?}", from, to);
220+
// state.tags.remove(&from.unwrap());
218221
// todo: more efficient impl
219222
state.tags.retain(|tag, _| {
220223
if let Some(from) = &from {
@@ -227,6 +230,7 @@ impl super::Store for Store {
227230
return true;
228231
}
229232
}
233+
info!(" removing {:?}", tag);
230234
false
231235
});
232236
Ok(())

src/util.rs

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ impl Tag {
148148
/// The successor of this tag in lexicographic order.
149149
pub fn successor(&self) -> Self {
150150
let mut bytes = self.0.to_vec();
151-
increment_vec(&mut bytes);
151+
// increment_vec(&mut bytes);
152+
bytes.push(0);
152153
Self(bytes.into())
153154
}
154155

@@ -349,20 +350,6 @@ pub(crate) fn next_prefix(bytes: &mut [u8]) -> bool {
349350
false
350351
}
351352

352-
/// Increment a byte vector, lexographically.
353-
#[allow(dead_code)]
354-
pub(crate) fn increment_vec(bytes: &mut Vec<u8>) {
355-
for byte in bytes.iter_mut().rev() {
356-
if *byte < 255 {
357-
*byte += 1;
358-
return;
359-
}
360-
*byte = 0;
361-
}
362-
363-
bytes.push(0);
364-
}
365-
366353
/// Synchronously compute the outboard of a file, and return hash and outboard.
367354
///
368355
/// It is assumed that the file is not modified while this is running.

0 commit comments

Comments
 (0)