1) It is possible to have multiple rankings running ?
From what I've seen, it is possible to store a new ranker in any
Entity, right ?
2) If I would like to know the ranking in ascendant order, what
changes should I do and where ? (lower score is the better)
3) Is is possible to support floats instead of intengers ? What
changes should I do to support it ?
riq.
Sure thing! If it works out for you, let us know!
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are sub...
Hi,
Yes, I did some initial tests and it seems that everything is working Ok.
Since the highscore server is hosting lots of games, and each game can
have different "categories" (eg: easy, hard, etc...) I'm creating the
entity like the following:
app = datastore.Entity("Ranking", name=category, parent=game.key() )
app["ranker"] = r.rootkey
Thanks,
No. How can I do that ?
Since I can't nest transactions in GAE, what's the best approach ?
I'm doing the following:
scores.add_score(...) # runs in a transaction.
ranker.SetScore(...) # runs in another transaction
if ranker.SetScore() fails, how can I rollback the 1st trasaction ?
Also,
Is is possible to delete an score from the ranker ?
Thanks!
No. How can I do that ?
On Wed, Apr 29, 2009 at 7:31 PM, Bartholomew Furrow <fur...@google.com> wrote:
> That looks about right. Is the Put of a score transactionally linked to the
> AddScore in the ranker?
Since I can't nest transactions in GAE, what's the best approach ?
I'm doing the following:
scores.add_score(...) # runs in a transaction.
ranker.SetScore(...) # runs in another transaction
if ranker.SetScore() fails, how can I rollback the 1st trasaction ?
Also,
Is is possible to delete an score from the ranker ?
One way to achieve something similar is by adding a boolean "dirty" attributes to score and have a cron job that cleans up dirty scores. Something like this:
# Whenever a score changes or a new score arrives:
score = ...
scores.add_score(score) # runs in a transaction and marks score as dirty
ranker.SetScore(...) # runs in a transaction
scores.mark_clean(score) # runs in a transaction and marks score as clean if it wasn't changed concurrently
# In a cron job that runs at a regular interval
<retrieve all scores that are dirty, i.e. where the ranker wasn't updated>
<update the ranker and mark the scores as clean>
I'll implement it after the weekend.
Thanks again,