THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
Adding ability to set a marshaller to cache configuration:
Code Block | ||
---|---|---|
| ||
public class CacheConfiguration { // ... public void setMarshaller(Marshaller marshaller) {...} public Marshaller getMarshaller() {...} // ... } |
Default implementation of CacheObjectManager assumes that it is impossible to read a field from an object without deserialization.
Public API: New Interface
Code Block | ||||
---|---|---|---|---|
| ||||
/** * Abstracted binary representation of objects. */ public abstractinterface class CacheObjectManager extends GridCacheManagerAdapter IgniteObject { /** * ChecksGets whetherportable thisobject functionality is globally supportedtype ID. * * @return {@code true} if enabledType ID. */ public abstractint boolean isFieldsIndexingEnabledtypeId(); /** * @paramGets objfully Keydeserialized value. instance of * @param userObj If {@code true} then given object is object provided by user and should be copiedportable object. * * before@return storedFully indeserialized cache. instance * @return Cache key of portable object. */ @Nullable public abstract<T> KeyCacheObjectT toCacheKeyObjectdeserialize(Object) obj, boolean userObj)throws IgniteException; /** * @paramGets objfield Objectvalue. * @param userObj If {@code true} then given object is object provided by user and should be copied * before@param storedfieldName inField cachename. * @return CacheField objectvalue. */ @Nullable public abstract<T> CacheObjectT toCacheObjectfield(@Nullable Object obj, boolean userObjString fieldName); /** * @paramChecks whether typefield Objectis type.set. * * @param bytesfieldName ObjectField bytesname. * @return Cache object {@code true} if field is set. */ public abstractboolean CacheObject toCacheObjecthasField(byte type, byte[] bytesString fieldName); /** * @param valPtr Value pointer Gets the source input stream that was used to create this IgniteObject. */ @param tmp Ifpublic {@code true} can return temporary instance which is valid while entry lock is held.SeekableDataInput source(); } |
Code Block | ||
---|---|---|
| ||
public interface IgniteObjectMarshaller extends Marshaller { /** * @param @returninput CacheSeekable objectinput. * @throws@return IgniteCheckedExceptionCache If failedobject. */ @Nullable public abstractIgniteObject CacheObject toCacheObjecttoIgniteObject(long valPtr, boolean tmp) throws IgniteCheckedExceptionSeekableDataInput input); /** * @param typeNameinput TypeSeekable nameinput. * @return TypeCache IDobject. */ @Nullable public abstractIgniteObject int typeId(String typeNametoIgniteObject(byte[] data); /** * @param objtypeName Object to get type ID forType name. * @return Type ID. */ public abstract int typeId(ObjectString objtypeName); ... } |
...
}
|
Code Block | ||
---|---|---|
| ||
@CacheObjectProcessor(impl=MyCacheObjectProcessor.class) public class MyMarshaller implements Marshaller {public interface SeekableDataInput extends DataInput { public long position(); public void seek(long pos) throws IOException; public void ensureOnHeap(); } |