org.apache.ignite.internal.processors.cache.binary

## Class CacheObjectBinaryProcessorImpl

- java.lang.Object
- - org.apache.ignite.internal.processors.GridProcessorAdapter
  - - org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl

All Implemented Interfaces:
  GridComponent, IgniteCacheObjectProcessor, GridProcessor

    public class CacheObjectBinaryProcessorImpl
    extends GridProcessorAdapter
    implements IgniteCacheObjectProcessor

Binary processor implementation.

### Nested Class Summary

Nested Classes
`static class` `CacheObjectBinaryProcessorImpl.TestBinaryContext`

### Nested classes/interfaces inherited from interface org.apache.ignite.internal.GridComponent

`GridComponent.DiscoveryDataExchangeType`

### Field Summary

Fields
`static String` `BINARY_METADATA_DESC`
`static String` `BINARY_METADATA_VIEW`
`static int` `DFLT_WAIT_SCHEMA_UPDATE`
`static boolean` `useTestBinaryCtx` For tests.

### Fields inherited from class org.apache.ignite.internal.processors.GridProcessorAdapter

`ctx, diagnosticLog, log`

### Constructor Summary

Constructors
Constructor and Description
`CacheObjectBinaryProcessorImpl(GridKernalContext ctx)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`void` `addBinaryMetadataUpdateListener(BinaryMetadataUpdatedListener lsnr)`
`void` `addMeta(int typeId, BinaryType newMeta, boolean failIfUnregistered)`
`void` `addMetaLocally(int typeId, BinaryType newMeta)` Adds metadata locally without triggering discovery exchange.
`BinaryField` `affinityKeyField(int typeId)` Get affinity key field.
`IgniteBinary` `binary()`
`BinaryContext` `binaryContext()`
`Collection<BinaryMetadata>` `binaryMetadata()`
`BinaryMetadata` `binaryMetadata(int typeId)`
`static File` `binaryWorkDir(String igniteWorkDir, String consId)`
`BinaryObject` `buildEnum(String typeName, int ord)`
`BinaryObject` `buildEnum(String typeName, String name)`
`BinaryObjectBuilder` `builder(BinaryObject binaryObj)` Creates builder initialized by existing binary object.
`BinaryObjectBuilder` `builder(String clsName)`
`void` `collectGridNodeData(DiscoveryDataBag dataBag)` Collects discovery data on nodes already in grid on receiving `TcpDiscoveryNodeAddedMessage`.
`void` `collectJoiningNodeData(DiscoveryDataBag dataBag)` Collects discovery data on joining node before sending `TcpDiscoveryJoinRequestMessage` request.
`CacheObjectContext` `contextForCache(CacheConfiguration ccfg)`
`@Nullable GridComponent.DiscoveryDataExchangeType` `discoveryDataType()` Gets unique component type to distinguish components providing discovery data.
`Object` `field(Object obj, String fieldName)`
`boolean` `hasField(Object obj, String fieldName)` Checks whether field is set in the object.
`boolean` `immutable(Object obj)`
`boolean` `isBinaryEnabled(CacheConfiguration<?,?> ccfg)` Checks whether given class is binary.
`boolean` `isBinaryObject(Object obj)` Checks whether object is binary object.
`byte[]` `marshal(CacheObjectValueContext ctx, Object val)`
`byte[]` `marshal(@Nullable Object obj)`
`GridBinaryMarshaller` `marshaller()`
`Object` `marshalToBinary(@Nullable Object obj, boolean failIfUnregistered)`
`Collection<BinaryType>` `metadata()`
`Map<Integer,BinaryType>` `metadata(Collection<Integer> typeIds)`
`@Nullable BinaryType` `metadata(int typeId)`
`@Nullable BinaryType` `metadata(int typeId, int schemaId)`
`@Nullable BinaryMetadata` `metadata0(int typeId)`
`void` `onContinuousProcessorStarted(GridKernalContext ctx)`
`void` `onDisconnected(IgniteFuture<?> reconnectFut)` Client disconnected callback.
`void` `onGridDataReceived(DiscoveryDataBag.GridDiscoveryData data)` Receives discovery data object from remote nodes (called on new node during discovery process).
`void` `onJoiningNodeDataReceived(DiscoveryDataBag.JoiningNodeDiscoveryData data)` Method is called on nodes that are already in grid (not on joining node).
`void` `onKernalStart(boolean active)` Callback that notifies that kernal has successfully started, including all managers and processors.
`IgniteInternalFuture<?>` `onReconnected(boolean clusterRestarted)` Client reconnected callback.
`@Nullable CacheObject` `prepareForCache(@Nullable CacheObject obj, GridCacheContext cctx)` Prepares cache object for cache (e.g. copies user-provided object if needed).
`BinaryType` `registerEnum(String typeName, Map<String,Integer> vals)` Register enum type
`void` `removeType(int typeId)` Remove registered binary type from grid.
`static File` `resolveBinaryWorkDir(String igniteWorkDir, String consId)`
`void` `saveMetadata(Collection<BinaryType> types, File dir)`
`void` `setBinaryMetadataFileStoreDir(@Nullable File binaryMetadataFileStoreDir)` Sets path to binary metadata store configured by user, should include binary_meta and consistentId
`void` `start()` Starts grid component.
`void` `stop(boolean cancel)` Stops grid component.
`@Nullable Object` `toBinary(@Nullable Object obj, boolean failIfUnregistered)`
`KeyCacheObject` `toCacheKeyObject(CacheObjectContext ctx, @Nullable GridCacheContext cctx, Object obj, boolean userObj)`
`protected KeyCacheObject` `toCacheKeyObject0(CacheObjectContext ctx, @Nullable GridCacheContext cctx, Object obj, boolean userObj)`
`CacheObject` `toCacheObject(CacheObjectContext ctx, ByteBuffer buf)`
`IncompleteCacheObject` `toCacheObject(CacheObjectContext ctx, ByteBuffer buf, @Nullable IncompleteCacheObject incompleteObj)`
`CacheObject` `toCacheObject(CacheObjectContext ctx, byte type, byte[] bytes)`
`@Nullable CacheObject` `toCacheObject(CacheObjectContext ctx, @Nullable Object obj, boolean userObj)`
`@Nullable CacheObject` `toCacheObject(CacheObjectContext ctx, @Nullable Object obj, boolean userObj, boolean failIfUnregistered)`
`IncompleteCacheObject` `toKeyCacheObject(CacheObjectContext ctx, ByteBuffer buf, @Nullable IncompleteCacheObject incompleteObj)`
`KeyCacheObject` `toKeyCacheObject(CacheObjectContext ctx, byte type, byte[] bytes)`
`int` `typeId(Object obj)`
`int` `typeId(String typeName)`
`Object` `unmarshal(CacheObjectValueContext ctx, byte[] bytes, ClassLoader clsLdr)`
`Object` `unmarshal(long ptr, boolean forceHeap)`
`Object` `unwrapTemporary(GridCacheContext ctx, Object obj)` Converts temporary off-heap object to heap-based.
`void` `updateMetadata(File metadataDir, BooleanSupplier stopChecker)` Merge the binary metadata files stored in the specified directory.
`void` `updateMetadata(int typeId, String typeName, @Nullable String affKeyFieldName, Map<String,BinaryFieldMetadata> fieldTypeIds, boolean isEnum, @Nullable Map<String,Integer> enumMap)`
`@Nullable IgniteNodeValidationResult` `validateNode(ClusterNode rmtNode, DiscoveryDataBag.JoiningNodeDiscoveryData discoData)` Validates that new node can join grid topology, this method is called on coordinator node before new node joins topology.
`void` `waitMetadataWriteIfNeeded(int typeId)` Forces caller thread to wait for binary metadata write operation for given type ID.

### Methods inherited from class org.apache.ignite.internal.processors.GridProcessorAdapter

`assertParameter, onKernalStop, printMemoryStats, toString, validateNode`

### 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.GridComponent

`onKernalStop, printMemoryStats, validateNode`

### Field Detail

#### DFLT_WAIT_SCHEMA_UPDATE

    public static final int DFLT_WAIT_SCHEMA_UPDATE

See Also:
  `IgniteSystemProperties.IGNITE_WAIT_SCHEMA_UPDATE`, Constant Field Values

#### BINARY_METADATA_VIEW

    public static final String BINARY_METADATA_VIEW

See Also:
  `BinaryMetadataView`

#### BINARY_METADATA_DESC

    public static final String BINARY_METADATA_DESC

See Also:
  `BinaryMetadataView`, Constant Field Values

#### useTestBinaryCtx

    public static boolean useTestBinaryCtx

For tests.

### Constructor Detail

#### CacheObjectBinaryProcessorImpl

    public CacheObjectBinaryProcessorImpl(GridKernalContext ctx)

Parameters:
  `ctx` - Kernal context.

### Method Detail

#### resolveBinaryWorkDir

    public static File resolveBinaryWorkDir(String igniteWorkDir,
                                            String consId)

Parameters:
  `igniteWorkDir` - Basic ignite working directory.
  `consId` - Node consistent id.
Returns:
  Working directory.

#### binaryWorkDir

    public static File binaryWorkDir(String igniteWorkDir,
                                     String consId)

Parameters:
  `igniteWorkDir` - Basic ignite working directory.
  `consId` - Node consistent id.
Returns:
  Working directory.

#### start

    public void start()
               throws IgniteCheckedException

Starts grid component.

Specified by:
  `start` in interface `GridComponent`
Overrides:
  `start` in class `GridProcessorAdapter`
Throws:
  `IgniteCheckedException` - Throws in case of any errors.

#### addBinaryMetadataUpdateListener

    public void addBinaryMetadataUpdateListener(BinaryMetadataUpdatedListener lsnr)

Parameters:
  `lsnr` - Listener.

#### stop

    public void stop(boolean cancel)

Stops grid component.

Specified by:
  `stop` in interface `GridComponent`
Overrides:
  `stop` in class `GridProcessorAdapter`
Parameters:
  `cancel` - If `true`, then all ongoing tasks or jobs for relevant components need to be cancelled.

#### onDisconnected

    public void onDisconnected(IgniteFuture<?> reconnectFut)

Client disconnected callback.

Specified by:
  `onDisconnected` in interface `GridComponent`
Overrides:
  `onDisconnected` in class `GridProcessorAdapter`
Parameters:
  `reconnectFut` - Reconnect future.

#### onReconnected

    public IgniteInternalFuture<?> onReconnected(boolean clusterRestarted)
                                          throws IgniteCheckedException

Client reconnected callback.

Specified by:
  `onReconnected` in interface `GridComponent`
Overrides:
  `onReconnected` in class `GridProcessorAdapter`
Parameters:
  `clusterRestarted` - Cluster restarted flag.
Returns:
  Future to wait before completing reconnect future.
Throws:
  `IgniteCheckedException` - If failed.

#### onKernalStart

    public void onKernalStart(boolean active)
                       throws IgniteCheckedException

Callback that notifies that kernal has successfully started, including all managers and processors.

Specified by:
  `onKernalStart` in interface `GridComponent`
Overrides:
  `onKernalStart` in class `GridProcessorAdapter`
Parameters:
  `active` - Cluster active flag (note: should be used carefully since state can change concurrently).
Throws:
  `IgniteCheckedException` - Thrown in case of any errors.

#### prepareForCache

    @Nullable
    public @Nullable CacheObject prepareForCache(@Nullable
                                                           @Nullable CacheObject obj,
                                                           GridCacheContext cctx)

Prepares cache object for cache (e.g. copies user-provided object if needed).

Specified by:
  `prepareForCache` in interface `IgniteCacheObjectProcessor`
Parameters:
  `obj` - Cache object.
  `cctx` - Cache context.
Returns:
  Object to be store in cache.

#### typeId

    public int typeId(String typeName)

Specified by:
  `typeId` in interface `IgniteCacheObjectProcessor`
Parameters:
  `typeName` - Type name.
Returns:
  Type ID.

#### immutable

    public boolean immutable(Object obj)

Specified by:
  `immutable` in interface `IgniteCacheObjectProcessor`
Parameters:
  `obj` - Value.
Returns:
  `True` if object is of known immutable type.

#### onContinuousProcessorStarted

    public void onContinuousProcessorStarted(GridKernalContext ctx)

Specified by:
  `onContinuousProcessorStarted` in interface `IgniteCacheObjectProcessor`
Parameters:
  `ctx` - Context.

#### marshal

    public byte[] marshal(@Nullable
                          @Nullable Object obj)
                   throws BinaryObjectException

Parameters:
  `obj` - Object.
Returns:
  Bytes.
Throws:
  `BinaryObjectException` - If failed.

#### unmarshal

    public Object unmarshal(long ptr,
                            boolean forceHeap)
                     throws BinaryObjectException

Parameters:
  `ptr` - Off-heap pointer.
  `forceHeap` - If `true` creates heap-based object.
Returns:
  Object.
Throws:
  `BinaryObjectException` - If failed.

#### marshalToBinary

    public Object marshalToBinary(@Nullable
                                  @Nullable Object obj,
                                  boolean failIfUnregistered)
                           throws BinaryObjectException

Specified by:
  `marshalToBinary` in interface `IgniteCacheObjectProcessor`
Parameters:
  `obj` - Original object.
  `failIfUnregistered` - Throw exception if class isn't registered.
Returns:
  Binary object (in case binary marshaller is used).
Throws:
  `BinaryObjectException`

#### marshaller

    public GridBinaryMarshaller marshaller()

Returns:
  Marshaller.

#### builder

    public BinaryObjectBuilder builder(String clsName)

Specified by:
  `builder` in interface `IgniteCacheObjectProcessor`
Parameters:
  `clsName` - Class name.
Returns:
  Builder.

#### builder

    public BinaryObjectBuilder builder(BinaryObject binaryObj)

Creates builder initialized by existing binary object.

Specified by:
  `builder` in interface `IgniteCacheObjectProcessor`
Parameters:
  `binaryObj` - Binary object to edit.
Returns:
  Binary builder.

#### updateMetadata

    public void updateMetadata(int typeId,
                               String typeName,
                               @Nullable
                               @Nullable String affKeyFieldName,
                               Map<String,BinaryFieldMetadata> fieldTypeIds,
                               boolean isEnum,
                               @Nullable
                               @Nullable Map<String,Integer> enumMap)
                        throws BinaryObjectException

Specified by:
  `updateMetadata` in interface `IgniteCacheObjectProcessor`
Parameters:
  `typeId` - Type ID.
  `typeName` - Type name.
  `affKeyFieldName` - Affinity key field name.
  `fieldTypeIds` - Fields map.
  `isEnum` - Enum flag.
  `enumMap` - Enum name to ordinal mapping.
Throws:
  `BinaryObjectException`

#### addMeta

    public void addMeta(int typeId,
                        BinaryType newMeta,
                        boolean failIfUnregistered)
                 throws BinaryObjectException

Specified by:
  `addMeta` in interface `IgniteCacheObjectProcessor`
Parameters:
  `typeId` - Type ID.
  `newMeta` - New metadata.
  `failIfUnregistered` - Fail if unregistered.
Throws:
  `BinaryObjectException`

#### addMetaLocally

    public void addMetaLocally(int typeId,
                               BinaryType newMeta)
                        throws BinaryObjectException

Adds metadata locally without triggering discovery exchange. Must be used only during startup and only if it is guaranteed that all nodes have the same copy of BinaryType.

Specified by:
  `addMetaLocally` in interface `IgniteCacheObjectProcessor`
Parameters:
  `typeId` - Type ID.
  `newMeta` - New metadata.
Throws:
  `BinaryObjectException`

#### metadata

    @Nullable
    public @Nullable BinaryType metadata(int typeId)

Specified by:
  `metadata` in interface `IgniteCacheObjectProcessor`
Parameters:
  `typeId` - Type ID.
Returns:
  Metadata.

#### waitMetadataWriteIfNeeded

    public void waitMetadataWriteIfNeeded(int typeId)

Forces caller thread to wait for binary metadata write operation for given type ID. In case of in-memory mode this method becomes a No-op as no binary metadata is written to disk in this mode.

Parameters:
  `typeId` - ID of binary type to wait for metadata write operation.

#### metadata0

    @Nullable
    public @Nullable BinaryMetadata metadata0(int typeId)

Parameters:
  `typeId` - Type ID.
Returns:
  Metadata.
Throws:
  `IgniteException` - In case of error.

#### metadata

    @Nullable
    public @Nullable BinaryType metadata(int typeId,
                                                   int schemaId)

Specified by:
  `metadata` in interface `IgniteCacheObjectProcessor`
Parameters:
  `typeId` - Type ID.
  `schemaId` - Schema ID.
Returns:
  Metadata.

#### metadata

    public Map<Integer,BinaryType> metadata(Collection<Integer> typeIds)
                                     throws BinaryObjectException

Specified by:
  `metadata` in interface `IgniteCacheObjectProcessor`
Parameters:
  `typeIds` - Type ID.
Returns:
  Metadata.
Throws:
  `BinaryObjectException`

#### metadata

    public Collection<BinaryType> metadata()
                                    throws BinaryObjectException

Specified by:
  `metadata` in interface `IgniteCacheObjectProcessor`
Returns:
  Metadata for all types.
Throws:
  `BinaryObjectException`

#### binaryMetadata

    public Collection<BinaryMetadata> binaryMetadata()
                                              throws BinaryObjectException

Returns:
  Cluster binary metadata.
Throws:
  `BinaryObjectException` - on error.

#### binaryMetadata

    public BinaryMetadata binaryMetadata(int typeId)
                                  throws BinaryObjectException

Returns:
  Binary metadata for specified type.
Throws:
  `BinaryObjectException` - on error.

#### saveMetadata

    public void saveMetadata(Collection<BinaryType> types,
                             File dir)

Specified by:
  `saveMetadata` in interface `IgniteCacheObjectProcessor`
Parameters:
  `types` - Collection of binary types to write to.
  `dir` - Destination directory.

#### updateMetadata

    public void updateMetadata(File metadataDir,
                               BooleanSupplier stopChecker)
                        throws IgniteCheckedException

Merge the binary metadata files stored in the specified directory.

Specified by:
  `updateMetadata` in interface `IgniteCacheObjectProcessor`
Parameters:
  `metadataDir` - Directory containing binary metadata files.
  `stopChecker` - Process interrupt checker.
Throws:
  `IgniteCheckedException` - If failed.

#### buildEnum

    public BinaryObject buildEnum(String typeName,
                                  int ord)
                           throws BinaryObjectException

Specified by:
  `buildEnum` in interface `IgniteCacheObjectProcessor`
Parameters:
  `typeName` - Type name.
  `ord` - ordinal.
Returns:
  Enum object.
Throws:
  `BinaryObjectException`

#### buildEnum

    public BinaryObject buildEnum(String typeName,
                                  String name)
                           throws BinaryObjectException

Specified by:
  `buildEnum` in interface `IgniteCacheObjectProcessor`
Parameters:
  `typeName` - Type name.
  `name` - Name.
Returns:
  Enum object.
Throws:
  `BinaryObjectException`

#### registerEnum

    public BinaryType registerEnum(String typeName,
                                   Map<String,Integer> vals)
                            throws BinaryObjectException

Register enum type

Specified by:
  `registerEnum` in interface `IgniteCacheObjectProcessor`
Parameters:
  `typeName` - Type name.
  `vals` - Mapping of enum constant names to ordinals.
Returns:
  Binary Type for registered enum.
Throws:
  `BinaryObjectException`

#### binary

    public IgniteBinary binary()
                        throws IgniteException

Specified by:
  `binary` in interface `IgniteCacheObjectProcessor`
Returns:
  Ignite binary interface.
Throws:
  `IgniteException` - If failed.

#### isBinaryObject

    public boolean isBinaryObject(Object obj)

Checks whether object is binary object.

Specified by:
  `isBinaryObject` in interface `IgniteCacheObjectProcessor`
Parameters:
  `obj` - Object to check.
Returns:
  `True` if object is already a binary object, `false` otherwise.

#### isBinaryEnabled

    public boolean isBinaryEnabled(CacheConfiguration<?,?> ccfg)

Checks whether given class is binary.

Specified by:
  `isBinaryEnabled` in interface `IgniteCacheObjectProcessor`
Returns:
  `true` If binary objects are enabled.

#### affinityKeyField

    public BinaryField affinityKeyField(int typeId)

Get affinity key field.

Parameters:
  `typeId` - Binary object type ID.
Returns:
  Affinity key.

#### typeId

    public int typeId(Object obj)

Specified by:
  `typeId` in interface `IgniteCacheObjectProcessor`
Parameters:
  `obj` - Object to get type ID for.
Returns:
  Type ID.

#### field

    public Object field(Object obj,
                        String fieldName)

Specified by:
  `field` in interface `IgniteCacheObjectProcessor`
Parameters:
  `obj` - Binary object to get field from.
  `fieldName` - Field name.
Returns:
  Field value.

#### hasField

    public boolean hasField(Object obj,
                            String fieldName)

Checks whether field is set in the object.

Specified by:
  `hasField` in interface `IgniteCacheObjectProcessor`
Parameters:
  `obj` - Object.
  `fieldName` - Field name.
Returns:
  `true` if field is set.

#### binaryContext

    public BinaryContext binaryContext()

Returns:
  Binary context.

#### contextForCache

    public CacheObjectContext contextForCache(CacheConfiguration ccfg)
                                       throws IgniteCheckedException

Specified by:
  `contextForCache` in interface `IgniteCacheObjectProcessor`
Parameters:
  `ccfg` - Cache configuration.
Returns:
  Cache object context.
Throws:
  `IgniteCheckedException` - If failed.

#### marshal

    public byte[] marshal(CacheObjectValueContext ctx,
                          Object val)
                   throws IgniteCheckedException

Specified by:
  `marshal` in interface `IgniteCacheObjectProcessor`
Parameters:
  `ctx` - Cache object context.
  `val` - Value.
Returns:
  Value bytes.
Throws:
  `IgniteCheckedException` - If failed.

#### unmarshal

    public Object unmarshal(CacheObjectValueContext ctx,
                            byte[] bytes,
                            ClassLoader clsLdr)
                     throws IgniteCheckedException

Specified by:
  `unmarshal` in interface `IgniteCacheObjectProcessor`
Parameters:
  `ctx` - Context.
  `bytes` - Bytes.
  `clsLdr` - Class loader.
Returns:
  Unmarshalled object.
Throws:
  `IgniteCheckedException` - If failed.

#### toCacheKeyObject

    public KeyCacheObject toCacheKeyObject(CacheObjectContext ctx,
                                           @Nullable
                                           @Nullable GridCacheContext cctx,
                                           Object obj,
                                           boolean userObj)

Specified by:
  `toCacheKeyObject` in interface `IgniteCacheObjectProcessor`
Parameters:
  `ctx` - Cache objects context.
  `cctx` - Cache context if cache is available.
  `obj` - Key value.
  `userObj` - If `true` then given object is object provided by user and should be copied before stored in cache.
Returns:
  Cache key object.

#### toCacheKeyObject0

    protected KeyCacheObject toCacheKeyObject0(CacheObjectContext ctx,
                                               @Nullable
                                               @Nullable GridCacheContext cctx,
                                               Object obj,
                                               boolean userObj)

Parameters:
  `obj` - Object.
  `userObj` - If `true` then given object is object provided by user and should be copied before stored in cache.
Returns:
  Key cache object.

#### toCacheObject

    @Nullable
    public @Nullable CacheObject toCacheObject(CacheObjectContext ctx,
                                                         @Nullable
                                                         @Nullable Object obj,
                                                         boolean userObj,
                                                         boolean failIfUnregistered)

Specified by:
  `toCacheObject` in interface `IgniteCacheObjectProcessor`
Parameters:
  `ctx` - Cache context.
  `obj` - Object.
  `userObj` - If `true` then given object is object provided by user and should be copied before stored in cache.
  `failIfUnregistered` - Throw exception if class isn't registered.
Returns:
  Cache object.

#### toCacheObject

    public CacheObject toCacheObject(CacheObjectContext ctx,
                                     byte type,
                                     byte[] bytes)

Specified by:
  `toCacheObject` in interface `IgniteCacheObjectProcessor`
Parameters:
  `ctx` - Cache context.
  `type` - Object type.
  `bytes` - Object bytes.
Returns:
  Cache object.

#### toKeyCacheObject

    public KeyCacheObject toKeyCacheObject(CacheObjectContext ctx,
                                           byte type,
                                           byte[] bytes)
                                    throws IgniteCheckedException

Specified by:
  `toKeyCacheObject` in interface `IgniteCacheObjectProcessor`
Parameters:
  `ctx` - Cache context.
  `type` - Object type.
  `bytes` - Object bytes.
Returns:
  Cache object.
Throws:
  `IgniteCheckedException`

#### toCacheObject

    public CacheObject toCacheObject(CacheObjectContext ctx,
                                     ByteBuffer buf)

Specified by:
  `toCacheObject` in interface `IgniteCacheObjectProcessor`
Parameters:
  `ctx` - Cache context.
  `buf` - Buffer to read from.
Returns:
  Cache object.

#### toCacheObject

    public IncompleteCacheObject toCacheObject(CacheObjectContext ctx,
                                               ByteBuffer buf,
                                               @Nullable
                                               @Nullable IncompleteCacheObject incompleteObj)

Specified by:
  `toCacheObject` in interface `IgniteCacheObjectProcessor`
Parameters:
  `ctx` - Cache object context.
  `buf` - Buffer.
  `incompleteObj` - Incomplete cache object or `null` if it's a first read.
Returns:
  Incomplete cache object.

#### toKeyCacheObject

    public IncompleteCacheObject toKeyCacheObject(CacheObjectContext ctx,
                                                  ByteBuffer buf,
                                                  @Nullable
                                                  @Nullable IncompleteCacheObject incompleteObj)
                                           throws IgniteCheckedException

Specified by:
  `toKeyCacheObject` in interface `IgniteCacheObjectProcessor`
Parameters:
  `ctx` - Cache object context.
  `buf` - Buffer.
  `incompleteObj` - Incomplete cache object or `null` if it's a first read.
Returns:
  Incomplete cache object.
Throws:
  `IgniteCheckedException` - If fail.

#### toCacheObject

    @Nullable
    public @Nullable CacheObject toCacheObject(CacheObjectContext ctx,
                                                         @Nullable
                                                         @Nullable Object obj,
                                                         boolean userObj)

Specified by:
  `toCacheObject` in interface `IgniteCacheObjectProcessor`
Parameters:
  `ctx` - Cache context.
  `obj` - Object.
  `userObj` - If `true` then given object is object provided by user and should be copied before stored in cache.
Returns:
  Cache object.

#### unwrapTemporary

    public Object unwrapTemporary(GridCacheContext ctx,
                                  Object obj)
                           throws BinaryObjectException

Converts temporary off-heap object to heap-based.

Specified by:
  `unwrapTemporary` in interface `IgniteCacheObjectProcessor`
Parameters:
  `ctx` - Context.
  `obj` - Object.
Returns:
  Heap-based object.
Throws:
  `BinaryObjectException`

#### toBinary

    @Nullable
    public @Nullable Object toBinary(@Nullable
                                               @Nullable Object obj,
                                               boolean failIfUnregistered)
                                        throws IgniteException

Parameters:
  `obj` - Object.
Returns:
  Binary object.
Throws:
  `IgniteException` - In case of error.

#### validateNode

    @Nullable
    public @Nullable IgniteNodeValidationResult validateNode(ClusterNode rmtNode,
                                                                       DiscoveryDataBag.JoiningNodeDiscoveryData discoData)

Validates that new node can join grid topology, this method is called on coordinator node before new node joins topology.

Specified by:
  `validateNode` in interface `GridComponent`
Overrides:
  `validateNode` in class `GridProcessorAdapter`
Parameters:
  `rmtNode` - Joining node.
  `discoData` - Joining node discovery data.
Returns:
  Validation result or `null` in case of success.

#### discoveryDataType

    @Nullable
    public @Nullable GridComponent.DiscoveryDataExchangeType discoveryDataType()

Gets unique component type to distinguish components providing discovery data. Must return non-null value if component implements any of methods `GridComponent.collectJoiningNodeData(DiscoveryDataBag)` or `GridComponent.collectGridNodeData(DiscoveryDataBag)`.

Specified by:
  `discoveryDataType` in interface `GridComponent`
Overrides:
  `discoveryDataType` in class `GridProcessorAdapter`
Returns:
  Unique component type for discovery data exchange.

#### collectGridNodeData

    public void collectGridNodeData(DiscoveryDataBag dataBag)

Collects discovery data on nodes already in grid on receiving `TcpDiscoveryNodeAddedMessage`.

Specified by:
  `collectGridNodeData` in interface `GridComponent`
Overrides:
  `collectGridNodeData` in class `GridProcessorAdapter`
Parameters:
  `dataBag` - container object to store discovery data in.

#### collectJoiningNodeData

    public void collectJoiningNodeData(DiscoveryDataBag dataBag)

Collects discovery data on joining node before sending `TcpDiscoveryJoinRequestMessage` request.

Specified by:
  `collectJoiningNodeData` in interface `GridComponent`
Overrides:
  `collectJoiningNodeData` in class `GridProcessorAdapter`
Parameters:
  `dataBag` - container object to store discovery data in.

#### onJoiningNodeDataReceived

    public void onJoiningNodeDataReceived(DiscoveryDataBag.JoiningNodeDiscoveryData data)

Method is called on nodes that are already in grid (not on joining node). It receives discovery data from joining node.

Specified by:
  `onJoiningNodeDataReceived` in interface `GridComponent`
Overrides:
  `onJoiningNodeDataReceived` in class `GridProcessorAdapter`
Parameters:
  `data` - `DiscoveryDataBag.JoiningNodeDiscoveryData` interface to retrieve discovery data of joining node.

#### onGridDataReceived

    public void onGridDataReceived(DiscoveryDataBag.GridDiscoveryData data)

Receives discovery data object from remote nodes (called on new node during discovery process).

Specified by:
  `onGridDataReceived` in interface `GridComponent`
Overrides:
  `onGridDataReceived` in class `GridProcessorAdapter`
Parameters:
  `data` - `DiscoveryDataBag.GridDiscoveryData` interface to retrieve discovery data collected on remote nodes (data common for all nodes in grid and specific for each node).

#### setBinaryMetadataFileStoreDir

    public void setBinaryMetadataFileStoreDir(@Nullable
                                              @Nullable File binaryMetadataFileStoreDir)

Sets path to binary metadata store configured by user, should include binary_meta and consistentId

Parameters:
  `binaryMetadataFileStoreDir` - path to binary_meta

#### removeType

    public void removeType(int typeId)

Remove registered binary type from grid. Attention: this is not safe feature, the grid must not contain binary objects with specified type, operations with specified type must not be processed on the cluster.

Specified by:
  `removeType` in interface `IgniteCacheObjectProcessor`
Parameters:
  `typeId` - Type ID.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.11.1
Release Date | : December 20 2021