mod datastore;
mod managers;
pub use self::datastore::RocksdbDatastore;
#[cfg(feature = "bench-suite")]
full_bench_impl!({
use super::RocksdbDatastore;
use tempfile::tempdir;
let path = tempdir().unwrap().into_path();
RocksdbDatastore::new_db_with_options(path, &RocksdbDatastore::get_options(Some(1))).unwrap()
});
#[cfg(feature = "test-suite")]
#[cfg(test)]
mod tests {
use crate::QueryExt;
use tempfile::tempdir;
#[cfg(feature = "test-suite")]
full_test_impl!({
use super::RocksdbDatastore;
use tempfile::tempdir;
let path = tempdir().unwrap().into_path();
RocksdbDatastore::new_db_with_options(path, &RocksdbDatastore::get_options(Some(1))).unwrap()
});
#[test]
fn should_repair() {
use super::RocksdbDatastore;
use tempfile::tempdir;
let dir = tempdir().unwrap();
RocksdbDatastore::new_db_with_options(dir.path(), &RocksdbDatastore::get_options(Some(1))).unwrap();
RocksdbDatastore::repair(dir.path(), &RocksdbDatastore::get_options(Some(1))).unwrap();
}
#[test]
fn test_repeated_reverse_fetch_operation() {
let path = tempdir().unwrap().into_path();
for _i in 0..2 {
let db: crate::Database<crate::RocksdbDatastore> = crate::RocksdbDatastore::new_db(&path).unwrap();
let out_v = crate::Vertex::new(crate::Identifier::new("person").unwrap());
let in_v = crate::Vertex::new(crate::Identifier::new("movie").unwrap());
db.create_vertex(&out_v).unwrap();
db.create_vertex(&in_v).unwrap();
let edge = crate::Edge::new(out_v.id, crate::Identifier::new("likes").unwrap(), in_v.id);
db.create_edge(&edge).unwrap();
let output_failed = db
.get(crate::SpecificVertexQuery::new(vec![in_v.id]).inbound().unwrap())
.unwrap();
let e = crate::util::extract_edges(output_failed).unwrap();
assert_eq!(e.len(), 1);
assert_eq!(edge, e[0]);
assert_eq!(edge.inbound_id, in_v.id);
assert_eq!(edge.outbound_id, out_v.id);
}
}
}