Question

I'm hoping that this isn't flagged as "not helpful" because I think that many people are attempting to figure out a way to keep strong consistency in the HRD.

Here is the idea I'm using for my app. I'd like to get your opinions.

I have a fitness app. This is of course made up of Workouts and Exercises. The HRD contains about 400 exercises to pick from, or the User can create their own Exercise (a UExercise).

When the User logs in, I load all of the Workout keys into a "workoutKeys" List on the User. At the same time I load all the User exercise keys (UExercise) into a "exerciseKeys" List also on the User.

If the user wants to add/delete exercises from a specific workout, the Workout is loaded and all its Exercise keys are loaded into a "exerciseKeys" List on the Workout.

See a pattern here?

So whenever I want to view Exercises created by the user (UExercise) or the users Workouts, or the Exercises in that Workout, I do a get() using those keys.

Since a user would probably not have 1000's of Workouts, or create 1000's of Exercises, I think this is a safe and quick way to achieve strong consistency.

Not saying that this is the best way for EVERY app. But for mine I believe it will work well.

I would greatly appreciate all of your input as to if there is something I may be missing here, or not properly taking into consideration.

Was it helpful?

Solution

Ok... After some careful consideration of how my app will work, and how users actually use it, I have decided to ditch the idea above and go with Ancestor Queries.

So for the above models, I have come up with the following...

  • For a Workout, I make the User the parent
  • For an Exercise created a user (UExercise), I make the User the parent

This allows me to use Ancestor Queries (which are strongly consistent) to pull the most recently added or modified Entities.

Due to the fact that the user will not be modifying these Entities en mass, I think the limitations on the writes will not be a factor.

This also rids me of properties on Model objects that should not really be there in the first place.

By the way, I also tried Memcache. I found this to be the ultimate pain. Having to keep the Memcache and the Datastore in sync seemed to inject much more complexity than was really needed.

But your site, and results may differ. This idea works well for my app.

Thanks!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top