Last active
September 23, 2017 04:55
-
-
Save sdleffler/fe569e2b880ac35f1b6b17dd91c144d3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[test] | |
fn read_write_remove_async() { | |
let mut cluster = connect_to_cluster().unwrap(); | |
let bytes: Vec<_> = (0..NUM_OBJECTS) | |
.map(|i| { | |
let mut buf = Vec::new(); | |
buf.extend( | |
XorShiftRng::from_seed([i as u32 + 1, 2, 3, 4]) | |
.gen_iter::<u8>() | |
.take(1 << 16), | |
); | |
buf | |
}) | |
.collect(); | |
let names: Vec<_> = (0..NUM_OBJECTS).map(|i| format!("obj-{}", i)).collect(); | |
let writes = (0..NUM_OBJECTS).map(|i| { | |
let mut pool = cluster.get_pool_context("rbd").unwrap(); | |
pool.write_full_async(&names[i], &bytes[i]) | |
.and_then(|()| { | |
pool.exists_async(&names[i]) | |
.and_then(|b| { | |
assert!(b); | |
pool.read_async(&names[i], vec![0u8; bytes[i].len()], 0) | |
.and_then(|buf| { | |
assert!(&buf == &bytes[i]); | |
pool.remove(&names[i]).and_then(|()| { | |
pool.exists_async(&names[i]).map(|b| { | |
assert!(!b); | |
}) | |
}) | |
}) | |
}) | |
}) | |
}); | |
let written = stream::iter_ok(writes) | |
.buffered(NUM_OBJECTS) | |
.collect() | |
.wait(); | |
} | |
error[E0308]: mismatched types | |
--> tests/integration/read_write_remove/mod.rs:102:41 | |
| | |
71 | fn read_write_remove_async() { | |
| - help: try adding a return type: `-> futures::Map<_, _> ` | |
... | |
102 | / pool.exists_async(&names[i]).map(|b| { | |
103 | | assert!(!b); | |
104 | | }) | |
| |__________________________________________^ expected enum `std::result::Result`, found struct `futures::Map` | |
| | |
= note: expected type `std::result::Result<_, rad::Error>` | |
found type `futures::Map<futures::Then<rad::rados::RadosFuture<()>, std::result::Result<bool, rad::Error>, fn(std::result::Result<(), rad::Error>) -> std::result::Result<bool, rad::Error>>, [closure@tests/integration/read_write_remove/mod.rs:102:74: 104:42]>` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment