Can build indexes on new columns

This commit is contained in:
Yuriy Dupyn 2024-02-05 00:44:14 +01:00
parent 8139112934
commit b0f05f36f2
5 changed files with 110 additions and 14 deletions

View file

@ -184,9 +184,16 @@ impl <T>Store<T> {
WriteCursor::new(self).await
}
pub async fn make_indexable(&mut self, column: Column) -> Result<()> {
// Creates an index from scratch at above column
todo!()
// ===Indexes===
pub async fn attach_index(&mut self, column: Column) -> Result<()>
where T: Ord + Decode + Encode + Send + Sync
{
if self.header.is_column_indexed(column) {
Err(Error::ColumnAlreadyIndexed(column))
} else {
let mut cursor = self.write_cursor().await?;
cursor.attach_index(column).await
}
}
// For debugging.