Apps     Components     Interfaces     All Files     Source Tree     source: tos.lib.TinyDB.DBBuffer.nc

Interface: DBBuffer

The DBBuffer interface provides a place for queries to output their results to or fetch results from.

Buffers can be in RAM or simply drain out to the network. In the case of RAM buffers, they have a fixed (preallocated) number of rows that are recycled according to some eviction policy. Radio buffers have a single logical row that is written out via a RadioQueue interface.
Author: Sam Madden (madden@cs.berkeley.edu)

Components providing this interface:
tos.lib.TinyDB.DBBufferC

Components requiring this interface:
tos.lib.TinyDB.TupleRouterM

Commands

Events

Commands - Details

pop

TinyDBError pop(uint8_t bufferId)

Deallocate (without returning) the first item at the top of the queue. To read the first item, use peek(), and call pop() when it is no longer needed
Returns: err_NoMoreResults if no results are available

peek

TinyDBError peek(uint8_t bufferId, QueryResult *buf, bool *pending)

Copy the top most result in the specified buffer into buf if *pending is true on return, the result will not be available until getComplete is signalled, Otherwise, the result is available immediately. No further calls to dequeue/peek/getResult are allowed until putComplete is signalled.

Note that this routine may return a QueryResult that contains pointers into DBBuffer-local data structures which will be deallocated as soon as pop() is called.
Returns: err_NoMoreResults if no results are available


alloc

TinyDBError alloc(uint8_t bufferId, BufferType type, uint16_t size, BufferPolicy policy, ParsedQuery *schema, bool *pending, long data)

Allocate the specified buffer with the specified size sizes is an array of sizes of each field, with one entry per field Signals allocComplete when allocation is complete if *pending is true on return Data is buffer type specific data If *pending is true on return, the result will not be available until getComplete is signalled, Otherwise, the result is available immediately. No further calls to dequeue/peek/getResult are allowed until putComplete is signalled.
Returns: err_UnsupportedPolicy if the specified policy can't be applied
  err_ResultBufferBusy If other buffer requests are currently outstanding