| 176 | |
| 177 | impl WAL { |
| 178 | pub fn new(path: PathBuf, namespace_id: String) -> io::Result<Self> { |
| 179 | let commit_list_path = path.clone().join("commit_list.bin"); |
| 180 | let commit_list = Tree::<u64, CommitListItem>::new(commit_list_path)?; |
| 181 | let timestamps_path = path.clone().join("timestamps.bin"); |
| 182 | let timestamps = Tree::<u64, Vec<u64>>::new(timestamps_path)?; |
| 183 | let commit_finish_path = path.clone().join("commit_finish.bin"); |
| 184 | let commit_finish = Tree::<u64, bool>::new(commit_finish_path)?; |
| 185 | |
| 186 | Ok(WAL { |
| 187 | commit_list, |
| 188 | path, |
| 189 | namespace_id, |
| 190 | timestamps, |
| 191 | commit_finish, |
| 192 | }) |
| 193 | } |
| 194 | |
| 195 | pub fn add_to_commit_list( |
| 196 | &mut self, |