2
2
// This source code is licensed under both the Apache 2.0 and MIT License
3
3
// (found in the LICENSE-* files in the repository)
4
4
5
+ mod cache;
5
6
mod compression;
6
7
mod gc;
7
8
pub mod index;
@@ -16,6 +17,7 @@ use crate::{
16
17
value:: InternalValue ,
17
18
Config , KvPair , Memtable , Segment , SegmentId , SeqNo , Snapshot , UserKey , UserValue ,
18
19
} ;
20
+ use cache:: MyBlobCache ;
19
21
use compression:: MyCompressor ;
20
22
use gc:: { reader:: GcReader , writer:: GcWriter } ;
21
23
use index:: IndexTree ;
@@ -27,7 +29,7 @@ use std::{
27
29
use value:: MaybeInlineValue ;
28
30
use value_log:: ValueLog ;
29
31
30
- fn resolve_value_handle ( vlog : & ValueLog < MyCompressor > , item : RangeItem ) -> RangeItem {
32
+ fn resolve_value_handle ( vlog : & ValueLog < MyBlobCache , MyCompressor > , item : RangeItem ) -> RangeItem {
31
33
use MaybeInlineValue :: { Indirect , Inline } ;
32
34
33
35
match item {
@@ -67,7 +69,7 @@ pub struct BlobTree {
67
69
68
70
/// Log-structured value-log that stores large values
69
71
#[ doc( hidden) ]
70
- pub blobs : ValueLog < MyCompressor > ,
72
+ pub blobs : ValueLog < MyBlobCache , MyCompressor > ,
71
73
72
74
// TODO: maybe replace this with a nonce system
73
75
#[ doc( hidden) ]
@@ -79,10 +81,10 @@ impl BlobTree {
79
81
let path = & config. path ;
80
82
81
83
let vlog_path = path. join ( BLOBS_FOLDER ) ;
82
- let vlog_cfg = value_log :: Config :: < MyCompressor > :: default ( )
83
- . blob_cache ( config. blob_cache . clone ( ) )
84
- . segment_size_bytes ( config. blob_file_target_size )
85
- . compression ( MyCompressor ( config. blob_compression ) ) ;
84
+ let vlog_cfg =
85
+ value_log :: Config :: < MyBlobCache , MyCompressor > :: new ( MyBlobCache ( config. cache . clone ( ) ) )
86
+ . segment_size_bytes ( config. blob_file_target_size )
87
+ . compression ( MyCompressor ( config. blob_compression ) ) ;
86
88
87
89
let index: IndexTree = config. open ( ) ?. into ( ) ;
88
90
@@ -188,7 +190,7 @@ impl BlobTree {
188
190
189
191
pub fn apply_gc_strategy (
190
192
& self ,
191
- strategy : & impl value_log:: GcStrategy < MyCompressor > ,
193
+ strategy : & impl value_log:: GcStrategy < MyBlobCache , MyCompressor > ,
192
194
seqno : SeqNo ,
193
195
) -> crate :: Result < u64 > {
194
196
// IMPORTANT: Write lock memtable to avoid read skew
0 commit comments