tokahuke / yaque

Yaque is yet another disk-backed persistent queue for Rust.
Other
79 stars 11 forks source link

how to get queue length #15

Open farss opened 2 years ago

tokahuke commented 2 years ago

Queue length is a bit difficult to get atm due to the current architecture. Could you ellaborate on the exact use case to use the queue length explicitly? I have closed a similar issue (issue #7). Is your use case no covered by the features implemented there?

BradCage1994 commented 2 years ago

Hi i also need this functionality. I have limited memory available, so I want to be effective in my memory usage with the queue. The reason I can't use a single queue and limit his size is because I need to implement message pop at complexity of O(1), but I have different message types, and I want to pop message of type A at O(1). For that i want to manage multiple queues with a maximum total size. In order to manage the total size i need to check every queue size.

tokahuke commented 2 years ago

Oh, dear! Ok, this will be an interesting challenge. I will open a Pull Request, then!

tokahuke commented 2 years ago

Conceptually, you would need both read and write access to the queue, otherwise, I think we risk creating a race condition. @BradCage1994 do both ends of your queues reside in the same process?

BradCage1994 commented 2 years ago

no they dont

jeromegn commented 8 months ago

Reviving this old issue because it's somewhat related: We'd like to get queue length as well as other "metrics" so we can better monitor our queues.

barafael commented 3 months ago

yes, this is something we need as well. Directory size in bytes is fine too, though.

tokahuke commented 3 months ago

Directory size in bytes should be easy-peasy. Hopefully I will be able to focus on this soon. As I said, the real deal would be the exact number of elements. However, it seems that, for most applications this is what people need.

tokahuke commented 3 months ago

Two years later, we have a PR 🎉 : #35