remove nodejs support
This commit is contained in:
@@ -59,78 +59,67 @@ pub async fn test_store_delete_load(ts: TableStore) {
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
db.load(0, b"foo").await.unwrap(),
|
||||
db.load(0, b"foo").unwrap(),
|
||||
None,
|
||||
"should not load missing key"
|
||||
);
|
||||
assert!(
|
||||
db.store(1, b"foo", b"1234567890").await.is_ok(),
|
||||
db.store(1, b"foo", b"1234567890").is_ok(),
|
||||
"should store new key"
|
||||
);
|
||||
assert_eq!(
|
||||
db.load(0, b"foo").await.unwrap(),
|
||||
db.load(0, b"foo").unwrap(),
|
||||
None,
|
||||
"should not load missing key"
|
||||
);
|
||||
assert_eq!(
|
||||
db.load(1, b"foo").await.unwrap(),
|
||||
Some(b"1234567890".to_vec())
|
||||
);
|
||||
assert_eq!(db.load(1, b"foo").unwrap(), Some(b"1234567890".to_vec()));
|
||||
|
||||
assert!(
|
||||
db.store(1, b"bar", b"FNORD").await.is_ok(),
|
||||
db.store(1, b"bar", b"FNORD").is_ok(),
|
||||
"should store new key"
|
||||
);
|
||||
assert!(
|
||||
db.store(0, b"bar", b"ABCDEFGHIJKLMNOPQRSTUVWXYZ")
|
||||
.await
|
||||
.is_ok(),
|
||||
db.store(0, b"bar", b"ABCDEFGHIJKLMNOPQRSTUVWXYZ").is_ok(),
|
||||
"should store new key"
|
||||
);
|
||||
assert!(
|
||||
db.store(2, b"bar", b"FNORD").await.is_ok(),
|
||||
db.store(2, b"bar", b"FNORD").is_ok(),
|
||||
"should store new key"
|
||||
);
|
||||
assert!(
|
||||
db.store(2, b"baz", b"QWERTY").await.is_ok(),
|
||||
db.store(2, b"baz", b"QWERTY").is_ok(),
|
||||
"should store new key"
|
||||
);
|
||||
assert!(
|
||||
db.store(2, b"bar", b"QWERTYUIOP").await.is_ok(),
|
||||
db.store(2, b"bar", b"QWERTYUIOP").is_ok(),
|
||||
"should store new key"
|
||||
);
|
||||
|
||||
assert_eq!(db.load(1, b"bar").await.unwrap(), Some(b"FNORD".to_vec()));
|
||||
assert_eq!(db.load(1, b"bar").unwrap(), Some(b"FNORD".to_vec()));
|
||||
assert_eq!(
|
||||
db.load(0, b"bar").await.unwrap(),
|
||||
db.load(0, b"bar").unwrap(),
|
||||
Some(b"ABCDEFGHIJKLMNOPQRSTUVWXYZ".to_vec())
|
||||
);
|
||||
assert_eq!(
|
||||
db.load(2, b"bar").await.unwrap(),
|
||||
Some(b"QWERTYUIOP".to_vec())
|
||||
);
|
||||
assert_eq!(db.load(2, b"baz").await.unwrap(), Some(b"QWERTY".to_vec()));
|
||||
assert_eq!(db.load(2, b"bar").unwrap(), Some(b"QWERTYUIOP".to_vec()));
|
||||
assert_eq!(db.load(2, b"baz").unwrap(), Some(b"QWERTY".to_vec()));
|
||||
|
||||
assert_eq!(db.delete(1, b"bar").await.unwrap(), true);
|
||||
assert_eq!(db.delete(1, b"bar").await.unwrap(), false);
|
||||
assert_eq!(db.delete(1, b"bar").unwrap(), true);
|
||||
assert_eq!(db.delete(1, b"bar").unwrap(), false);
|
||||
assert!(
|
||||
db.delete(4, b"bar").await.is_err(),
|
||||
db.delete(4, b"bar").is_err(),
|
||||
"can't delete from column that doesn't exist"
|
||||
);
|
||||
|
||||
drop(db);
|
||||
let db = ts.open("test", 3).await.expect("should have opened");
|
||||
|
||||
assert_eq!(db.load(1, b"bar").await.unwrap(), None);
|
||||
assert_eq!(db.load(1, b"bar").unwrap(), None);
|
||||
assert_eq!(
|
||||
db.load(0, b"bar").await.unwrap(),
|
||||
db.load(0, b"bar").unwrap(),
|
||||
Some(b"ABCDEFGHIJKLMNOPQRSTUVWXYZ".to_vec())
|
||||
);
|
||||
assert_eq!(
|
||||
db.load(2, b"bar").await.unwrap(),
|
||||
Some(b"QWERTYUIOP".to_vec())
|
||||
);
|
||||
assert_eq!(db.load(2, b"baz").await.unwrap(), Some(b"QWERTY".to_vec()));
|
||||
assert_eq!(db.load(2, b"bar").unwrap(), Some(b"QWERTYUIOP".to_vec()));
|
||||
assert_eq!(db.load(2, b"baz").unwrap(), Some(b"QWERTY".to_vec()));
|
||||
}
|
||||
|
||||
pub async fn test_cbor(ts: TableStore) {
|
||||
@@ -140,11 +129,11 @@ pub async fn test_cbor(ts: TableStore) {
|
||||
let db = ts.open("test", 3).await.expect("should have opened");
|
||||
let (dht_key, _) = generate_secret();
|
||||
|
||||
assert!(db.store_cbor(0, b"asdf", &dht_key).await.is_ok());
|
||||
assert!(db.store_cbor(0, b"asdf", &dht_key).is_ok());
|
||||
|
||||
assert_eq!(db.load_cbor::<DHTKey>(0, b"qwer").await.unwrap(), None);
|
||||
assert_eq!(db.load_cbor::<DHTKey>(0, b"qwer").unwrap(), None);
|
||||
|
||||
let d = match db.load_cbor::<DHTKey>(0, b"asdf").await {
|
||||
let d = match db.load_cbor::<DHTKey>(0, b"asdf") {
|
||||
Ok(x) => x,
|
||||
Err(e) => {
|
||||
panic!("couldn't decode cbor: {}", e);
|
||||
@@ -153,12 +142,12 @@ pub async fn test_cbor(ts: TableStore) {
|
||||
assert_eq!(d, Some(dht_key), "keys should be equal");
|
||||
|
||||
assert!(
|
||||
db.store(1, b"foo", b"1234567890").await.is_ok(),
|
||||
db.store(1, b"foo", b"1234567890").is_ok(),
|
||||
"should store new key"
|
||||
);
|
||||
|
||||
assert!(
|
||||
db.load_cbor::<DHTKey>(1, b"foo").await.is_err(),
|
||||
db.load_cbor::<DHTKey>(1, b"foo").is_err(),
|
||||
"should fail to load cbor"
|
||||
);
|
||||
}
|
||||
|
@@ -203,11 +203,11 @@ fn config_callback(key: String) -> ConfigCallbackReturn {
|
||||
"network.routing_table.limit_attached_good" => Ok(Box::new(8u32)),
|
||||
"network.routing_table.limit_attached_weak" => Ok(Box::new(4u32)),
|
||||
"network.rpc.concurrency" => Ok(Box::new(2u32)),
|
||||
"network.rpc.queue_size" => Ok(Box::new(128u32)),
|
||||
"network.rpc.queue_size" => Ok(Box::new(1024u32)),
|
||||
"network.rpc.max_timestamp_behind_ms" => Ok(Box::new(Some(10_000u32))),
|
||||
"network.rpc.max_timestamp_ahead_ms" => Ok(Box::new(Some(10_000u32))),
|
||||
"network.rpc.timeout_ms" => Ok(Box::new(10_000u32)),
|
||||
"network.rpc.max_route_hop_count" => Ok(Box::new(7u8)),
|
||||
"network.rpc.max_route_hop_count" => Ok(Box::new(4u8)),
|
||||
"network.rpc.default_route_hop_count" => Ok(Box::new(2u8)),
|
||||
"network.dht.resolve_node_timeout_ms" => Ok(Box::new(Option::<u32>::None)),
|
||||
"network.dht.resolve_node_count" => Ok(Box::new(20u32)),
|
||||
@@ -323,9 +323,9 @@ pub async fn test_config() {
|
||||
assert_eq!(inner.network.bootstrap, Vec::<String>::new());
|
||||
assert_eq!(inner.network.bootstrap_nodes, Vec::<String>::new());
|
||||
assert_eq!(inner.network.rpc.concurrency, 2u32);
|
||||
assert_eq!(inner.network.rpc.queue_size, 128u32);
|
||||
assert_eq!(inner.network.rpc.queue_size, 1024u32);
|
||||
assert_eq!(inner.network.rpc.timeout_ms, 10_000u32);
|
||||
assert_eq!(inner.network.rpc.max_route_hop_count, 7u8);
|
||||
assert_eq!(inner.network.rpc.max_route_hop_count, 4u8);
|
||||
assert_eq!(inner.network.rpc.default_route_hop_count, 2u8);
|
||||
assert_eq!(inner.network.routing_table.limit_over_attached, 64u32);
|
||||
assert_eq!(inner.network.routing_table.limit_fully_attached, 32u32);
|
||||
|
Reference in New Issue
Block a user