...
A possible solution is to transform the byte arrays they provided during the marshaling/unmarshalling phase. This will cover both layers, messaging (network) and storage (in-memory + persist).
Transformation
All we need is to cover all CacheObjects.
...
GridBinaryMarshaller already transforms objects to the bytes.
And, all we need is to transform and wrap these bytes.
For example,
- int=42 will be transformed to [3, 42, 0, 0, 0], where 3 is a GridBinaryMarshaller#INT
- "Test string" will be transformed to [9, 11, 0, 0, 0, 84, 101, 115, 116, 32, 115, 116, 114, 105, 110, 103], where 9 is a GridBinaryMarshaller#STRING
and the idea is just to transform given array somehow and add special prefix GridBinaryMarshaller#TRANSFORMED == -1 at the beginning to make it distinguishable from untransformed data.
For example,
- No-op transformer will produce [-1, 0, 0, 0, 0, 5, 3, 42, 0, 0, 0] or [-1, 0, 0, 0, 0, 16, 9, 11, 0, 0, 0, 84, 101, 115, 116, 32, 115, 116, 114, 105, 110, 103], where [0, 0, 0, 0, 5] and [0, 0, 0, 0, 16] is an original array size.
- Pseudo-Crypto transformer, which adds 1 to every original byte, will produce [-1, 0, 0, 0, 0, 6, 4, 43, 1, 1, 1] or [-1, 0, 0, 0, 0, 16, 10, 12, 1, 1, 1, 85, 102, 116, 117, 33, 116, 117, 115, 106, 111, 104]
- Magic-Compressor will produce [-1, 0, 0, 0, 0, 5, 7] or [-1, 0, 0, 0, 0, 16, 17], where 7 and 17 is a result of a magic compression.
CacheObjects
We need is to cover all CacheObjects.
Most of them have the following structure:
...