brigade API

Under Apache 2.0, modules can generate, filter, and discard content. This content comes in the form of bucket brigades. A bucket brigade is simply a list of several 'buckets.' Each bucket contains data. The reason that the data is dispersed into these packets is that a module may make a specific optimization with respect to that data - Such as, that it may be mmap()ed, or static data. The brigade API allows modules to manipulate the brigades, and the data stored within. Brigades last the lifetime of the object that creates them. Buckets may or may not have a different lifetime. Brigade creation for request output filters is done in the request_rec (See the section called brigade_create).

get_head

Synopsis

brigade.get_head()

Description

This routine returns the first bucket in the bucket brigade. If the brigade is empty, this returns None.

get_tail

Synopsis

brigade.get_tail()

Description

This routine returns the last bucket in the bucket brigade. If the brigade is empty, this returns None.

get_next

Synopsis

brigade.get_next( bucket)

Arguments

Description

This routine returns the next bucket after the passed in bucket argument. If there is no bucket after the argument, the return value is None

get_prev

Synopsis

brigade.get_prev( bucket)

Arguments

Description

This routine returns the previous bucket before the passed in bucket argument. If there is no bucket before the argument, the return value is None

move_head

Synopsis

brigade.move_head( bucket)

Arguments

Description

This routine can either move a bucket from a totally seperate brigade into the head of the called brigade, or move a bucket currently in the brigade to the head.

move_tail

Synopsis

brigade.move_tail( bucket)

Arguments

Description

This routine can either move a bucket from a totally seperate brigade into the tail of the called brigade, or move a bucket currently in the brigade to the tail.

move_before

Synopsis

brigade.move_before( before, bucket)

Arguments

Description

This routine moves the bucket to a position prior to 'before'. This method can also move buckets between different brigades, if bucket, and before are in different brigades.

move_after

Synopsis

brigade.move_after( after, bucket)

Arguments

Description

This routine moves the bucket to a position after 'after'. This method can also move buckets between different brigades, if bucket, and after are in different brigades.

remove

Synopsis

brigade.move_after( bucket)

Arguments

Description

This routine removes a bucket from the brigade. The removed bucket is no longer accessable from the brigade, but may continue to exist internally, if other brigades are accessing it.

bucket_create_simple

Synopsis

brigade.bucket_create_simple( data)

Arguments

Description

This is the main routine for creation of new buckets. The data passed in will be available to other filters or other modules accessing the brigade. In Apache 2.0, this is one of the primary methods of generating data for the client.

bucket_create_eos

Synopsis

brigade.bucket_create_eos()

Description

This routine creates a special eos bucket. This bucket indicates that it is the end of the stream. This triggers subsequent filters to assume that no more data will be sent after the eos bucket is sent.