Class DataClayDeserializationLib
- java.lang.Object
-
- es.bsc.dataclay.serialization.lib.DataClayDeserializationLib
-
public final class DataClayDeserializationLib extends Object
Serialization library for communications.
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
DEBUG_ENABLED
Indicates if debug is enabled.static org.apache.logging.log4j.Logger
LOGGER
Logger.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
createBufferAndDeserialize(DataClayByteArray byteArray, DataClaySerializable instance, Map<MetaClassID,byte[]> ifaceBitMaps, DataClayObjectMetaData metadata, Map<Integer,Object> curDeserializedJavaObjs)
Create buffer and deserializestatic DataClayObject
deserializeAssociation(DataClayByteBuffer dcBuffer, Map<MetaClassID,byte[]> ifaceBitMaps, DataClayObjectMetaData metadata, Map<Integer,Object> curDeserializedObjs, DataClayRuntime theLib)
static Object
deserializeJavaField(DataClayJavaWrapper wrapper, DataClayByteBuffer dcBuffer, Map<MetaClassID,byte[]> ifaceBitMaps, DataClayObjectMetaData metadata, Map<Integer,Object> curDeserializedObjs)
Deserialize java fieldstatic CommonMessages.PersistentObjectInDB
deserializeMessageFromDB(byte[] objectBytes)
Deserialize grpc message in DBstatic DataClayObjectMetaData
deserializeMetaDataFromDB(byte[] objectBytes)
Deserialize MetaData of object from databasestatic void
deserializeObjectFromDBBytes(DataClayExecutionObject objectToFill, byte[] objectBytes, DataServiceRuntime theLib)
Deserialize object from bytesstatic void
deserializeObjectFromDBBytesAux(DataClayExecutionObject instance, DataClayObjectMetaData metadata, com.google.protobuf.ByteString data, DataServiceRuntime theLib)
Given metadata and data, deserialize into instance.static ObjectWithDataParamOrReturn
deserializeObjectFromDBBytesIntoObjectData(ObjectID objectID, byte[] objectBytes, DataClayRuntime theLib)
Deserialize object from bytes into ObjectWithDataParamOrReturnstatic void
deserializeObjectWithData(ObjectWithDataParamOrReturn paramOrRet, DataClayExecutionObject object, Map<MetaClassID,byte[]> ifaceBitMaps, DataClayRuntime theLib, SessionID ownerSessionID, boolean forceDeserialization)
Deserialize object into a memory instance.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.static Object[]
deserializeParamsOrReturn(SerializedParametersOrReturn serializedParamsOrReturn, Map<MetaClassID,byte[]> ifaceBitMaps, DataClayRuntime theLib)
Deserialize parameters of an executionstatic boolean
deserializeReturnFilterMethod(SerializedParametersOrReturn serializedObjs)
Special method for deserializing boolean return of a Filter method.static byte[]
extractReferenceCounting(byte[] objectBytes)
Extract bytes representing the reference counting without deserializing it.
-
-
-
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 arrayinstance
- instance Instance to deserializeifaceBitMaps
- Map of bitmaps representing the interfaces to usemetadata
- 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 objectobjectBytes
- Object bytestheLib
- 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 fillobjectBytes
- Object bytestheLib
- 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 deserializedmetadata
- Object metadatadata
- Object datatheLib
- 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 metadataobject
- Object in which to deserialize data.ifaceBitMaps
- Interface bitmapstheLib
- The client libownerSessionID
- 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 metadataobject
- Object in which to deserialize data.ifaceBitMaps
- Interface bitmapstheLib
- The client libownerSessionID
- 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 deserializeifaceBitMaps
- 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 deserializationdcBuffer
- Buffer from which to readifaceBitMaps
- Interface bitmapsmetadata
- DataClay object metadatacurDeserializedObjs
- Current deserialized objects- Returns:
- Deserialized java object
-
deserializeAssociation
public static DataClayObject deserializeAssociation(DataClayByteBuffer dcBuffer, Map<MetaClassID,byte[]> ifaceBitMaps, DataClayObjectMetaData metadata, Map<Integer,Object> curDeserializedObjs, DataClayRuntime theLib)
- Parameters:
dcBuffer
- Buffer from which to readifaceBitMaps
- Interface bitmapsmetadata
- DataClay object metadatacurDeserializedObjs
- Current deserialized objectstheLib
- Library to use- Returns:
- Deserialized association
-
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.
-
-