Interface CacheObject
-
- All Superinterfaces:
Message,Serializable
- All Known Subinterfaces:
KeyCacheObject
- All Known Implementing Classes:
BinaryEnumObjectImpl,BinaryObjectImpl,BinaryObjectOffheapImpl,CacheObjectAdapter,CacheObjectByteArrayImpl,CacheObjectImpl,IgniteCacheOffheapManagerImpl.ExpiredKeyCacheObject,KeyCacheObjectImpl,PlatformCacheObjectImpl,UserCacheObjectByteArrayImpl,UserCacheObjectImpl,UserKeyCacheObjectImpl
public interface CacheObject extends Message
-
-
Field Summary
Fields Modifier and Type Field Description static byteTYPE_BINARYstatic byteTYPE_BINARY_ENUMstatic byteTYPE_BYTE_ARRstatic byteTYPE_REGULAR-
Fields inherited from interface org.apache.ignite.plugin.extensions.communication.Message
DIRECT_TYPE_SIZE
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description bytecacheObjectType()voidfinishUnmarshal(CacheObjectValueContext ctx, ClassLoader ldr)booleanisPlatformType()Gets flag indicating whether object value is a platform type.CacheObjectprepareForCache(CacheObjectContext ctx)Prepares cache object for cache (e.g. copies user-provided object if needed).voidprepareMarshal(CacheObjectValueContext ctx)intputValue(long addr)booleanputValue(ByteBuffer buf)booleanputValue(ByteBuffer buf, int off, int len)<T> Tvalue(CacheObjectValueContext ctx, boolean cpy)<T> Tvalue(CacheObjectValueContext ctx, boolean cpy, ClassLoader ldr)Deserializes a value from an internal representation.byte[]valueBytes(CacheObjectValueContext ctx)intvalueBytesLength(CacheObjectContext ctx)-
Methods inherited from interface org.apache.ignite.plugin.extensions.communication.Message
directType, fieldsCount, onAckReceived, readFrom, writeTo
-
-
-
-
Field Detail
-
TYPE_REGULAR
static final byte TYPE_REGULAR
- See Also:
- Constant Field Values
-
TYPE_BYTE_ARR
static final byte TYPE_BYTE_ARR
- See Also:
- Constant Field Values
-
TYPE_BINARY
static final byte TYPE_BINARY
- See Also:
- Constant Field Values
-
TYPE_BINARY_ENUM
static final byte TYPE_BINARY_ENUM
- See Also:
- Constant Field Values
-
-
Method Detail
-
value
@Nullable <T> T value(CacheObjectValueContext ctx, boolean cpy)
- Parameters:
ctx- Context.cpy- Iftrueneed to copy value.- Returns:
- Value.
-
value
@Nullable <T> T value(CacheObjectValueContext ctx, boolean cpy, ClassLoader ldr)
Deserializes a value from an internal representation.- Parameters:
ctx- Context.cpy- Iftrueneed to copy value.ldr- Class loader, if it isnull, default class loader will be used.- Returns:
- Value.
-
valueBytes
byte[] valueBytes(CacheObjectValueContext ctx) throws IgniteCheckedException
- Parameters:
ctx- Context.- Returns:
- Value bytes.
- Throws:
IgniteCheckedException- If failed.
-
valueBytesLength
int valueBytesLength(CacheObjectContext ctx) throws IgniteCheckedException
- Parameters:
ctx- Cache object context.- Returns:
- Size required to store this value object.
- Throws:
IgniteCheckedException- If failed.
-
putValue
boolean putValue(ByteBuffer buf) throws IgniteCheckedException
- Parameters:
buf- Buffer to write value to.- Returns:
Trueif value was successfully written,falseif there was not enough space in the buffer.- Throws:
IgniteCheckedException- If failed.
-
putValue
int putValue(long addr) throws IgniteCheckedException- Parameters:
addr- Address tp write value to.- Returns:
- Number of bytes written.
- Throws:
IgniteCheckedException- If failed.
-
putValue
boolean putValue(ByteBuffer buf, int off, int len) throws IgniteCheckedException
- Parameters:
buf- Buffer to write value to.off- Offset in source binary data.len- Length of the data to write.- Returns:
Trueif value was successfully written,falseif there was not enough space in the buffer.- Throws:
IgniteCheckedException- If failed.
-
cacheObjectType
byte cacheObjectType()
- Returns:
- Object type.
-
isPlatformType
boolean isPlatformType()
Gets flag indicating whether object value is a platform type. Platform types will be automatically deserialized on public API cache operations regardless whetherIgniteCache.withKeepBinary()is used or not.- Returns:
- Platform type flag.
-
prepareForCache
CacheObject prepareForCache(CacheObjectContext ctx)
Prepares cache object for cache (e.g. copies user-provided object if needed).- Parameters:
ctx- Cache context.- Returns:
- Instance to store in cache.
-
finishUnmarshal
void finishUnmarshal(CacheObjectValueContext ctx, ClassLoader ldr) throws IgniteCheckedException
- Parameters:
ctx- Context.ldr- Class loader.- Throws:
IgniteCheckedException- If failed.
-
prepareMarshal
void prepareMarshal(CacheObjectValueContext ctx) throws IgniteCheckedException
- Parameters:
ctx- Context.- Throws:
IgniteCheckedException- If failed.
-
-