org.apache.ignite.internal.cache.query.index.sorted.inline

## Class InlineObjectBytesDetector

- java.lang.Object
- - org.apache.ignite.internal.cache.query.index.sorted.inline.InlineObjectBytesDetector

All Implemented Interfaces:
  BPlusTree.TreeRowClosure<IndexRow,IndexRow>

    public class InlineObjectBytesDetector
    extends Object
    implements BPlusTree.TreeRowClosure<IndexRow,IndexRow>

This class helps to detect whether tree contains inlined JO type. When starting on old Ignite versions it's impossible to discover whether JO type was inlined or not. Then try to find that with 2 steps: 1. analyze of inline size; 2. traverse tree and check stored values.

### Constructor Summary

Constructors
Constructor and Description
`InlineObjectBytesDetector(int inlineSize, List<IndexKeyDefinition> keyDefs, IndexName idxName, IgniteLogger log)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`boolean` `apply(BPlusTree<IndexRow,IndexRow> tree, BPlusIO<IndexRow> io, long pageAddr, int idx)` Performs inspection or operation on a specified row and returns true if this row is required or matches or /operation successful (depending on the context).
`boolean` `inlineObjectSupported()`
`static boolean` `objectMayBeInlined(int inlineSize, List<IndexKeyDefinition> keyDefs)` Static analyze inline_size and inline columns set.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### InlineObjectBytesDetector

    public InlineObjectBytesDetector(int inlineSize,
                                     List<IndexKeyDefinition> keyDefs,
                                     IndexName idxName,
                                     IgniteLogger log)

Parameters:
  `inlineSize` - Inline size.
  `keyDefs` - Index key definitions.
  `idxName` - Index name.
  `log` - Ignite logger.

### Method Detail

#### apply

    public boolean apply(BPlusTree<IndexRow,IndexRow> tree,
                         BPlusIO<IndexRow> io,
                         long pageAddr,
                         int idx)
                  throws IgniteCheckedException

Performs inspection or operation on a specified row and returns true if this row is required or matches or /operation successful (depending on the context).

Specified by:
  `apply` in interface `BPlusTree.TreeRowClosure<IndexRow,IndexRow>`
Parameters:
  `tree` - The tree.
  `io` - Th tree IO object.
  `pageAddr` - The page address.
  `idx` - The item index.
Returns:
  `True` if the item passes the predicate.
Throws:
  `IgniteCheckedException` - If failed.

#### inlineObjectSupported

    public boolean inlineObjectSupported()

Returns:
  `true` if inline object is supported on current tree.

#### objectMayBeInlined

    public static boolean objectMayBeInlined(int inlineSize,
                                             List<IndexKeyDefinition> keyDefs)

Static analyze inline_size and inline columns set. e.g.: indexed: (long, obj) and inline_size < 12. In this case there is no space for inline object.

Parameters:
  `keyDefs` - Index key definition.
  `inlineSize` - Inline size.
Returns:
  `true` If the object may be inlined.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.11.0
Release Date | : September 11 2021