Fix indexes types
This commit is contained in:
parent
89305b6126
commit
4c0f91ad33
3 changed files with 36 additions and 18 deletions
|
|
@ -34,7 +34,7 @@ pub struct Store<T> {
|
|||
// All
|
||||
pub header: StoreHeader,
|
||||
pub data_type: PhantomData<T>,
|
||||
pub primary_index: Index<T, FilePosition>,
|
||||
pub indexes: Vec<Option<Index<T, FilePosition>>>,
|
||||
}
|
||||
|
||||
pub type PositionOfValue = FilePosition;
|
||||
|
|
@ -70,14 +70,18 @@ impl <T>Store<T> {
|
|||
// We don't need the file right now. Only cursors will later open it.
|
||||
Self::create_empty_rows_file(path_to_rows, &header).await?;
|
||||
|
||||
let primary_index: Index<T, FilePosition> = Index::new(
|
||||
&format!("rows_{}", primary_column.to_string()),
|
||||
).await?;
|
||||
// TODO: I need to construct indexes
|
||||
// let primary_index: Index<T, FilePosition> = Index::new(
|
||||
// &format!("rows_{}", primary_column.to_string()),
|
||||
// ).await?;
|
||||
|
||||
// TODO
|
||||
let indexes = vec![];
|
||||
|
||||
let store = Self {
|
||||
header,
|
||||
data_type: PhantomData::<T>,
|
||||
primary_index,
|
||||
indexes,
|
||||
};
|
||||
|
||||
Ok(store)
|
||||
|
|
@ -118,31 +122,39 @@ impl <T>Store<T> {
|
|||
let header = StoreHeader::decode(table_folder, &mut header_bytes).await?;
|
||||
|
||||
|
||||
let primary_index: Index<T, FilePosition> = Index::connect(
|
||||
&format!("rows_{}", header.primary_column.to_string()),
|
||||
).await?;
|
||||
// let primary_index: Index<T, FilePosition> = Index::connect(
|
||||
// &format!("rows_{}", header.primary_column.to_string()),
|
||||
// ).await?;
|
||||
|
||||
// TODO
|
||||
let indexes = vec![];
|
||||
|
||||
let store = Self {
|
||||
header,
|
||||
data_type: PhantomData::<T>,
|
||||
primary_index
|
||||
indexes,
|
||||
};
|
||||
Ok(store)
|
||||
}
|
||||
|
||||
// ===Cursors===
|
||||
pub async fn read_cursor(&self) -> Result<ReadCursor<T>>
|
||||
pub async fn read_cursor(&self) -> Result<ReadCursor<T>>
|
||||
where T: Send + Sync
|
||||
{
|
||||
ReadCursor::new(self).await
|
||||
}
|
||||
|
||||
pub async fn write_cursor(&mut self) -> Result<WriteCursor<T>>
|
||||
pub async fn write_cursor(&mut self) -> Result<WriteCursor<T>>
|
||||
where T: Send + Sync
|
||||
{
|
||||
WriteCursor::new(self).await
|
||||
}
|
||||
|
||||
pub async fn make_indexable(&mut self, column: Column) -> Result<()> {
|
||||
// Creates an index from scratch at above column
|
||||
todo!()
|
||||
}
|
||||
|
||||
// For debugging.
|
||||
pub async fn read_all_bytes(&mut self) -> std::result::Result<Vec<u8>, std::io::Error>
|
||||
where T: Send + Sync
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue