Skip to content

Commit b05bad1

Browse files
authored
Merge pull request #251 from fjall-rs/3.1
3.1.0
2 parents f794447 + 284ba42 commit b05bad1

24 files changed

+1595
-130
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "lsm-tree"
33
description = "A K.I.S.S. implementation of log-structured merge trees (LSM-trees/LSMTs)"
44
license = "MIT OR Apache-2.0"
5-
version = "3.0.4"
5+
version = "3.1.0"
66
edition = "2021"
77
rust-version = "1.90"
88
readme = "README.md"

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![CI](https://github.com/fjall-rs/lsm-tree/actions/workflows/test.yml/badge.svg)](https://github.com/fjall-rs/lsm-tree/actions/workflows/test.yml)
66
[![docs.rs](https://img.shields.io/docsrs/lsm-tree?color=green)](https://docs.rs/lsm-tree)
77
[![Crates.io](https://img.shields.io/crates/v/lsm-tree?color=blue)](https://crates.io/crates/lsm-tree)
8-
![MSRV](https://img.shields.io/badge/MSRV-1.91.0-blue)
8+
![MSRV](https://img.shields.io/badge/MSRV-1.90.0-blue)
99
[![dependency status](https://deps.rs/repo/github/fjall-rs/lsm-tree/status.svg)](https://deps.rs/repo/github/fjall-rs/lsm-tree)
1010

1111
A K.I.S.S. implementation of log-structured merge trees (LSM-trees/LSMTs) in Rust.
@@ -33,6 +33,7 @@ This is the most feature-rich LSM-tree implementation in Rust! It features:
3333
- Leveled and FIFO compaction
3434
- Optional key-value separation for large value workloads [[2]](#footnotes), with automatic garbage collection
3535
- Single deletion tombstones ("weak" deletion)
36+
- Optional compaction filters to run custom logic during compactions
3637

3738
Keys are limited to 65536 bytes, values are limited to 2^32 bytes.
3839
As is normal with any kind of storage engine, larger keys and values have a bigger performance impact.
File renamed without changes.

src/blob_tree/gc.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// (found in the LICENSE-* files in the repository)
44

55
use crate::{
6-
blob_tree::handle::BlobIndirection, coding::Decode, compaction::stream::ExpiredKvCallback,
6+
blob_tree::handle::BlobIndirection, coding::Decode, compaction::stream::DroppedKvCallback,
77
version::BlobFileList, vlog::BlobFileId,
88
};
99

@@ -132,8 +132,8 @@ impl crate::coding::Decode for FragmentationMap {
132132
}
133133
}
134134

135-
impl ExpiredKvCallback for FragmentationMap {
136-
fn on_expired(&mut self, kv: &crate::InternalValue) {
135+
impl DroppedKvCallback for FragmentationMap {
136+
fn on_dropped(&mut self, kv: &crate::InternalValue) {
137137
if kv.key.value_type.is_indirection() {
138138
let mut reader = &kv.value[..];
139139

@@ -278,7 +278,7 @@ mod tests {
278278
let mut my_watcher = FragmentationMap::default();
279279

280280
let iter = vec.iter().cloned().map(Ok);
281-
let mut iter = CompactionStream::new(iter, 1_000).with_expiration_callback(&mut my_watcher);
281+
let mut iter = CompactionStream::new(iter, 1_000).with_drop_callback(&mut my_watcher);
282282

283283
assert_eq!(
284284
// TODO: Seqno is normally reset to 0

src/blob_tree/ingest.rs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,8 @@
33
// (found in the LICENSE-* files in the repository)
44

55
use crate::{
6-
blob_tree::handle::BlobIndirection,
7-
file::BLOBS_FOLDER,
8-
table::Table,
9-
tree::ingest::Ingestion as TableIngestion,
10-
vlog::{BlobFileWriter, ValueHandle},
11-
SeqNo, UserKey, UserValue,
6+
blob_tree::handle::BlobIndirection, file::BLOBS_FOLDER, table::Table,
7+
tree::ingest::Ingestion as TableIngestion, vlog::BlobFileWriter, SeqNo, UserKey, UserValue,
128
};
139

1410
/// Bulk ingestion for [`BlobTree`]
@@ -86,16 +82,10 @@ impl<'a> BlobIngestion<'a> {
8682
let value_size = value.len() as u32;
8783

8884
if value_size >= self.separation_threshold {
89-
let offset = self.blob.offset();
90-
let blob_file_id = self.blob.blob_file_id();
91-
let on_disk_size = self.blob.write(&key, self.seqno, &value)?;
85+
let vhandle = self.blob.write(&key, self.seqno, &value)?;
9286

9387
let indirection = BlobIndirection {
94-
vhandle: ValueHandle {
95-
blob_file_id,
96-
offset,
97-
on_disk_size,
98-
},
88+
vhandle,
9989
size: value_size,
10090
};
10191

src/blob_tree/mod.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ pub mod ingest;
1010
pub use gc::{FragmentationEntry, FragmentationMap};
1111

1212
use crate::{
13+
abstract_tree::{AbstractTree, RangeItem},
1314
coding::Decode,
1415
iter_guard::{IterGuard, IterGuardImpl},
15-
r#abstract::{AbstractTree, RangeItem},
1616
table::Table,
1717
tree::inner::MemtableId,
1818
value::InternalValue,
1919
version::Version,
20-
vlog::{Accessor, BlobFile, BlobFileWriter, ValueHandle},
20+
vlog::{Accessor, BlobFile, BlobFileWriter},
2121
Cache, Config, Memtable, SeqNo, TableId, TreeId, UserKey, UserValue,
2222
};
2323
use handle::BlobIndirection;
@@ -431,16 +431,10 @@ impl AbstractTree for BlobTree {
431431
let value_size = value.len() as u32;
432432

433433
if value_size >= separation_threshold {
434-
let offset = blob_writer.offset();
435-
let blob_file_id = blob_writer.blob_file_id();
436-
let on_disk_size = blob_writer.write(&item.key.user_key, item.key.seqno, &value)?;
434+
let vhandle = blob_writer.write(&item.key.user_key, item.key.seqno, &value)?;
437435

438436
let indirection = BlobIndirection {
439-
vhandle: ValueHandle {
440-
blob_file_id,
441-
offset,
442-
on_disk_size,
443-
},
437+
vhandle,
444438
size: value_size,
445439
};
446440

0 commit comments

Comments
 (0)