Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get entity size in GAE/J?

GAE documentation mentions that the max entity size is 1Mb. Since I'm storing a lot of data inside entities I'd like to know when I'm approaching this limit.

I'm aware of GAE/Pyhon method model_to_protobuf(..), but I can't find anything for Java.

I'm also aware that GAE uses protobuf internally to serialize entities, so I could do the same. But I'd like to avoid duplicate code as GAE is already doing this under the hood.

Is there a programmatic way to get entity size in Java, preferably before entity is actually stored?

like image 386
Peter Knego Avatar asked Oct 21 '22 13:10

Peter Knego


1 Answers

It looks like this method should fit the bill for you:

public static EntityProto convertToPb(Entity entity)

and matches up with what you've found on the Python side.

like image 144
Dan Holevoet Avatar answered Nov 01 '22 09:11

Dan Holevoet