Class CacheDataRowAdapter
- java.lang.Object
-
- org.apache.ignite.internal.processors.cache.persistence.CacheDataRowAdapter
-
- All Implemented Interfaces:
CacheDataRow,CacheSearchRow,Storable
- Direct Known Subclasses:
DataRow
public class CacheDataRowAdapter extends Object implements CacheDataRow
Cache data row adapter.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCacheDataRowAdapter.RowData
-
Field Summary
Fields Modifier and Type Field Description protected intcacheIdprotected longexpireTimeprotected KeyCacheObjectkeyprotected longlinkprotected CacheObjectvalprotected GridCacheVersionverprotected booleanverReadyWhether version is ready.
-
Constructor Summary
Constructors Constructor Description CacheDataRowAdapter(long link)CacheDataRowAdapter(KeyCacheObject key, CacheObject val, GridCacheVersion ver, long expireTime)
-
Method Summary
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.ignite.internal.processors.cache.persistence.CacheDataRow
ioVersions
-
-
-
-
Field Detail
-
link
@GridToStringExclude protected long link
-
key
@GridToStringInclude protected KeyCacheObject key
-
val
@GridToStringInclude protected CacheObject val
-
expireTime
@GridToStringInclude protected long expireTime
-
ver
@GridToStringInclude protected GridCacheVersion ver
-
verReady
protected boolean verReady
Whether version is ready.
-
cacheId
@GridToStringInclude protected int cacheId
-
-
Constructor Detail
-
CacheDataRowAdapter
public CacheDataRowAdapter(long link)
- Parameters:
link- Link.
-
CacheDataRowAdapter
public CacheDataRowAdapter(KeyCacheObject key, CacheObject val, GridCacheVersion ver, long expireTime)
- Parameters:
key- Key.val- Value.expireTime- Expire time.ver- Version.
-
-
Method Detail
-
initFromLink
public final void initFromLink(CacheGroupContext grp, CacheDataRowAdapter.RowData rowData) throws IgniteCheckedException
Read row from data pages.- Parameters:
grp- Cache group.rowData- Required row data.- Throws:
IgniteCheckedException- If failed.
-
initFromLink
public final void initFromLink(CacheGroupContext grp, CacheDataRowAdapter.RowData rowData, boolean skipVer) throws IgniteCheckedException
Read row from data pages.- Parameters:
grp- Cache group.rowData- Required row data.skipVer- Whether version read should be skipped.- Throws:
IgniteCheckedException- If failed.
-
initFromLink
public final void initFromLink(@Nullable @Nullable CacheGroupContext grp, GridCacheSharedContext<?,?> sharedCtx, PageMemory pageMem, CacheDataRowAdapter.RowData rowData, boolean skipVer) throws IgniteCheckedExceptionRead row from data pages. Can be called with cctx == null, if cache instance is unknown, but its ID is stored in the data row.- Parameters:
grp- Cache group.sharedCtx- Shared context.pageMem- Page memory.rowData- Row data.skipVer- Whether version read should be skipped.- Throws:
IgniteCheckedException- If failed.
-
initFromPageBuffer
public final void initFromPageBuffer(GridCacheSharedContext<?,?> sctx, CacheObjectContext coctx, IgniteThrowableFunction<Long,ByteBuffer> reader, ByteBuffer pageBuff, int itemId, boolean readCacheId, CacheDataRowAdapter.RowData rowData, boolean skipVer) throws IgniteCheckedException
- Parameters:
sctx- Cache shared context.coctx- Cache object context for data deserialization.reader- Reader to read fragmented pages.pageBuff- Initial page buffer with headers.itemId- Item id to read.readCacheId-trueif cache id must be read.rowData- Which data from page must be read.skipVer-trueif cache version must be skipped.- Throws:
IgniteCheckedException- If fails.
-
initFromDataPage
public final void initFromDataPage(DataPageIO io, long pageAddr, int itemId, @Nullable @Nullable CacheGroupContext grp, GridCacheSharedContext<?,?> sharedCtx, PageMemory pageMem, CacheDataRowAdapter.RowData rowData, boolean skipVer) throws IgniteCheckedException
- Parameters:
io- Data page IO.pageAddr- Data page address.itemId- Row item Id.grp- Cache group.sharedCtx- Cache shared context.pageMem- Page memory.rowData- Required row data.skipVer- Whether version read should be skipped.- Throws:
IgniteCheckedException- If failed.
-
readIncomplete
protected IncompleteObject<?> readIncomplete(IncompleteObject<?> incomplete, GridCacheSharedContext<?,?> sharedCtx, CacheObjectContext coctx, int pageSize, int realPageSize, long pageAddr, int itemId, DataPageIO io, CacheDataRowAdapter.RowData rowData, boolean readCacheId, boolean skipVer) throws IgniteCheckedException
- Parameters:
incomplete- Incomplete object.sharedCtx- Cache shared context.coctx- Cache object context.realPageSize- Page size without overhead.pageSize- Page size.pageAddr- Page address.io- Page IO.rowData- Required row data.readCacheId-trueIf need to read cache ID.skipVer- Whether version read should be skipped.- Returns:
- Incomplete object.
- Throws:
IgniteCheckedException- If failed.
-
readFragment
protected IncompleteObject<?> readFragment(GridCacheSharedContext<?,?> sharedCtx, CacheObjectContext coctx, ByteBuffer buf, boolean keyOnly, boolean readCacheId, IncompleteObject<?> incomplete, boolean skipVer) throws IgniteCheckedException
- Parameters:
sharedCtx- Cache shared context.coctx- Cache object context.buf- Buffer.keyOnly-trueIf need to read only key object.readCacheId-trueIf need to read cache ID.incomplete- Incomplete object.skipVer- Whether version read should be skipped.- Returns:
- Read object.
- Throws:
IgniteCheckedException- If failed.
-
readFullRow
protected void readFullRow(GridCacheSharedContext<?,?> sharedCtx, CacheObjectContext coctx, long addr, CacheDataRowAdapter.RowData rowData, boolean readCacheId, boolean skipVer) throws IgniteCheckedException
- Parameters:
sharedCtx- Cache shared context.coctx- Cache object context.addr- Address.rowData- Required row data.readCacheId-trueIf need to read cache ID.skipVer- Whether version read should be skipped.- Throws:
IgniteCheckedException- If failed.
-
readIncompleteCacheId
protected IncompleteObject<?> readIncompleteCacheId(ByteBuffer buf, IncompleteObject<?> incomplete)
- Parameters:
buf- Buffer.incomplete- Incomplete.
-
readIncompleteKey
protected IncompleteCacheObject readIncompleteKey(CacheObjectContext coctx, ByteBuffer buf, IncompleteCacheObject incomplete) throws IgniteCheckedException
- Parameters:
coctx- Cache object context.buf- Buffer.incomplete- Incomplete object.- Returns:
- Incomplete object.
- Throws:
IgniteCheckedException- If failed.
-
readIncompleteValue
protected IncompleteCacheObject readIncompleteValue(CacheObjectContext coctx, ByteBuffer buf, IncompleteCacheObject incomplete) throws IgniteCheckedException
- Parameters:
coctx- Cache object context.buf- Buffer.incomplete- Incomplete object.- Returns:
- Incomplete object.
- Throws:
IgniteCheckedException- If failed.
-
readIncompleteExpireTime
protected IncompleteObject<?> readIncompleteExpireTime(ByteBuffer buf, IncompleteObject<?> incomplete)
- Parameters:
buf- Buffer.incomplete- Incomplete object.- Returns:
- Incomplete object.
-
readIncompleteVersion
protected IncompleteObject<?> readIncompleteVersion(ByteBuffer buf, IncompleteObject<?> incomplete, boolean skip) throws IgniteCheckedException
- Parameters:
buf- Buffer.incomplete- Incomplete object.skip- Whether version should be skipped.- Returns:
- Incomplete object.
- Throws:
IgniteCheckedException- If failed.
-
isReady
public boolean isReady()
- Returns:
Trueif entry is ready.
-
key
public KeyCacheObject key()
- Specified by:
keyin interfaceCacheSearchRow- Returns:
- Cache key.
-
key
public void key(KeyCacheObject key)
- Specified by:
keyin interfaceCacheDataRow- Parameters:
key- Key.
-
cacheId
public int cacheId()
- Specified by:
cacheIdin interfaceCacheSearchRow- Returns:
- Cache ID or
0if cache ID is not defined.
-
value
public CacheObject value()
- Specified by:
valuein interfaceCacheDataRow- Returns:
- Cache value.
-
version
public GridCacheVersion version()
- Specified by:
versionin interfaceCacheDataRow- Returns:
- Cache entry version.
-
expireTime
public long expireTime()
- Specified by:
expireTimein interfaceCacheDataRow- Returns:
- Expire time.
-
partition
public int partition()
- Specified by:
partitionin interfaceCacheDataRow- Specified by:
partitionin interfaceStorable- Returns:
- Partition for this key.
-
link
public long link()
- Specified by:
linkin interfaceCacheSearchRow- Specified by:
linkin interfaceStorable- Returns:
- Link for this row.
-
link
public void link(long link)
- Specified by:
linkin interfaceCacheDataRow- Specified by:
linkin interfaceStorable- Parameters:
link- Link for this row.
-
hash
public int hash()
- Specified by:
hashin interfaceCacheSearchRow- Returns:
- Key hash code.
-
size
public int size() throws IgniteCheckedException- Specified by:
sizein interfaceStorable- Returns:
- Row size in page.
- Throws:
IgniteCheckedException- If failed.
-
-