/** * @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; }
/** * @return Value bytes and flag indicating whether value is byte array. */ protected IgniteBiTuple<byte[], Byte> valueBytes0() { assert lock.isHeldByCurrentThread(); assert val != null; try { byte[] bytes = val.valueBytes(cctx.cacheObjectContext()); return new IgniteBiTuple<>(bytes, val.cacheObjectType()); } catch (IgniteCheckedException e) { throw new IgniteException(e); } }
/** {@inheritDoc} */ @Override public byte[] getBytesNoCopy() { if (obj.cacheObjectType() == CacheObject.TYPE_REGULAR) { // Result must be the same as `marshaller.marshall(obj.value(coctx, false));` try { return obj.valueBytes(valCtx); } catch (IgniteCheckedException e) { throw DbException.convert(e); } } // For user-provided and array types. return JdbcUtils.serialize(obj, null); }
/** * Removes entry for given key from this index. * * @param key Key. * @throws IgniteCheckedException If failed. */ public void remove(CacheObject key) throws IgniteCheckedException { try { writer.deleteDocuments(new Term(KEY_FIELD_NAME, new BytesRef(key.valueBytes(objectContext())))); } catch (IOException e) { throw new IgniteCheckedException(e); } finally { updateCntr.incrementAndGet(); } }
byte[] key1ValBytes = key1.valueBytes(cctx1.cacheObjectContext()); byte[] key2ValBytes = key2.valueBytes(cctx2.cacheObjectContext());
BytesRef keyByteRef = new BytesRef(k.valueBytes(coctx)); doc.add(new StoredField(VAL_FIELD_NAME, v.valueBytes(coctx)));
/** {@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); } }
val.valueBytes(coCtx);
/** {@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); }
entryHashRecord.valueString(o.toString()); entryHashRecord.valueBytes(row.value().valueBytes(grpCtx.cacheObjectContext()));
partHash += Arrays.hashCode(row.value().valueBytes(grpCtx.cacheObjectContext()));
val.valueBytes(coCtx);
int valHash = Arrays.hashCode(row.value().valueBytes(grpCtx.cacheObjectContext())); partHash += valHash;
/** {@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; }
partHash += Arrays.hashCode(row.value().valueBytes(grpCtx.cacheObjectContext()));
val.valueBytes(coCtx);
assertArrayEquals(leftRow.value().valueBytes(null), rightRow.value().valueBytes(null)); assertEquals(leftRow.version(), rightRow.version()); assertEquals(leftRow.cacheId(), rightRow.cacheId());
val.valueBytes(coCtx);
val.valueBytes(coCtx);
val.valueBytes(coCtx);