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

Public Member Functions

def __init__
 
def app
 
def namespace_start
 
def namespace_end
 
def is_single_namespace
 
def split_range
 
def __copy__
 
def __eq__
 
def __hash__
 
def __repr__
 
def with_start_after
 
def make_datastore_query
 
def normalized_start
 
def to_json_object
 
def from_json_object
 
def split
 
def __iter__
 

Public Attributes

 namespace_start
 
 namespace_end
 

Detailed Description

An inclusive lexographical range of namespaces.

This class is immutable.

Constructor & Destructor Documentation

def google.appengine.ext.mapreduce.namespace_range.NamespaceRange.__init__ (   self,
  namespace_start = None,
  namespace_end = None,
  _app = None 
)
Initializes a NamespaceRange instance.

Args:
  namespace_start: A string representing the start of the namespace range.
  namespace_start is included in the range. If namespace_start is None
  then the lexographically first namespace is used.
  namespace_end: A string representing the end of the namespace range.
  namespace_end is included in the range and must be >= namespace_start.
  If namespace_end is None then the lexographically last namespace is
  used.

Raises:
  ValueError: if namespace_start > namespace_end.

Member Function Documentation

def google.appengine.ext.mapreduce.namespace_range.NamespaceRange.__iter__ (   self)
Iterate over all the namespaces within this range.
def google.appengine.ext.mapreduce.namespace_range.NamespaceRange.from_json_object (   cls,
  json 
)
Returns a NamespaceRange from an object deserialized from JSON.
def google.appengine.ext.mapreduce.namespace_range.NamespaceRange.is_single_namespace (   self)
True if the namespace range only includes a single namespace.
def google.appengine.ext.mapreduce.namespace_range.NamespaceRange.make_datastore_query (   self,
  cursor = None 
)
Returns a datastore.Query that generates all namespaces in the range.

Args:
  cursor: start cursor for the query.

Returns:
  A datastore.Query instance that generates db.Keys for each namespace in
  the NamespaceRange.
def google.appengine.ext.mapreduce.namespace_range.NamespaceRange.normalized_start (   self)
Returns a NamespaceRange with leading non-existant namespaces removed.

Returns:
  A copy of this NamespaceRange whose namespace_start is adjusted to exclude
  the portion of the range that contains no actual namespaces in the
  datastore. None is returned if the NamespaceRange contains no actual
  namespaces in the datastore.
def google.appengine.ext.mapreduce.namespace_range.NamespaceRange.split (   cls,
  n,
  contiguous,
  can_query = itertools.chain(itertools.repeat(True, 50),
  itertools,
  repeat,
  False,
  next,
  _app = None 
)
Splits the complete NamespaceRange into n equally-sized NamespaceRanges.

Args:
  n: The maximum number of NamespaceRanges to return. Fewer than n
  namespaces may be returned.
  contiguous: If True then the returned NamespaceRanges will cover the
  entire space of possible namespaces (i.e. from MIN_NAMESPACE to
  MAX_NAMESPACE) without gaps. If False then the returned
  NamespaceRanges may exclude namespaces that don't appear in the
  datastore.
  can_query: A function that returns True if split() can query the datastore
  to generate more fair namespace range splits, and False otherwise.
  If not set then split() is allowed to make 50 datastore queries.

Returns:
  A list of at most n NamespaceRanges representing a near-equal distribution
  of actual existant datastore namespaces. The returned list will be sorted
  lexographically.

Raises:
  ValueError: if n is < 1.
def google.appengine.ext.mapreduce.namespace_range.NamespaceRange.split_range (   self)
Splits the NamespaceRange into two nearly equal-sized ranges.

Returns:
  If this NamespaceRange contains a single namespace then a list containing
  this NamespaceRange is returned. Otherwise a two-element list containing
  two NamespaceRanges whose total range is identical to this
  NamespaceRange's is returned.
def google.appengine.ext.mapreduce.namespace_range.NamespaceRange.to_json_object (   self)
Returns a dict representation that can be serialized to JSON.
def google.appengine.ext.mapreduce.namespace_range.NamespaceRange.with_start_after (   self,
  after_namespace 
)
Returns a copy of this NamespaceName with a new namespace_start.

Args:
  after_namespace: A namespace string.

Returns:
  A NamespaceRange object whose namespace_start is the lexographically next
  namespace after the given namespace string.

Raises:
  ValueError: if the NamespaceRange includes only a single namespace.

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