tokahuke / yaque

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

Determining length of queue at startup #34

Open jadamcrain opened 7 months ago

jadamcrain commented 7 months ago

Hi! Cool library.

My use case is an IoT system where data is buffered for transmission. In the event of flaky comms, I need to buffer data to disk instead of memory, so this library looks great for this use case. I'm implementing a hybrid memory/disk queue using Yaque and a VecDeque. The idea is that the a fixed amount of memory will be dedicated for buffering, and if the memory limit is exceeded, we'll start buffering to Yaque. Popping elements for transmission will entail loading from Yaque if disk buffering has occurred.

What's the best way to determine the queue length during program initialization?

Is the answer here to just create QueueIter and count them?

tokahuke commented 5 months ago

Hey, @jadamcrain see PR #35. Will that solve your issue?

jadamcrain commented 5 months ago

My use case was more about knowing the # of elements in the queue, rather than the total size of all the elements in bytes. That said, feel free to close the issue. I'm handling this with a different persistent back-end.