|
| namespace_start |
|
| namespace_end |
|
An inclusive lexographical range of namespaces.
This class is immutable.
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.
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:
- code/googleappengine-read-only/python/google/appengine/ext/mapreduce/namespace_range.py