1- use lsm_tree:: {
2- AbstractTree , AnyTree , BlobIngestion , Config , Ingestion , KvSeparationOptions , SeqNo ,
3- } ;
1+ use lsm_tree:: { AbstractTree , Config , KvSeparationOptions , SeqNo } ;
42
53#[ test]
64fn tree_ingestion_tombstones_delete_existing_keys ( ) -> lsm_tree:: Result < ( ) > {
75 let folder = tempfile:: tempdir ( ) ?;
86 let tree = Config :: new ( folder, Default :: default ( ) ) . open ( ) ?;
9- let tree = match tree {
10- AnyTree :: Standard ( t) => t,
11- _ => unreachable ! ( ) ,
12- } ;
137
148 for i in 0 ..10u32 {
159 let key = format ! ( "k{:03}" , i) ;
1610 tree. insert ( key. as_bytes ( ) , b"v" , 0 ) ;
1711 }
1812
19- let mut ingest = Ingestion :: new ( & tree) ?. with_seqno ( 10 ) ;
13+ let mut ingest = tree. ingestion ( ) ?. with_seqno ( 10 ) ;
2014 for i in 0 ..10u32 {
2115 let key = format ! ( "k{:03}" , i) ;
2216 ingest. write_tombstone ( key. as_bytes ( ) . into ( ) ) ?;
@@ -38,17 +32,13 @@ fn blob_tree_ingestion_tombstones_delete_existing_keys() -> lsm_tree::Result<()>
3832 let tree = Config :: new ( folder, Default :: default ( ) )
3933 . with_kv_separation ( Some ( KvSeparationOptions :: default ( ) . separation_threshold ( 1 ) ) )
4034 . open ( ) ?;
41- let tree = match tree {
42- AnyTree :: Blob ( t) => t,
43- _ => unreachable ! ( ) ,
44- } ;
4535
4636 for i in 0 ..8u32 {
4737 let key = format ! ( "b{:03}" , i) ;
4838 tree. insert ( key. as_bytes ( ) , b"x" , 0 ) ;
4939 }
5040
51- let mut ingest = BlobIngestion :: new ( & tree) ?. with_seqno ( 10 ) ;
41+ let mut ingest = tree. ingestion ( ) ?. with_seqno ( 10 ) ;
5242 for i in 0 ..8u32 {
5343 let key = format ! ( "b{:03}" , i) ;
5444 ingest. write_tombstone ( key. as_bytes ( ) . into ( ) ) ?;
@@ -68,13 +58,9 @@ fn blob_tree_ingestion_tombstones_delete_existing_keys() -> lsm_tree::Result<()>
6858fn tree_ingestion_finish_no_writes_noop ( ) -> lsm_tree:: Result < ( ) > {
6959 let folder = tempfile:: tempdir ( ) ?;
7060 let tree = Config :: new ( folder, Default :: default ( ) ) . open ( ) ?;
71- let tree = match tree {
72- AnyTree :: Standard ( t) => t,
73- _ => unreachable ! ( ) ,
74- } ;
7561
7662 let before_tables = tree. table_count ( ) ;
77- Ingestion :: new ( & tree) ?. finish ( ) ?;
63+ tree. ingestion ( ) ?. finish ( ) ?;
7864 let after_tables = tree. table_count ( ) ;
7965
8066 assert_eq ! ( before_tables, after_tables) ;
@@ -89,10 +75,6 @@ fn blob_ingestion_only_tombstones_does_not_create_blob_files() -> lsm_tree::Resu
8975 let tree = Config :: new ( folder, Default :: default ( ) )
9076 . with_kv_separation ( Some ( KvSeparationOptions :: default ( ) . separation_threshold ( 1 ) ) )
9177 . open ( ) ?;
92- let tree = match tree {
93- AnyTree :: Blob ( t) => t,
94- _ => unreachable ! ( ) ,
95- } ;
9678
9779 for i in 0 ..5u32 {
9880 let key = format ! ( "d{:03}" , i) ;
@@ -101,7 +83,7 @@ fn blob_ingestion_only_tombstones_does_not_create_blob_files() -> lsm_tree::Resu
10183
10284 let before_blobs = tree. blob_file_count ( ) ;
10385
104- let mut ingest = BlobIngestion :: new ( & tree) ?. with_seqno ( 10 ) ;
86+ let mut ingest = tree. ingestion ( ) ?. with_seqno ( 10 ) ;
10587 for i in 0 ..5u32 {
10688 let key = format ! ( "d{:03}" , i) ;
10789 ingest. write_tombstone ( key. as_bytes ( ) . into ( ) ) ?;
@@ -125,15 +107,11 @@ fn blob_ingestion_finish_no_writes_noop() -> lsm_tree::Result<()> {
125107 let tree = Config :: new ( folder, Default :: default ( ) )
126108 . with_kv_separation ( Some ( KvSeparationOptions :: default ( ) . separation_threshold ( 1 ) ) )
127109 . open ( ) ?;
128- let tree = match tree {
129- AnyTree :: Blob ( t) => t,
130- _ => unreachable ! ( ) ,
131- } ;
132110
133111 let before_tables = tree. table_count ( ) ;
134112 let before_blobs = tree. blob_file_count ( ) ;
135113
136- BlobIngestion :: new ( & tree) ?. finish ( ) ?;
114+ tree. ingestion ( ) ?. finish ( ) ?;
137115
138116 let after_tables = tree. table_count ( ) ;
139117 let after_blobs = tree. blob_file_count ( ) ;
@@ -151,12 +129,8 @@ fn blob_ingestion_separates_large_values_and_reads_ok() -> lsm_tree::Result<()>
151129 let tree = Config :: new ( folder, Default :: default ( ) )
152130 . with_kv_separation ( Some ( KvSeparationOptions :: default ( ) . separation_threshold ( 8 ) ) )
153131 . open ( ) ?;
154- let tree = match tree {
155- AnyTree :: Blob ( t) => t,
156- _ => unreachable ! ( ) ,
157- } ;
158132
159- let mut ingest = BlobIngestion :: new ( & tree) ?. with_seqno ( 1 ) ;
133+ let mut ingest = tree. ingestion ( ) ?. with_seqno ( 1 ) ;
160134 ingest. write ( "k_big1" . as_bytes ( ) . into ( ) , vec ! [ 1u8 ; 16 ] . into ( ) ) ?;
161135 ingest. write ( "k_big2" . as_bytes ( ) . into ( ) , vec ! [ 2u8 ; 32 ] . into ( ) ) ?;
162136 ingest. write ( "k_small" . as_bytes ( ) . into ( ) , b"abc" . as_slice ( ) . into ( ) ) ?;
0 commit comments