![]() |
App Engine Python SDK
v1.6.9 rev.445
The Python runtime is available as an experimental Preview feature.
|
Public Member Functions | |
def | __init__ |
def | __repr__ |
def | get |
def | increment |
def | add_map |
def | sub_map |
def | clear |
def | to_json |
def | from_json |
def | to_dict |
![]() | |
def | to_json_str |
def | from_json_str |
Public Attributes | |
counters | |
Maintains map from counter name to counter value. The class is used to provide basic arithmetics of counter values (buil add/remove), increment individual values and store/load data from json.
def google.appengine.ext.mapreduce.model.CountersMap.__init__ | ( | self, | |
initial_map = None |
|||
) |
Constructor. Args: initial_map: initial counter values map from counter name (string) to counter value (int).
def google.appengine.ext.mapreduce.model.CountersMap.__repr__ | ( | self | ) |
Compute string representation.
def google.appengine.ext.mapreduce.model.CountersMap.add_map | ( | self, | |
counters_map | |||
) |
Add all counters from the map. For each counter in the passed map, adds its value to the counter in this map. Args: counters_map: CounterMap instance to add.
def google.appengine.ext.mapreduce.model.CountersMap.clear | ( | self | ) |
Clear all values.
def google.appengine.ext.mapreduce.model.CountersMap.from_json | ( | cls, | |
json | |||
) |
Create new CountersMap from the json data structure, encoded by to_json. Args: json: json representation of CountersMap . Returns: an instance of CountersMap with all data deserialized from json.
def google.appengine.ext.mapreduce.model.CountersMap.get | ( | self, | |
counter_name, | |||
default = 0 |
|||
) |
Get current counter value. Args: counter_name: counter name as string. default: default value if one doesn't exist. Returns: current counter value as int. 0 if counter was not set.
def google.appengine.ext.mapreduce.model.CountersMap.increment | ( | self, | |
counter_name, | |||
delta | |||
) |
Increment counter value. Args: counter_name: counter name as String. delta: increment delta as Integer. Returns: new counter value.
def google.appengine.ext.mapreduce.model.CountersMap.sub_map | ( | self, | |
counters_map | |||
) |
Subtracts all counters from the map. For each counter in the passed map, subtracts its value to the counter in this map. Args: counters_map: CounterMap instance to subtract.
def google.appengine.ext.mapreduce.model.CountersMap.to_dict | ( | self | ) |
Convert to dictionary. Returns: a dictionary with counter name as key and counter values as value.
def google.appengine.ext.mapreduce.model.CountersMap.to_json | ( | self | ) |
Serializes all the data in this map into json form. Returns: json-compatible data representation.