I'm confused.  I thought that you could only get/put entities from one
entity group in a transaction, but the example code for sharded
counters doesn't put its shards into a common entity group:

def increment(name):
  """Increment the value for a given sharded counter.

  Parameters:
    name - The name of the counter
  """
  config = GeneralCounterShardConfig.get_or_insert(name, name=name)
  def txn():
    index = random.randint(0, config.num_shards - 1)
    shard_name = name + str(index)
    counter = GeneralCounterShard.get_by_key_name(shard_name)
    if counter is None:
      counter = GeneralCounterShard(key_name=shard_name, name=name)
    counter.count += 1
    counter.put()
  db.run_in_transaction(txn)
  memcache.incr(name)

Note that the GeneralCounterShard(...) constructor call doesn't set
the entity's parent.

What's up with that?

Thanks,
-n8

-- 
http://n8gray.org

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to