On Wed, Feb 27, 2002, Henrik Nordstrom wrote:
> Hi Adrian.
>
> Can you give a quite outline of how one converts old-style store
> clients?
>
> I have a couple of new store clients in the etag branch, actually
> making use of the seen offset there to simplify the processing
> slightly.. (rounds the read data down to full complete parseable
> pieces, ignoring any partial data close to block boundary)
Uhm,
I'd look at the stuff I did in peer_digest.c . I wrote
a little transition layer and used the chain of callbacks
manipulating the data into a little state-engine.
The bit you really should look at is this:
* storeClientCopy() into a buffer
loop:
* parse the buffer that you can
* get the chunk of unparsed data, move it to the beginning of the
buffer
* do another storeClientCopy(), but into the buffer _after_ the
unparsed data
* when storeClientCopy() calls your callback, take the size it
returns (the bit it read), combine it with the size of the
buffer chunk you previously copied (the bufofs you'll see around
the place now) and that becomes your buffer size
* goto loop
Remember - once you've receved some data from storeClientCopy(),
its lost forever (for that storeclient).
.. which can be easy (asn.c), reasonably easy (netdb.c), and really
damned evil (ims handling, and peer_digest.c). Out of all the
changes I made, peer_digest.c was the cleanest and I suggest looking
at that as an example of what to do.
adrian
Received on Wed Mar 06 2002 - 01:08:49 MST
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:14:50 MST