Re: eventio API

From: Robert Collins <robert.collins@dont-contact.us>
Date: Wed, 21 Feb 2001 08:01:34 +1100

----- Original Message -----
From: "Alex Rousskov" <rousskov@measurement-factory.com>
To: "Henrik Nordstrom" <hno@hem.passagen.se>
Cc: <squid-dev@squid-cache.org>
Sent: Wednesday, February 21, 2001 3:02 AM
Subject: Re: eventio API

> On Tue, 20 Feb 2001, Henrik Nordstrom wrote:
>
> > I did intentionally not include the specification of IOBUF in this
> > chapter. It will be described separately. From my previous message
in
> > the thread, introducing the I/O buffer concept amongs a number of
other
> > requirements:
> >
> > * I/O data MUST be refecence counted buffers
> >
> > The reference counted buffers needs to keep
> >
> > * reference count
> > * amount of data currently in the buffer
> > * actual (allocated) size of the buffer
> > * the actual buffer itself
> >
> > Sort of similar to the MemBuf concept, but with a reference count.
>
> I would remove "size" and "offset" parameters from the function calls
> and callbacks then. Those parameters should be a part of the IOBuf or
> IOBufRange structures, IMO. It is awkward to have some of the size
> parameters to be specified in the structure and some maintained
> outside. You may want to introduce a concept of IOBuf "range"
> (IOBufRange is for IOBuf as Substring is for a String -- a descriptor
> of a range within some buffer):
>
> class IOBufRange {
> ...
> size offset; // start of the range
> size length; // range length
> IOBuf *buf; // actual buffer
> };
>
> Usually, these simple structures need not to be alloc()ated and can
> reside on stack; they are practically as efficient as passing isolated
> parameters but less error prone and more convenient.

I have a small question:
What if I want to pull the first 32K out of a 64K IOBuf, and send that
somewhere in squid. Then I want to send a locally generated 12Kb buff,
and then the rest of the 64Kb buffer. Do I need to memcpy the 32Kb
buffers? Can the 12Kb be a static buffer? (marked in some fashion as not
needing free - or is this just plain bad? )
Received on Tue Feb 20 2001 - 13:59:29 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:13:33 MST