Mod Snake API | ||
---|---|---|
Prev |
One of the fundamental blocks for moving data to the client comes in the form of the bucket brigade (See the section called brigade API). The brigade is simply an ordered list of buckets.
bucket.is_eos()
This integer attribute indicates whether or not the bucket is an EOS (end of stream) bucket. If is_eos is true, the bucket is EOS, otherwise it is a regular bucket.
bucket.name()
This string attribute gives the internally defined name of the bucket type.
bucket.length()
This integer attribute contains the length of the data stored in the bucket. It can equal -1, indicating that the length of the data cannot be determined until it is read. Values other than -1 indicate the length of the data that will be read. If length is -1, bucket data must be read until None is returned.
bucket.read( block)
block - Integer value indicating whether or not this routine should block when trying to read data.
This is the main routine for transferring data from the bucket to the caller. If the block parameter is given, this routine will block until the data has been read. If the bucket's length is -1 this routine will return None when there is no more data to be read.