tests fail

main
Ziyang Hu 2 years ago
parent 0b0ff6a30a
commit 9bb3d64aaa

@ -170,5 +170,6 @@ impl Tx {
IterBuilder {
inner: self.inner.pin_mut().iterator(),
}
.auto_prefix_mode(true)
}
}

@ -44,7 +44,7 @@ fn creation() {
);
assert!(tx.get("bye".as_bytes(), false).unwrap().is_none());
let mut it = tx.iterator().total_order_seek(true).start();
let mut it = tx.iterator().start();
it.seek_to_start();
while let Some((k, v)) = it.pair().unwrap() {
let mut res = String::from_utf8_lossy(k);

@ -65,21 +65,18 @@ impl EncodedVec<LARGE_VEC_SIZE> {
format!("{:?}{}", tx, op)
}
}
StorageTag::AttrById => {
StorageTag::AttrById | StorageTag::UniqueAttrById | StorageTag::UniqueAttrByKeyword => {
let op = StoreOp::try_from(data[0]).unwrap();
if data.len() <= 1 {
op.to_string()
} else {
format!("{}{:?}", op, Attribute::decode(&data[1..]).unwrap())
format!("{}{:?}", op, Attribute::decode(&data[VEC_SIZE_8..]).unwrap())
}
}
StorageTag::Tx => format!("{:?}", TxLog::decode(data).unwrap()),
StorageTag::UniqueEntity | StorageTag::UniqueAttrValue => {
format!("{:?}", TxId::from_bytes(data))
}
StorageTag::UniqueAttrById | StorageTag::UniqueAttrByKeyword => {
format!("{:?}", TxId::from_bytes(data))
}
}
}
}

@ -1,6 +1,6 @@
use crate::data::attr::{Attribute, AttributeCardinality, AttributeIndex, AttributeTyping};
use crate::data::encode::EncodedVec;
use crate::data::id::{AttrId, EntityId};
use crate::data::id::{AttrId, EntityId, Validity};
use crate::data::keyword::Keyword;
use crate::data::value::Value;
use crate::Db;
@ -21,8 +21,9 @@ fn test_send_sync<T: Send + Sync>(_: &T) {}
fn creation() {
let db = create_db("_test_db");
test_send_sync(&db);
let current_validity = Validity::current();
let session = db.new_session().unwrap();
let mut tx = session.transact(None).unwrap();
let mut tx = session.transact().unwrap();
assert_eq!(
0,
tx.all_attrs()
@ -48,7 +49,7 @@ fn creation() {
.attr_by_kw(&Keyword::try_from("hello/world").unwrap())
.unwrap()
.unwrap();
tx.new_triple(EntityId(1), &attr, &Value::Int(98765))
tx.new_triple(EntityId(1), &attr, &Value::Int(98765), current_validity)
.unwrap();
tx.commit_tx("haah", false).unwrap();
@ -64,7 +65,7 @@ fn creation() {
.unwrap();
tx.commit_tx("oops", false).unwrap();
let mut tx = session.transact(None).unwrap();
let mut tx = session.transact().unwrap();
let world_found = tx
.attr_by_kw(&Keyword::try_from("hello/world").unwrap())
.unwrap();
@ -82,7 +83,6 @@ fn creation() {
}
dbg!(&session);
dbg!(tx.r_tx_id);
let mut it = session.total_iter();
while let Some((k, v)) = it.pair().unwrap() {

@ -17,7 +17,7 @@ impl SessionTx {
return Ok(res.clone());
}
let anchor = encode_attr_by_id(aid, TxId::MAX_USER);
let anchor = encode_unique_attr_by_id(aid);
Ok(match self.tx.get(&anchor, false)? {
None => {
self.attr_by_id_cache.insert(aid, None);

Loading…
Cancel
Save