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