andrewjstone / ferris Goto Github PK
View Code? Open in Web Editor NEWA hierarchical timer wheel in Rust
License: Apache License 2.0
A hierarchical timer wheel in Rust
License: Apache License 2.0
Currently there is no way to check if a timer already exists for a key (and if it does, how long remains). This would be really handy for debugging, even though it probably has limited use-cases for production code.
The API currently doesn't allow clients to inspect the list of timers in any way, even for debugging. Implementing fmt::Debug
and/or providing a .timers()
method that gives an iterator over the registered timers would be extremely handy.
ferris
currently operates on time::Duration
from the (deprecated) time
crate. It would be great if it could instead use the standard Duration
struct from std::time
.
Imagine you have a set of timers, but you need to do a blocking operation (like a read
system call). You'd like to set a timeout for the system call so that you can detect expired timers in a timely fashion, because the block could last for a long time. There isn't currently a way in ferris
to get the time until the nearest timeout expires, which would be necessary to provide this kind of functionality. Instead, you have to set a timeout on the order of your finest resolution, which can result in lots of unnecessary wakeups.
this needs migration of timers between inner wheels per original paper, the way it's rounding up is up to 50% error on the timer as far I see the code right now. Still looking ...
I completely misunderstood the semantics of expire
. I assumed that every time I call it, it will give me any expired timers based on the current time. However, after reading the code (and re-reading the top-level documentation), this does not seem to be the case. Instead, it seems like expire
is more like a tick
function that must be called exactly every resolution time units, and will return any timers that expired that time unit, which is a very different interface from what I had in mind.
For me personally, this probably means that ferris
isn't for me; I specifically want it to work with wall-clock time without requiring exactly regular calls to expire
. That doesn't mean that ferris
is bad in any way (I partially understand why the interface is this way), but I do think this fact need to be clearly stated, and be reinforced by the method names and type signatures. For example, using Duration
is misleading when the methods (again, unless I've misunderstood) do not actually use wall-clock time for anything. Instead, it's more like "number of ticks", which is just a usize
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.