3 ms·
If I were you I would have inspired myself from iNode structure found in ExtFS. Here is what I would have done: Category -> Array of tuples (imagine nested arr
by maxpert 14y ago
If I were you I would have inspired myself from iNode structure found in ExtFS. Here is what I would have done:
Category -> Array of tuples (imagine nested array) where each tuple contains (Key to a group, Number of elements in group).
You can use something like JSON (I won't recommend that) or MsgPack (this will work best for you my guess) for serialising your array. Now the nifty part comes in holding the number of elements in a group you can have fixed sizes or you can find out average number members in a group (do the maths) combine it with your standard deviation and make an intelligent decision. Adding requires you looking at the last element in category if you filled the cap create a new group and append it into category container. If you face yourself with value size do yourself a favour and compress the values against keys ( I've two complete blog posts to get you convinced http://blog.creapptives.com/post/27331500697/msgpack-vs-json-in-the-jaws-of-compression http://blog.creapptives.com/post/27331500697/msgpack-vs-json... and http://blog.creapptives.com/post/25026698783/speeding-up-your-datastore-with-compression http://blog.creapptives.com/post/25026698783/speeding-up-you...) use something fast like libsnappy or lz4 to compress your values. Hope it helps!