App Engine Python SDK  v1.6.9 rev.445
The Python runtime is available as an experimental Preview feature.
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
google.appengine.ext.mapreduce.context._ItemList Class Reference
Inheritance diagram for google.appengine.ext.mapreduce.context._ItemList:

Public Member Functions

def __init__
 
def __str__
 
def append
 
def flush
 
def clear
 
def should_flush
 

Public Attributes

 items
 

Static Public Attributes

int DEFAULT_RETRIES = 3
 

Detailed Description

A buffer that holds arbitrary items and auto flushes them when full.

Callers of this class provides the logic on how to flush.
This class takes care of the common logic of when to flush and when to retry.

Properties:
  items: list of objects.
  length: length of item list.
  size: aggregate item size in bytes.

Constructor & Destructor Documentation

def google.appengine.ext.mapreduce.context._ItemList.__init__ (   self,
  max_entity_count,
  flush_function,
  timeout_retries = DEFAULT_RETRIES,
  repr_function = None 
)
Constructor.

Args:
  max_entity_count: maximum number of entities before flushing it to db.
  flush_function: a function that can flush the items. The function is
called with a list of items as the first argument, a dict of options
as second argument. Currently options can contain {"deadline": int}.
see self.flush on how the function is called.
  timeout_retries: how many times to retry upon timeouts.
  repr_function: a function that turns an item into meaningful
representation. For debugging large items.

Member Function Documentation

def google.appengine.ext.mapreduce.context._ItemList.append (   self,
  item 
)
Add new item to the list.

If needed, append will first flush existing items and clear existing items.

Args:
  item: an item to add to the list.
def google.appengine.ext.mapreduce.context._ItemList.clear (   self)
Clear item list.
def google.appengine.ext.mapreduce.context._ItemList.flush (   self)
Force a flush.
def google.appengine.ext.mapreduce.context._ItemList.should_flush (   self)
Whether to flush before append the next entity.

Returns:
  True to flush. False other.

The documentation for this class was generated from the following file: