Comments (12)
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.
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.
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.
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.
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.
No ETA, but I'll try to make some more progress on this soon!
from rust-etcd.
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.
Thanks. I'll probably have to read up on hyper first, but that wouldn't be a bad thing!
from rust-etcd.
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.
Great. Really appreciate your work on this.
from rust-etcd.
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.
I'm gonna add the members and auth API and then make a new release.
from rust-etcd.
Related Issues (14)
- Mimic --forever option of etcdctl watch HOT 2
- Build failure under Rust 0.11.0 HOT 3
- Support for etcd3 HOT 16
- Multithread support HOT 2
- Support for managing users, roles HOT 6
- Connection leak from watch timeout. HOT 5
- watch_recursive test is not deterministic HOT 1
- There is no isLeader attribute in the result of member list HOT 2
- 0.9.0 does not with tokio 1.x
- Allow using certificates to connect to the cluster.
- Relicense under dual MIT/Apache-2.0
- etcd 2.2 HOT 3
- build fails to resolve syntex::Registry HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rust-etcd.