Random Access to Chronicle Queue?

133 views
Skip to first unread message

Francis Lalonde

unread,
Dec 27, 2015, 11:11:53 AM12/27/15
to Chronicle
Is it possible to randomly read or update excerpts within a Queue? I could not find methods to do this in the Javadoc or examples.

I have an application metric library that writes to an event log and publishes stats based on time or task triggers. It currently uses on-heap pages of primitive arrays for the log and navigable tree maps for indexes - I'd like to use off-heap file backed structure instead. Writes are mostly sequential - only timer stops events go back to update reserved timestamps. Reads are forward-only but may start anywhere in the log and skip any number of events - I could do without a treemap if I could bisect across the queue to start at the right place. Both cases (timer stops and bisecting reads) would require position-indexed access to the queue, something like a a List.get(long id). All accesses are single-threaded - concurrency is not an issue.

Do you have any hints on how I could implement this? I also looked at MapDB, but the mosty sequential nature and real-time nature of the data seems to make Chronicle a better fit.

Francis

Luca Burgazzoli

unread,
Dec 27, 2015, 2:08:20 PM12/27/15
to java-ch...@googlegroups.com
Yes you can pick up any excerpt by setting the index like:

Excerpt ex= chronicle.createExcerpt()
ex.index(...)

Which index refers to your data is something you have to implement in your application. Once you have the excerpt you can read/update using read/write methods. 

If you have the chance best would be to use a data-value class so you do not need to worry about positions.


--
You received this message because you are subscribed to the Google Groups "Chronicle" group.
To unsubscribe from this group and stop receiving emails from it, send an email to java-chronicl...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
lb

Francis Lalonde

unread,
Dec 30, 2015, 12:16:26 PM12/30/15
to Chronicle
Thanks! Is the index absolute in time or relative to the current head?

Luca Burgazzoli

unread,
Dec 30, 2015, 12:37:22 PM12/30/15
to java-ch...@googlegroups.com
Absolute for vanilla, relative to the data file for indexed
--
You received this message because you are subscribed to the Google Groups "Chronicle" group.
To unsubscribe from this group and stop receiving emails from it, send an email to java-chronicl...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
lb
Reply all
Reply to author
Forward
0 new messages