Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
titleBinaryObjectImpl (un)marshalling
private byte[] arrayFromValueBytes(CacheObjectValueContext ctx) {
    return CacheObjectsTransformer.restoreIfNecessary(valBytes, ctx);
}

private byte[] valueBytesFromArray(CacheObjectValueContext ctx) {
    return CacheObjectsTransformer.transformIfNecessary(arr, start, arr.length, ctx);
}

...

public void finishUnmarshal(CacheObjectValueContext ctx, ClassLoader ldr) throws IgniteCheckedException {
	if (arr == null)
	arr = arrayFromValueBytes(ctx);
}

...

public void prepareMarshal(CacheObjectValueContext ctx) {
	if (valBytes == null)
		valBytes = valueBytesFromArray(ctx);
}

SPI (Service Provider Interface)

Some customets may want to encrypt the data, some to compress, while some just keep it as is.

So, we must provide the simple way to append any transformation.

Simplest way is to use Service Provider Interface (IgniteSpi):

Code Block
languagejava
titleSPI

Risks and Assumptions

Transformation requires additional memory allocation and subsequent GC work.

...