Class InPlaceEntryView
- All Implemented Interfaces:
ServerEntry
A scan applying a condition to a non-indexed property is that caller: today it copies the block and
decodes every property into an Object[] to look at one of them, and throws the result away for
every entry the condition rejects.
The values are read eagerly, and the segment never leaves the lock that guards the block.
That is not an implementation detail. A block's lifetime and content are guarded by the entry's state
lock - flush writes it and freeOffHeap releases it under that lock - so the first cut
of this class, which held the segment and read from it lazily as the matcher asked for values, read
freed memory as soon as another thread took the entry: the length header of a released block reads as
zero, the payload comes back as a zero-length segment, and the read fails with
IndexOutOfBoundsException out of the middle of an operation. It cost three FIFO-group and
three local-view tests in the mx-off-heap suite (PIC-6305, 2026-09-06). Reading the values
under the lock and matching afterwards also keeps the values consistent with each other, and keeps
whatever equals or compareTo the matcher calls - user code - out of that lock.
Not every property can be answered for, and that is a property of the format rather than a
gap to be filled: values outside BlobStoreEntryLayout's serializer registry go through one
object stream shared by the whole payload, so their bytes are not self-contained and cannot be read
from an offset. Anything this view could not supply sets isUndecided(), and a caller must
discard whatever it concluded when that is set.
Reused across the entries of one scan, by Context, so that
looking at a million entries allocates nothing per entry.
- Since:
- 18.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyteThe entry type this entry was written as, valid oncereadHeader(MemorySegment)has answered true.longThe entry's expiration time, on the same terms asgetVersion().getFixedPropertyValue(int position) Gets the specified fixed property's value.getPathValue(String path) Gets the specified path's value.getPropertyValue(String name) Gets the specified property's value.Gets the entry's type descriptor.intThe entry's version, oncereadHeader(MemorySegment)has read it.booleanWhether this entry is transient, valid oncereadHeader(MemorySegment)has answered true.booleanWhether anything asked of this view sinceview(IServerTypeDesc, int)could not be answered out of the block.voidMarks the view undecided, for a caller that could not get at the block at all.booleanread(MemorySegment payload, int position) Reads one property out of the block into this view.booleanreadHeader(MemorySegment payload) Reads the entry's own bookkeeping - its version, when it expires, which entry type it was written as and whether it is transient - out of the block header.voidview(IServerTypeDesc typeDesc, int numOfFixedProperties) Points this view at one entry and clearsisUndecided().
-
Constructor Details
-
InPlaceEntryView
public InPlaceEntryView()
-
-
Method Details
-
view
Points this view at one entry and clearsisUndecided(). Values are supplied afterwards byread(MemorySegment, int); anything not supplied answers as undecided rather than as null. -
readHeader
Reads the entry's own bookkeeping - its version, when it expires, which entry type it was written as and whether it is transient - out of the block header. Called with the entry's state lock held, for the same reasonread(MemorySegment, int)is.Only a caller that has to hand back something shaped like the entry needs this; one that only compares property values does not, and leaves these answering as undecided.
- Returns:
- false if the block cannot answer for the header, in which case the view is undecided
-
getEntryTypeCode
public byte getEntryTypeCode()The entry type this entry was written as, valid oncereadHeader(MemorySegment)has answered true. -
isTransientEntry
public boolean isTransientEntry()Whether this entry is transient, valid oncereadHeader(MemorySegment)has answered true. -
read
Reads one property out of the block into this view. Called with the entry's state lock held, so that the segment is known to be the entry's own memory for the duration.- Returns:
- false if the block cannot answer for this property, in which case the view is undecided and the caller can stop
-
markUndecided
public void markUndecided()Marks the view undecided, for a caller that could not get at the block at all. -
isUndecided
public boolean isUndecided()Whether anything asked of this view sinceview(IServerTypeDesc, int)could not be answered out of the block. Set for a property whose bytes are not self-contained, for a property nobody read, and for every question this view cannot answer at all. -
getFixedPropertyValue
Description copied from interface:ServerEntryGets the specified fixed property's value. The returned value is a reference to the actual property kept in the space.- Specified by:
getFixedPropertyValuein interfaceServerEntry- Parameters:
position- Position of requested property.- Returns:
- Requested property's value in current entry.
-
getSpaceTypeDescriptor
Description copied from interface:ServerEntryGets the entry's type descriptor.- Specified by:
getSpaceTypeDescriptorin interfaceServerEntry- Returns:
- Current entry's type descriptor.
-
getVersion
public int getVersion()The entry's version, oncereadHeader(MemorySegment)has read it. A caller that never asked for the header gets the same answer as for anything else outside the property table: undecided.- Specified by:
getVersionin interfaceServerEntry- Returns:
- the entry version.
-
getExpirationTime
public long getExpirationTime()The entry's expiration time, on the same terms asgetVersion().- Specified by:
getExpirationTimein interfaceServerEntry- Returns:
- the entry expiration time.
-
getPropertyValue
Description copied from interface:ServerEntryGets the specified property's value. The returned value is a reference to the actual property kept in the space.- Specified by:
getPropertyValuein interfaceServerEntry- Parameters:
name- Name of requested property.- Returns:
- Requested property's value in current entry.
-
getPathValue
Description copied from interface:ServerEntryGets the specified path's value. The returned value is a reference to the actual property kept in the space.- Specified by:
getPathValuein interfaceServerEntry- Parameters:
path- Path pointing to the requested property.- Returns:
- Requested path's value in current entry.
-