/** * @param ctx Cache object context. * @return Marshalled size. * @throws IgniteCheckedException If failed. */ public int marshalledSize(CacheObjectContext ctx) throws IgniteCheckedException { int size = 0; if (val != null) size += val.valueBytes(ctx).length; size += key.valueBytes(ctx).length; return SIZE_OVERHEAD + size; }
/** {@inheritDoc} */ @Override public int size() { try { GridCacheContext<Object, Object> cctx = cached.context(); KeyCacheObject key = cached.key(); byte[] keyBytes = key.valueBytes(cctx.cacheObjectContext()); byte[] valBytes = null; CacheObject cacheObj = cached.valueBytes(); if (cacheObj != null) valBytes = cacheObj.valueBytes(cctx.cacheObjectContext()); return valBytes == null ? keyBytes.length : keyBytes.length + valBytes.length; } catch (GridCacheEntryRemovedException ignored) { return 0; } catch (IgniteCheckedException e) { throw new IgniteException(e); } }
/** {@inheritDoc} */ @Override public CacheDataRow mvccFind(GridCacheContext cctx, KeyCacheObject key, MvccSnapshot snapshot) throws IgniteCheckedException { key.valueBytes(cctx.cacheObjectContext()); int cacheId = grp.sharedGroup() ? cctx.cacheId() : CU.UNDEFINED_CACHE_ID; MvccSnapshotSearchRow clo = new MvccSnapshotSearchRow(cctx, key, snapshot); dataTree.iterate( clo, new MvccMinSearchRow(cacheId, key), clo ); CacheDataRow row = clo.row(); afterRowFound(row, key); return row; }
key.valueBytes(coCtx);
/** {@inheritDoc} */ @Override public List<IgniteBiTuple<Object, MvccVersion>> mvccFindAllVersions( GridCacheContext cctx, KeyCacheObject key) throws IgniteCheckedException { assert grp.mvccEnabled(); // Note: this method is intended for testing only. key.valueBytes(cctx.cacheObjectContext()); int cacheId = grp.sharedGroup() ? cctx.cacheId() : CU.UNDEFINED_CACHE_ID; GridCursor<CacheDataRow> cur = dataTree.find( new MvccMaxSearchRow(cacheId, key), new MvccMinSearchRow(cacheId, key) ); List<IgniteBiTuple<Object, MvccVersion>> res = new ArrayList<>(); long crd = MVCC_CRD_COUNTER_NA; long cntr = MVCC_COUNTER_NA; int opCntr = MVCC_OP_COUNTER_NA; while (cur.next()) { CacheDataRow row = cur.get(); if (compareNewVersion(row, crd, cntr, opCntr) != 0) // deleted row res.add(F.t(null, row.newMvccVersion())); res.add(F.t(row.value(), row.mvccVersion())); crd = row.mvccCoordinatorVersion(); cntr = row.mvccCounter(); opCntr = row.mvccOperationCounter(); } return res; }
byte[] bytes = key.valueBytes(grp.cacheObjectContext()); other.initFromLink(grp, CacheDataRowAdapter.RowData.KEY_ONLY); byte[] bytes1 = other.key().valueBytes(grp.cacheObjectContext()); byte[] bytes2 = key.valueBytes(grp.cacheObjectContext());
/** {@inheritDoc} */ @Override public int memorySize() throws IgniteCheckedException { byte[] kb; byte[] vb = null; int extrasSize; lockEntry(); try { key.prepareMarshal(cctx.cacheObjectContext()); kb = key.valueBytes(cctx.cacheObjectContext()); if (val != null) { val.prepareMarshal(cctx.cacheObjectContext()); vb = val.valueBytes(cctx.cacheObjectContext()); } extrasSize = extrasSize(); } finally { unlockEntry(); } return SIZE_OVERHEAD + extrasSize + kb.length + (vb == null ? 1 : vb.length); }
/** {@inheritDoc} */ @Override public CacheDataRow find(GridCacheContext cctx, KeyCacheObject key) throws IgniteCheckedException { key.valueBytes(cctx.cacheObjectContext()); int cacheId = grp.sharedGroup() ? cctx.cacheId() : CU.UNDEFINED_CACHE_ID; CacheDataRow row; if (grp.mvccEnabled()) { MvccFirstRowTreeClosure clo = new MvccFirstRowTreeClosure(cctx); dataTree.iterate( new MvccMaxSearchRow(cacheId, key), new MvccMinSearchRow(cacheId, key), clo ); row = clo.row(); } else row = dataTree.findOne(new SearchRow(cacheId, key), CacheDataRowAdapter.RowData.NO_KEY); afterRowFound(row, key); return row; }
key.valueBytes(coCtx);
/** {@inheritDoc} */ @Override public CacheDataRow createRow( GridCacheContext cctx, KeyCacheObject key, CacheObject val, GridCacheVersion ver, long expireTime, @Nullable CacheDataRow oldRow) throws IgniteCheckedException { int cacheId = grp.storeCacheIdInDataPage() ? cctx.cacheId() : CU.UNDEFINED_CACHE_ID; DataRow dataRow = makeDataRow(key, val, ver, expireTime, cacheId); if (canUpdateOldRow(cctx, oldRow, dataRow) && rowStore.updateRow(oldRow.link(), dataRow, grp.statisticsHolderData())) dataRow.link(oldRow.link()); else { CacheObjectContext coCtx = cctx.cacheObjectContext(); key.valueBytes(coCtx); val.valueBytes(coCtx); rowStore.addRow(dataRow, grp.statisticsHolderData()); } assert dataRow.link() != 0 : dataRow; if (grp.sharedGroup() && dataRow.cacheId() == CU.UNDEFINED_CACHE_ID) dataRow.cacheId(cctx.cacheId()); return dataRow; }
row.key().valueBytes(grpCtx.cacheObjectContext()), row.version(), valHash));
key.valueBytes(coCtx);
key.valueBytes(coCtx);
key.valueBytes(coCtx);
key.valueBytes(coCtx); val.valueBytes(coCtx);
key.valueBytes(cctx.cacheObjectContext());
assertTrue(rightRow instanceof MvccDataRow); leftRow.key().valueBytes(null);
key.valueBytes(coCtx);
key.valueBytes(coCtx);
/** * @param ctx Cache object context. * @return Marshalled size. * @throws IgniteCheckedException If failed. */ public int marshalledSize(CacheObjectContext ctx) throws IgniteCheckedException { int size = 0; if (val != null) size += val.valueBytes(ctx).length; size += key.valueBytes(ctx).length; return SIZE_OVERHEAD + size; }