Oddly whitespace damaged mail..
On Fri, 2008-09-19 at 14:33 -0700, Martin Bligh wrote:
I'd hoped for an interface like:
struct ringbuffer *ringbuffer_alloc(const char *name, size_t size);
void ringbuffer_free(struct ringbuffer *buffer);
int ringbuffer_write(struct ringbuffer *buffer, const char *buf, size_t size);
int ringbuffer_read(struct ringbuffer *buffer, int cpu, char *buf, size_t size);
On top of which you'd do the event thing, the register event with a
callback idea makes sense, except I'd split the consumption into two:
- one method to pull the binary event out, which knows how long it
ought to be etc..
- one method to convert the binary event to ASCII
You don't always need the latter one, esp if you're dumping to disk.
You can also generalize the merge sorting forward iterator when you have
that, by providing an event compare function.
By doing it like this folks can focus on utterly optimizing the
ringbuffer to death, and other folks can toy around with doing fancy
event encodings (/me pitches asn.1-der encoded structured data and runs
like crazy)
--