Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clustering #145

Merged
merged 14 commits into from
Feb 15, 2019
Merged

Clustering #145

merged 14 commits into from
Feb 15, 2019

Conversation

hntd187
Copy link
Member

@hntd187 hntd187 commented Feb 5, 2019

No description provided.

}

// Should I do this? with the tokio::run
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that this matters at all in tests, maybe it's better to keep a standard by using tokio::run everywhere.

Copy link
Member

@LucioFranco LucioFranco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking fantastic! 🔥

res.into_inner()
})
.map_err(|e| {
info!("ERR = {:?}", e);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prob want this to be an error! 😄


Box::new(fut)
Box::new(future::join_all(fut))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This actually has a concrete type so we don't have to box here but I have some ideas around this and its not a big deal right now but down the road we want to remove all these boxes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so you'd want the return type to be a JoinAll ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can, that would remove the need for a Box call. though may be harder than that if we use the combinators, though I wouldnt worry about this now. I have some ideas how we can improve this in the future.

fn list_indexes(&mut self, _: Request<ListRequest>) -> Self::ListIndexesFuture {
if let Ok(ref mut cat) = self.catalog.read() {
if let Ok(ref cat) = self.catalog.read() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this call block? if so we should probably wrap this call in a blocking https://docs.rs/tokio-threadpool/0.1.11/tokio_threadpool/fn.blocking.html

let result = Some(RpcServer::create_result(0, "".into()));
let resp = Response::new(RpcServer::create_search_reply(result, query_bytes));
future::finished(resp)
if let Ok(ref cat) = self.catalog.read() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here


fn place_index(&mut self, request: Request<PlaceRequest>) -> Self::PlaceIndexFuture {
let PlaceRequest { index, schema } = request.into_inner();
if let Ok(ref mut cat) = self.catalog.write() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

}

// Should I do this? with the tokio::run
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably want to use Runtime::block_on one of the things I have been meaning to add to tokio is a tokio_test::block_on that should make this a bit easier.

}

pub fn remote_exists(&self, index: &str) -> bool {
self.get_remote_collection().lock().unwrap().contains_key(index)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably want to use lock()? like you do below

dbg!(&search);
self.get_index(index)
.and_then(move |hand| hand.search_index(search).map(|r| vec![r]))
.into_future()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you don't need this into future here


tokio::run(s);
rt.block_on(s);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah this is what tokio_test::block_on will do pretty much. though I think without the shutdown_on_idle but shutdown_now.

@hntd187 hntd187 merged commit c6981d0 into master Feb 15, 2019
@hntd187 hntd187 deleted the clustering branch February 15, 2019 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants