66
immediately: it does not support "suspending" a CNKBuf data access
method, if the data is not currently available. To handle these
limitations, components accessing a
CNKBuf must follow these rules:
1. Before writing data to a
CNKBuf (using a CNKBufWriter), the
CNKProc must reserve space for the data, and wait for the
space to become available. Once the space is available, data
can be written into it, and then some or all of the written rows
must be released.
2. Before reading data from a
CNKBuf (using a CNKBufReader), the
CNKProc must request a certain number of data rows, and wait
for them to become available. Once the data is available, the
block of data can be read, and then some or all of the data
rows must be released.
The
CNKBuf is designed so that the CNKBuf's associated CNKBufWriter
has to wait until all of the associated CNKBufReader objects have
consumed the written data rows, before that storage can be used for
more data. Given this design, if a
CNKBuf is set up with no readers,
then the
CNKBuf will fill up with data and then stop, since no one will
ever read the data. It has been useful to make an exception to the
rules in this case: if a
CNKBuf has no readers, then it acts like there is
an attached reader that automatically reads all data rows as they are
written.
CNKBuf
Subclasses:
CNKMemoryBuf and
CNKBackingFileBu
f
As far as a proc object is concerned, all bufs (and buf readers and buf
writers) are the same, implementing the same methods. In actuality,
there are several different types of buf classes, implemented as
subclasses of
CNKBuf. CNKBuf does not have a public constructor, so
creating a buf involves creating an instance of one of these subclasses.
The
CNKMemoryBuf class implements a CNKBuf with a FIFO buffer of
rows in memory. Procs must write and read rows sequentially to a
CNKMemoryBuf, as described above. The only method specific to a
CNKMemoryBuf is the constructor:
CNKMemoryBuf::
CNKMemoryBuf();
The CNKBackingFileBuf class implements a CNKBuf with an associated
file that contains the data in the buffer. It can be used to support
procs that need to read their input data multiple times, or in random
access order. This class is described in more detail below.
Comentarios a estos manuales