mit-pdos / noria

Fast web applications through dynamic, partially-stateful dataflow
Apache License 2.0
4.97k stars 241 forks source link

insert_all method not found in `noria::table::Table` #164

Closed anandijain closed 4 years ago

anandijain commented 4 years ago

I am probably doing something dumb, but I am trying to use the insert_all function, but it doesn't seem to exist.

// schema not needed for mre //
let mut votes = db.table("votes").await.unwrap();
let noria_recs: Vec<Vec<DataType>> = ...
votes.insert_all(noria_recs).await.unwrap();

gives: no method named insert_all found for struct noria::table::Table in the current scope: method not found in noria::table::Table

The definition for insert_all is

pub fn insert_all<I, V>(&mut self, i: I) -> Result<(), TableError> 
where    
I: IntoIterator<Item = V>,   
V: Into<Vec<DataType>>, 

which I believe a Vec impls IntoIterator.

I think a code snippet in the docs would be helpful

-- versions -- My Cargo.toml has noria = "0.5.0" rustc 1.45.0-nightly (47c3158c3 2020-06-04)

jonhoo commented 4 years ago

Ah, you are looking at some very outdated documentation. If that's still linked from somewhere, we should remove that. Unfortunately, docs.rs also can't build the docs at the moment (see https://github.com/mit-pdos/noria/issues/153), so to see the actual docs you'll want to clone the git repository and then do:

$ cargo doc --lib -p noria
anandijain commented 4 years ago

thank you, I need to get better at reading docs w cargo. I just pulled and cargo doc --lib -p noria but I get:

 Documenting noria v0.5.0 (/home//programming/clones/noria/noria)
error[E0432]: unresolved import `tokio::task_local`
   --> noria/src/lib.rs:229:5
    |
229 | use tokio::task_local;
    |     ^^^^^^^^^^^^^^^^^ no `task_local` in the root

error: cannot determine resolution for the macro `task_local`
   --> noria/src/lib.rs:250:1
    |
250 | task_local! {
    | ^^^^^^^^^^
jonhoo commented 4 years ago

Huh, interesting. Can you try a cargo update?

anandijain commented 4 years ago

after cargo update and rerunning cargo doc --lib -p noria gives:

...
Documenting tower-limit v0.3.1
   Checking mysql_common v0.22.1
error[E0277]: the trait bound `(): core::future::future::Future` is not satisfied
  --> /home//.cargo/git/checkouts/tokio-tower-98a883543a8cb142/346858d/src/multiplex/client.rs:96:5
   |
96 |     type Future = impl Future<Output = Result<Self::Response, Self::Error>> + Send;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `core::future::future::Future` is not implemented for `()`
   |
   = note: the return type of a function must have a statically known size
...
3 more futures errors
...
error: Could not document `tokio-tower`.
jonhoo commented 4 years ago

Ah, man, yeah, that's https://github.com/mit-pdos/noria/issues/153, which in turn is https://github.com/rust-lang/rust/issues/65863. Unfortunately not much I can do about that. I think for now you're stuck with having to look at noria/src/table.rs yourself and look at the public methods then :'(

anandijain commented 4 years ago

idk why i didn't think of that, ty

anandijain commented 4 years ago

perform_all makes a lot of sense, rather than having a separate function for each TableOperation