1use std::sync::{Arc, RwLock};
18
19use store_api::metadata::RegionMetadataRef;
20use store_api::storage::{ColumnId, SequenceNumber};
21use table::predicate::Predicate;
22
23use crate::error::Result;
24use crate::memtable::bulk::part::{BulkPart, EncodedBulkPart};
25use crate::memtable::key_values::KeyValue;
26use crate::memtable::{
27 BoxedBatchIterator, KeyValues, Memtable, MemtableId, MemtableRanges, MemtableRef,
28 MemtableStats, PredicateGroup,
29};
30
31#[allow(unused)]
32mod context;
33#[allow(unused)]
34pub(crate) mod part;
35mod part_reader;
36mod row_group_reader;
37
38#[derive(Debug)]
39pub struct BulkMemtable {
40 id: MemtableId,
41 parts: RwLock<Vec<EncodedBulkPart>>,
42}
43
44impl Memtable for BulkMemtable {
45 fn id(&self) -> MemtableId {
46 self.id
47 }
48
49 fn write(&self, _kvs: &KeyValues) -> Result<()> {
50 unimplemented!()
51 }
52
53 fn write_one(&self, _key_value: KeyValue) -> Result<()> {
54 unimplemented!()
55 }
56
57 fn write_bulk(&self, _fragment: BulkPart) -> Result<()> {
58 Ok(())
59 }
60
61 fn iter(
62 &self,
63 _projection: Option<&[ColumnId]>,
64 _predicate: Option<Predicate>,
65 _sequence: Option<SequenceNumber>,
66 ) -> Result<BoxedBatchIterator> {
67 todo!()
68 }
69
70 fn ranges(
71 &self,
72 _projection: Option<&[ColumnId]>,
73 _predicate: PredicateGroup,
74 _sequence: Option<SequenceNumber>,
75 ) -> Result<MemtableRanges> {
76 todo!()
77 }
78
79 fn is_empty(&self) -> bool {
80 self.parts.read().unwrap().is_empty()
81 }
82
83 fn freeze(&self) -> Result<()> {
84 Ok(())
85 }
86
87 fn stats(&self) -> MemtableStats {
88 todo!()
89 }
90
91 fn fork(&self, id: MemtableId, _metadata: &RegionMetadataRef) -> MemtableRef {
92 Arc::new(Self {
93 id,
94 parts: RwLock::new(vec![]),
95 })
96 }
97}