Giter Site home page Giter Site logo

Comments (12)

jimmycuadra avatar jimmycuadra commented on June 15, 2024 2

I'm working on updating this crate to user hyper 0.11, which uses an async model based on futures and tokio. You can cancel a future by simply dropping it (letting it go out of scope). I'll see how this plays out for a watch cancellation API as I get further into it.

from rust-etcd.

jimmycuadra avatar jimmycuadra commented on June 15, 2024

Right now it blocks until a change happens or until there is a network error of some sort. Being able to cancel it early seems like a good idea. What sort of API do you imagine for it? In the meantime, you could run the watch inside a thread and kill the thread if you need to cancel the watch early.

from rust-etcd.

arthurprs avatar arthurprs commented on June 15, 2024

The problem is that Rust doesn't provide any reasonable way to kill a thread right now (and probably never will). At least as far as I know.

I checked hyper and I couldn't see any support for canceling either so I ran out of ideas.

from rust-etcd.

jmlMetaswitch avatar jmlMetaswitch commented on June 15, 2024

A time-out and/or a non-blocking method would be a good start (like mpsc). I assume Hyper supports this.

I see you've been asking about time-outs in hyperium/hyper#417, but it appears that client.set_read_timeout() has been added now (https://hyper.rs/hyper/0.8.0/hyper/client/struct.Client.html).

I'm guessing that HTTP makes a non-blocking method harder.

Would you consider adding a time-out for watches, so that we can then intermittently check whether to terminate in watch threads?

from rust-etcd.

jmlMetaswitch avatar jmlMetaswitch commented on June 15, 2024

Just so you know, I fully support you spending your free time on this issue, @jimmycuadra! Thank you :-)

I don't suppose you have an idea when this work might be available, do you?

from rust-etcd.

jimmycuadra avatar jimmycuadra commented on June 15, 2024

No ETA, but I'll try to make some more progress on this soon!

from rust-etcd.

jimmycuadra avatar jimmycuadra commented on June 15, 2024

I worked on it a bit tonight but it's pretty tough and progress is slow. If you'd like to see what I have so far, take a look at the "async" branch.

from rust-etcd.

jmlMetaswitch avatar jmlMetaswitch commented on June 15, 2024

Thanks. I'll probably have to read up on hyper first, but that wouldn't be a bad thing!

from rust-etcd.

jimmycuadra avatar jimmycuadra commented on June 15, 2024

Update: Made lots of progress. The next version of the crate is largely done. I still need to update the tests to use the new async functions and improve some docs. Then I will take a look at the watch function and make sure there's a good way to cancel the watch.

from rust-etcd.

jmlMetaswitch avatar jmlMetaswitch commented on June 15, 2024

Great. Really appreciate your work on this.

from rust-etcd.

jmlMetaswitch avatar jmlMetaswitch commented on June 15, 2024

This looks great. Thanks. Are you planning to move up to a new release soon, or are you planning to get more features in first?

from rust-etcd.

jimmycuadra avatar jimmycuadra commented on June 15, 2024

I'm gonna add the members and auth API and then make a new release.

from rust-etcd.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.