WL#9192: Add JSON_STORAGE_SIZE / JSON_STORAGE_FREE functions

Affects: Server-8.0   —   Status: Complete

It is not currently possible to be able to tell the disk-size of the JSON native type. In most cases, the size will be similar to text-based (since there is no compression etc), but in in-person presentations of the new JSON functionality, wanting to know actual size is one of the top requests.

Since the type also supports future in-place update (WL#8963), there is a potential for fragmentation (for example, there could be an in-place delete, or a long string in the middle of the document could have been replaced with a shorter one).

I propose the following two functions:

1) JSON_STORAGE_SIZE(jsn) : Accepts either a json string or json binary type. For a string it creates an intermediate binary representation of and returns the required storage size in bytes. For a native-type it returns the actual size in bytes.

2) JSON_STORAGE_FREE(jsn) : Returns the free space of a json binary type in bytes (including fragmentation and padding saved for inplace update). For a JSON string, create an intermediate binary representation and return the padding that is taken for this object.