On Sat, 10 Dec 2011 23:27:02 -0400, David Bremner <david at tethera.net> wrote: > This uses the jlog library (http://labs.omniti.com/labs/jlog) > to atomically log messages in pub-sub model.
Some more explanations. Part 1: pub-what? ================= What is pub-sub? Conceptually you can think of it as a set of queues where each "published" message is magically replicated and put in the queue of each "subscriber". Of course in practice one only needs one queue, and to keep track of how far each subscriber has read. So, we have a queue, and one head pointer per subscriber. We can discard anything in the queue that all of the subscribers have read past. In jlog this data structure is on disk, which is why it is called "durable". This means there are no sockets to communicate between the publisher (notmuch) and the subscribers (e.g. a proposed tag synching tool, described more below). The interact via a directory (currently under .notmuch). Because the datastructure on disk is not completely trivial (not that fancy either, but more than a stream of bytes) both writers and readers need to use the jlog library to interact with the queue. "notmuch log" is one such reader. I'm not that invested in jlog, but I looked around and didn't find any other similar solutions that had some atomicity guarantees without some kind of broker (read yet another daemon running on the machine). > On this branch you can enable logging of tagging operations by > > notmuch config set log.subscribers 'name1;name2;name3' The command "notmuch log" lets one read the queue from the shell. "notmuch log name1" dumps any messages (only the string content; there are timestamps but these are currently ignored) queued for "name1" to stdout. So one can interact with this queue without learning about the jlog api (or more precisely, without copy-pasting the example programs