Class DataClayDeserializationLib


  • public final class DataClayDeserializationLib
    extends Object
    Serialization library for communications.
    • Field Detail

      • DEBUG_ENABLED

        public static final boolean DEBUG_ENABLED
        Indicates if debug is enabled.
      • LOGGER

        public static final org.apache.logging.log4j.Logger LOGGER
        Logger.
    • Method Detail

      • createBufferAndDeserialize

        public static void createBufferAndDeserialize​(DataClayByteArray byteArray,
                                                      DataClaySerializable instance,
                                                      Map<MetaClassID,​byte[]> ifaceBitMaps,
                                                      DataClayObjectMetaData metadata,
                                                      Map<Integer,​Object> curDeserializedJavaObjs)
        Create buffer and deserialize
        Parameters:
        byteArray - Byte array
        instance - instance Instance to deserialize
        ifaceBitMaps - Map of bitmaps representing the interfaces to use
        metadata - Object metadata (e.g. for language objects)
        curDeserializedJavaObjs - Currently deserialized Java objects
      • deserializeMessageFromDB

        public static CommonMessages.PersistentObjectInDB deserializeMessageFromDB​(byte[] objectBytes)
        Deserialize grpc message in DB
        Parameters:
        objectBytes - Object bytes
        Returns:
        Deserialized grpc message
      • deserializeObjectFromDBBytesIntoObjectData

        public static ObjectWithDataParamOrReturn deserializeObjectFromDBBytesIntoObjectData​(ObjectID objectID,
                                                                                             byte[] objectBytes,
                                                                                             DataClayRuntime theLib)
        Deserialize object from bytes into ObjectWithDataParamOrReturn
        Parameters:
        objectID - ID of object
        objectBytes - Object bytes
        theLib - Library to use
        Returns:
        ObjectWithDataParamOrReturn serialized.
      • deserializeObjectFromDBBytes

        public static void deserializeObjectFromDBBytes​(DataClayExecutionObject objectToFill,
                                                        byte[] objectBytes,
                                                        DataServiceRuntime theLib)
        Deserialize object from bytes
        Parameters:
        objectToFill - Object to fill
        objectBytes - Object bytes
        theLib - Library to use
      • deserializeObjectFromDBBytesAux

        public static void deserializeObjectFromDBBytesAux​(DataClayExecutionObject instance,
                                                           DataClayObjectMetaData metadata,
                                                           com.google.protobuf.ByteString data,
                                                           DataServiceRuntime theLib)
        Given metadata and data, deserialize into instance. This function is used if no class id is provided.
        Parameters:
        instance - Instance where object is deserialized
        metadata - Object metadata
        data - Object data
        theLib - Library to use
      • deserializeMetaDataFromDB

        public static DataClayObjectMetaData deserializeMetaDataFromDB​(byte[] objectBytes)
        Deserialize MetaData of object from database
        Parameters:
        objectBytes - Object bytes
        Returns:
        Deserialized metadata
      • deserializeReturnFilterMethod

        public static boolean deserializeReturnFilterMethod​(SerializedParametersOrReturn serializedObjs)
        Special method for deserializing boolean return of a Filter method.
        Parameters:
        serializedObjs - Return of filter method
        Returns:
        TRUE if filter method returns TRUE, FALSE otherwise.
      • deserializeObjectWithData

        public static void deserializeObjectWithData​(ObjectWithDataParamOrReturn paramOrRet,
                                                     DataClayExecutionObject object,
                                                     Map<MetaClassID,​byte[]> ifaceBitMaps,
                                                     DataClayRuntime theLib,
                                                     SessionID ownerSessionID,
                                                     boolean forceDeserialization)
        Deserialize object into a memory instance. ALSO called from executeImplementation in case of 'executions during deserialization'. THIS FUNCTION SHOULD NEVER BE CALLED FROM CLIENT SIDE.
        Parameters:
        paramOrRet - Param/return bytes and metadata
        object - Object in which to deserialize data.
        ifaceBitMaps - Interface bitmaps
        theLib - The client lib
        ownerSessionID - Can be null. ID of owner session of the object. Used for volatiles pending to register.
        forceDeserialization - Check if the object is loaded or not. If FALSE and loaded, then no deserialization is happening. If TRUE, then deserialization is forced.
      • deserializeObjectWithDataInClient

        public static void deserializeObjectWithDataInClient​(ObjectWithDataParamOrReturn paramOrRet,
                                                             DataClayObject object,
                                                             Map<MetaClassID,​byte[]> ifaceBitMaps,
                                                             DataClayRuntime theLib,
                                                             SessionID ownerSessionID)
        Deserialize object into a non-persistent memory instance IN CLIENT It ensures the object is not marked as persistent.
        Parameters:
        paramOrRet - Param/return bytes and metadata
        object - Object in which to deserialize data.
        ifaceBitMaps - Interface bitmaps
        theLib - The client lib
        ownerSessionID - Can be null. ID of owner session of the object. Used for volatiles pending to register.
      • deserializeParamsOrReturn

        public static Object[] deserializeParamsOrReturn​(SerializedParametersOrReturn serializedParamsOrReturn,
                                                         Map<MetaClassID,​byte[]> ifaceBitMaps,
                                                         DataClayRuntime theLib)
        Deserialize parameters of an execution
        Parameters:
        serializedParamsOrReturn - Parameters or return to deserialize
        ifaceBitMaps - Interface bitmaps (for Client - DS communication)
        theLib - DataClayLib to use
        Returns:
        Parameters
      • deserializeJavaField

        public static Object deserializeJavaField​(DataClayJavaWrapper wrapper,
                                                  DataClayByteBuffer dcBuffer,
                                                  Map<MetaClassID,​byte[]> ifaceBitMaps,
                                                  DataClayObjectMetaData metadata,
                                                  Map<Integer,​Object> curDeserializedObjs)
        Deserialize java field
        Parameters:
        wrapper - Wrapper used for deserialization
        dcBuffer - Buffer from which to read
        ifaceBitMaps - Interface bitmaps
        metadata - DataClay object metadata
        curDeserializedObjs - Current deserialized objects
        Returns:
        Deserialized java object
      • extractReferenceCounting

        public static byte[] extractReferenceCounting​(byte[] objectBytes)
        Extract bytes representing the reference counting without deserializing it. @see DataClayDiskGC:queueReferenceCounting
        Parameters:
        objectBytes - Bytes of the object
        Returns:
        Bytes representing the reference counting.