LA_
LA_

Reputation: 20419

How GAE datastore key is generated?

Is it random value? Or, can user extract some data from this value?

Upvotes: 1

Views: 395

Answers (1)

ryan
ryan

Reputation: 2945

a datastore key consists of a kind, a string name or integer id, and an optional parent entity path (docs). all of those are user-specified except the id, so i assume that's what you're asking about.

ids are allocated based on simple integer counters that start at 0. currently, in a given app, all root entities share a single counter, and non-root entities share a counter within their entity group. over the long term, ids from a given counter will increase, but datastore servers reserve ids in batches, so you'll often see ids increase and decrease over the short term.

more details: http://groups.google.com/group/google-appengine/browse_thread/thread/dec83c2dbd9542e4#f495648c988d758c

(as to the security question, none of app engine's security depends on keeping this id allocation mechanism secret. you might want to read up on why security through obscurity is generally considered a Bad Thing. :P)

Upvotes: 3

Related Questions