Remove Table and VectorTable

This commit is contained in:
2019-10-29 09:10:27 +01:00
parent 7a0fbc612f
commit 8699c066e5
4 changed files with 10 additions and 44 deletions

View File

@@ -30,8 +30,6 @@ path = "src/main.rs"
ironsea_index = "^0.1"
ironsea_index_sfc_dbc = "^0.1"
ironsea_index_hashmap = "^0.1"
ironsea_table = "^0.1"
ironsea_table_vector = "^0.1"
memmap = "^0.7"
lazy_static = "^1.3"

View File

@@ -7,7 +7,6 @@ use std::collections::HashMap;
use std::fs::File;
use ironsea_index::Indexed;
use ironsea_table_vector::VectorTable;
use memmap::Mmap;
pub use db_core::Core;
@@ -18,8 +17,8 @@ use space::Space;
pub use space_index::SpaceSetObject;
pub type ResultSet = Result<Vec<SpaceObject>, String>;
pub type ReferenceSpaceIndex = ironsea_index_hashmap::Index<VectorTable<Space>, Space, String>;
type CoreIndex = ironsea_index_hashmap::Index<VectorTable<Core>, Core, String>;
pub type ReferenceSpaceIndex = ironsea_index_hashmap::Index<Space, String>;
type CoreIndex = ironsea_index_hashmap::Index<Core, String>;
#[derive(Clone, Debug, Deserialize, Hash, PartialEq, Serialize)]
pub struct SpaceId(String);
@@ -65,8 +64,8 @@ pub struct DataBase {
impl DataBase {
pub fn new(spaces: Vec<Space>, cores: Vec<Core>) -> Self {
DataBase {
reference_spaces: ReferenceSpaceIndex::new(VectorTable::new(spaces)),
cores: CoreIndex::new(VectorTable::new(cores)),
reference_spaces: ReferenceSpaceIndex::new(spaces.into_iter()),
cores: CoreIndex::new(cores.into_iter()),
}
}

View File

@@ -5,8 +5,6 @@ use std::collections::HashSet;
use std::hash::Hash;
use std::hash::Hasher;
use ironsea_table_vector::VectorTable;
use super::space::Coordinate;
use super::space::Position;
use super::space::Shape;
@@ -101,11 +99,7 @@ impl SpaceDB {
let shift = if count >= 31 { 31 } else { count };
count += 1;
indices.push((
SpaceSetIndex::new(
&VectorTable::new(space_objects.to_vec()),
DIMENSIONS,
CELL_BITS,
),
SpaceSetIndex::new(space_objects.into_iter(), DIMENSIONS, CELL_BITS),
vec![power.0, power.0, power.0],
shift,
));
@@ -124,11 +118,7 @@ impl SpaceDB {
// Insert Full resolution index.
indices.push((
SpaceSetIndex::new(
&VectorTable::new(space_objects.clone()),
DIMENSIONS,
CELL_BITS,
),
SpaceSetIndex::new(space_objects.into_iter(), DIMENSIONS, CELL_BITS),
vec![count, count, count],
0, // Smallest value => highest resolution
));
@@ -167,11 +157,7 @@ impl SpaceDB {
}
indices.push((
SpaceSetIndex::new(
&VectorTable::new(space_objects.to_vec()),
DIMENSIONS,
CELL_BITS,
),
SpaceSetIndex::new(space_objects.into_iter(), DIMENSIONS, CELL_BITS),
vec![count, count, count],
shift,
));
@@ -186,7 +172,7 @@ impl SpaceDB {
} else {
// Generate only full-scale.
indices.push((
SpaceSetIndex::new(&VectorTable::new(space_objects), DIMENSIONS, CELL_BITS),
SpaceSetIndex::new(space_objects.into_iter(), DIMENSIONS, CELL_BITS),
vec![0, 0, 0],
0,
));

View File

@@ -1,7 +1,6 @@
use std::cmp::Ord;
use ironsea_index::IndexedOwned;
use ironsea_table_vector::VectorTable;
use ironsea_index::IndexedDestructured;
use super::space::Coordinate;
use super::space::Position;
@@ -82,23 +81,7 @@ impl ironsea_index::RecordFields<SpaceFields> for SpaceSetObject {
}
}
impl ironsea_index::RecordBuild<Position, SpaceFields, SpaceSetObject> for SpaceSetObject {
fn build(key: &Position, fields: &SpaceFields) -> SpaceSetObject {
SpaceSetObject {
space_id: fields.space_id.clone(),
position: key.clone(),
value: fields.value,
}
}
}
pub type SpaceSetIndex = ironsea_index_sfc_dbc::IndexOwned<
VectorTable<SpaceSetObject>,
SpaceSetObject,
Position,
Coordinate,
SpaceFields,
>;
pub type SpaceSetIndex = ironsea_index_sfc_dbc::IndexOwned<SpaceFields, Position, Coordinate>;
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct SpaceIndex {