Interface IgniteCacheObjectProcessor

    • Method Detail

      • typeId

        int typeId​(String typeName)
        Parameters:
        typeName - Type name.
        Returns:
        Type ID.
      • typeId

        int typeId​(Object obj)
        Parameters:
        obj - Object to get type ID for.
        Returns:
        Type ID.
      • unwrapTemporary

        @Nullable
        @Nullable Object unwrapTemporary​(GridCacheContext ctx,
                                         @Nullable
                                         @Nullable Object obj)
                                  throws IgniteException
        Converts temporary off-heap object to heap-based.
        Parameters:
        ctx - Context.
        obj - Object.
        Returns:
        Heap-based object.
        Throws:
        IgniteException - In case of error.
      • prepareForCache

        @Nullable
        @Nullable CacheObject prepareForCache​(@Nullable
                                              @Nullable CacheObject obj,
                                              GridCacheContext cctx)
        Prepares cache object for cache (e.g. copies user-provided object if needed).
        Parameters:
        obj - Cache object.
        cctx - Cache context.
        Returns:
        Object to be store in cache.
      • isBinaryObject

        boolean isBinaryObject​(Object obj)
        Checks whether object is binary object.
        Parameters:
        obj - Object to check.
        Returns:
        True if object is already a binary object, false otherwise.
      • isBinaryEnabled

        boolean isBinaryEnabled​(CacheConfiguration<?,​?> ccfg)
        Checks whether given class is binary.
        Returns:
        true If binary objects are enabled.
      • field

        Object field​(Object obj,
                     String fieldName)
        Parameters:
        obj - Binary object to get field from.
        fieldName - Field name.
        Returns:
        Field value.
      • hasField

        boolean hasField​(Object obj,
                         String fieldName)
        Checks whether field is set in the object.
        Parameters:
        obj - Object.
        fieldName - Field name.
        Returns:
        true if field is set.
      • toCacheKeyObject

        KeyCacheObject toCacheKeyObject​(CacheObjectContext ctx,
                                        @Nullable
                                        @Nullable GridCacheContext cctx,
                                        Object obj,
                                        boolean userObj)
        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.
      • toCacheObject

        @Nullable
        @Nullable CacheObject toCacheObject​(CacheObjectContext ctx,
                                            @Nullable
                                            @Nullable Object obj,
                                            boolean userObj)
        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.
      • toCacheObject

        @Nullable
        @Nullable CacheObject toCacheObject​(CacheObjectContext ctx,
                                            @Nullable
                                            @Nullable Object obj,
                                            boolean userObj,
                                            boolean failIfUnregistered)
        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

        CacheObject toCacheObject​(CacheObjectContext ctx,
                                  byte type,
                                  byte[] bytes)
        Parameters:
        ctx - Cache context.
        type - Object type.
        bytes - Object bytes.
        Returns:
        Cache object.
      • immutable

        boolean immutable​(Object obj)
        Parameters:
        obj - Value.
        Returns:
        True if object is of known immutable type.
      • builder

        BinaryObjectBuilder builder​(BinaryObject binaryObj)
        Creates builder initialized by existing binary object.
        Parameters:
        binaryObj - Binary object to edit.
        Returns:
        Binary builder.
      • addMeta

        void addMeta​(int typeId,
                     BinaryType newMeta,
                     boolean failIfUnregistered)
              throws IgniteException
        Parameters:
        typeId - Type ID.
        newMeta - New metadata.
        failIfUnregistered - Fail if unregistered.
        Throws:
        IgniteException - In case of error.
      • addMetaLocally

        void addMetaLocally​(int typeId,
                            BinaryType newMeta)
                     throws IgniteException
        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.
        Parameters:
        typeId - Type ID.
        newMeta - New metadata.
        Throws:
        IgniteException - In case of error.
      • updateMetadata

        void updateMetadata​(int typeId,
                            String typeName,
                            @Nullable
                            @Nullable String affKeyFieldName,
                            Map<String,​BinaryFieldMetadata> fieldTypeIds,
                            boolean isEnum,
                            @Nullable
                            @Nullable Map<String,​Integer> enumMap)
                     throws IgniteException
        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:
        IgniteException - In case of error.
      • metadata

        @Nullable
        @Nullable BinaryType metadata​(int typeId,
                                      int schemaId)
                               throws IgniteException
        Parameters:
        typeId - Type ID.
        schemaId - Schema ID.
        Returns:
        Metadata.
        Throws:
        IgniteException - In case of error.
      • saveMetadata

        void saveMetadata​(Collection<BinaryType> types,
                          File dir)
        Parameters:
        types - Collection of binary types to write to.
        dir - Destination directory.
      • updateMetadata

        void updateMetadata​(File metadataDir,
                            BooleanSupplier stopChecker)
                     throws IgniteCheckedException
        Merge the binary metadata files stored in the specified directory.
        Parameters:
        metadataDir - Directory containing binary metadata files.
        stopChecker - Process interrupt checker.
        Throws:
        IgniteCheckedException - If failed.
      • cacheMetadataLocally

        void cacheMetadataLocally​(File metadataDir,
                                  int typeId)
                           throws IgniteCheckedException
        Merge the binary metadata file stored in the specified directory.
        Parameters:
        metadataDir - Directory containing binary metadata files.
        typeId - Type id to update.
        Throws:
        IgniteCheckedException - If failed.
      • marshalToBinary

        Object marshalToBinary​(Object obj,
                               boolean failIfUnregistered)
                        throws IgniteException
        Parameters:
        obj - Original object.
        failIfUnregistered - Throw exception if class isn't registered.
        Returns:
        Binary object (in case binary marshaller is used).
        Throws:
        IgniteException - If failed.
      • removeType

        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.
        Parameters:
        typeId - Type ID.
      • addBinaryMetadataUpdateListener

        void addBinaryMetadataUpdateListener​(BinaryMetadataUpdatedListener lsnr)
        Add binary metadata update listener.
        Parameters:
        lsnr - Listener.