Maniac
Maniac

Reputation: 774

How to integrate user quotas?

I would like to develop an app engine application where users can store data. The problem is that the user data can get really large in size. So I would like to set quotas on single users or check how much space in datastore they use.

I there an easy way to do that? Or do I have to count the bytes of stored strings by myself?

Upvotes: 1

Views: 69

Answers (1)

Noah McIlraith
Noah McIlraith

Reputation: 14292

The most efficient way is to keep track of how many bytes are stored for each user, and store it in an entity in the datastore.

Alternatively, and if you are storing the data (or at least a reference) in the datastore, you could also fetch all that are belonging to a user from the datastore and calculate how much is used.

So yeah, you have to do it yourself. The total datastore size as reported by statistics is only for the entire datastore, as well as each entity kind. Besides, it's only updated every ~24 hours, so even if it could be used, it isn't as useful as coding it by hand.

Upvotes: 1

Related Questions