Package es.bsc.dataclay.dataservice.api
Interface DataServiceAPI
-
- All Superinterfaces:
CommonManager
- All Known Implementing Classes:
DataService
,DataServiceGrpcClient
public interface DataServiceAPI extends CommonManager
This interface define the methods of the Data Service that can be executed remotely.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
activateTracing(int currentAvailableTaskID)
Activate tracing.void
associateExecutionEnvironment(ExecutionEnvironmentID executionEnvironmentID)
Associate execution environment to this DS.void
cleanExecutionClassDirectory()
Deletes all the classes in the execution class directoryvoid
closeDbHandler()
Close DBHandler.void
closeSessionInDS(SessionID sessionID)
Close session in DS.void
consolidateVersion(SessionID sessionID, ObjectID versionObjectID)
Consolidates object with ID providedvoid
deactivateTracing()
Deactivate Extrae tracingvoid
delete(ExecutionEnvironmentID eeID, ObjectID objectID)
Deletes and object from the database.void
deleteAlias(SessionID sessionID, ObjectID objectID)
Delete alias of object with ID providedvoid
deployClasses(String namespaceName, Map<Tuple<String,MetaClassID>,byte[]> classesToDeploy, Map<String,byte[]> classesAspects, Map<String,byte[]> stubYamls)
Deploys the given class in the path corresponding to the given namespace.void
deployMetaClasses(String namespaceName, Map<String,MetaClass> deploymentPack)
Deploys a series of MetaClass containers to a given namespace.void
detachObjectFromSession(ObjectID objectID, SessionID sessionID)
Detach object from session, i.e.void
disconnectFromOthers()
Disconnect server from others servers.void
enrichClass(String namespaceName, String className, byte[] classToDeploy, byte[] classAspects, byte[] stubYaml)
Enriches the given class in the path corresponding to the given namespace.SerializedParametersOrReturn
executeImplementation(ObjectID objectID, ImplementationID implID, SerializedParametersOrReturn params, SessionID sessionID)
This function executes a method.boolean
exists(ObjectID objectID)
Check if the object exists EE memoryboolean
existsInDB(ObjectID objectID)
Check if the object exists in SL or in any EE memory associated to current SLvoid
federate(SessionID sessionID, ObjectID objectID, ExecutionEnvironmentID externalExecutionEnvironmentID, boolean recursive)
Federate object with ID provided to external EE specifiedbyte[]
get(ExecutionEnvironmentID eeID, ObjectID objectID)
Get serialized object identified by ObjectIDMetaClassID
getClassIDFromObjectInMemory(ObjectID objectID)
Get ClassID from object in memory.SerializedParametersOrReturn
getCopyOfObject(SessionID sessionID, ObjectID objectID, boolean recursive)
Retrieves the given object and all subobjects as volatile new objects with new OIDsint
getNumObjects()
Get number of objects in SL and all its associated EEsint
getNumObjectsInEE()
Get number of alive objects in current EEList<ObjectWithDataParamOrReturn>
getObjects(SessionID sessionID, Set<ObjectID> objectIDs, Set<ObjectID> alreadyObtainedObjs, boolean recursive, ExecutionEnvironmentID replicaDestBackendID, int updateReplicaLocs)
Get the serialized objects with id providedSet<ObjectID>
getRetainedReferences()
Get IDs of references retained by EE.Map<String,byte[]>
getTraces()
Get Extrae traces (mpits and set files)void
initBackendID(StorageLocationID backendID)
Initializes the backend ID of this DataServicevoid
makePersistent(SessionID sessionID, List<ObjectWithDataParamOrReturn> objectsToPersist)
This function will deserialize make persistent "parameters" (i.e.Tuple<Map<StorageLocationID,Set<ObjectID>>,Set<ObjectID>>
migrateObjectsToBackends(Map<StorageLocationID,StorageLocation> backends)
Migrate every object of this backend to one of the backends specifiedSet<ObjectID>
moveObjects(SessionID sessionID, ObjectID objectID, ExecutionEnvironmentID destStLocation, boolean recursive)
Move object from this location to the one specifiedObjectID
newPersistentInstance(SessionID sessionID, MetaClassID classID, ImplementationID implementationID, Map<MetaClassID,byte[]> ifaceBitMaps, SerializedParametersOrReturn params)
Create an instance of the class with id provided using constructor with id and params specified and store it.Set<ObjectID>
newReplica(SessionID sessionID, ObjectID objectID, ExecutionEnvironmentID destBackendID, boolean recursive)
This operation creates a new replica of the object with ID provided in the backend specifiedObjectID
newVersion(SessionID sessionID, ObjectID objectID, ExecutionEnvironmentID destBackendID)
This operation creates a new version of the object with ID provided in the backend specifiedvoid
notifyFederation(SessionID sessionID, List<ObjectWithDataParamOrReturn> objectsToPersist)
New federated object arrives and must be stored in current backend.void
notifyUnfederation(SessionID sessionID, Set<ObjectID> objectIDs)
Unfederate objects with ID provided.void
registerPendingObjects()
Register all pending objectsMap<ObjectID,ExecutionEnvironmentID>
removeObjects(SessionID sessionID, Set<ObjectID> objectIDs, boolean recursive, boolean moving, ExecutionEnvironmentID newHint)
This operation removes the objects with IDs provided NOTE: This function is recursive, it is going to other DSs if needed.void
shutDown()
Shutdown server.void
store(ExecutionEnvironmentID eeID, ObjectID objectID, byte[] bytes)
Store the object.void
storeObjects(SessionID sessionID, List<ObjectWithDataParamOrReturn> objects, boolean moving, Set<ObjectID> idsWithAlias)
Store objects into Database.void
synchronize(SessionID sessionID, ObjectID objectID, ImplementationID implID, SerializedParametersOrReturn params, ExecutionEnvironmentID callingBackend)
This function synchronizes changes in object fieldvoid
unfederate(SessionID sessionID, ObjectID objectID, ExecutionEnvironmentID externalExecutionEnvironmentID, boolean recursive)
Unfederate object with ID provided to external EE specifiedvoid
update(ExecutionEnvironmentID eeID, ObjectID objectID, byte[] newbytes, boolean dirty)
Updates an object identified by the ID provided with the new values provided.void
updateObject(SessionID sessionID, ObjectID intoObjectID, SerializedParametersOrReturn fromObject)
Method that updates an object (into) with contents obtained from object (from)void
updateRefs(Map<ObjectID,Integer> updateCounterRefs)
Update counters of references.void
upsertObjects(SessionID sessionID, List<ObjectWithDataParamOrReturn> objectBytes)
Updates objects or insert if they do not exist with the values in objectBytes.-
Methods inherited from interface es.bsc.dataclay.util.CommonManager
cleanCaches
-
-
-
-
Method Detail
-
initBackendID
void initBackendID(StorageLocationID backendID)
Initializes the backend ID of this DataService- Parameters:
backendID
- ID of the backend
-
associateExecutionEnvironment
void associateExecutionEnvironment(ExecutionEnvironmentID executionEnvironmentID)
Associate execution environment to this DS.- Parameters:
executionEnvironmentID
- ID to associate
-
deployMetaClasses
void deployMetaClasses(String namespaceName, Map<String,MetaClass> deploymentPack)
Deploys a series of MetaClass containers to a given namespace.- Parameters:
namespaceName
- Name of the namespace classes belongs to.deploymentPack
- A map containing name of the class and the MetaClass container.
-
deployClasses
void deployClasses(String namespaceName, Map<Tuple<String,MetaClassID>,byte[]> classesToDeploy, Map<String,byte[]> classesAspects, Map<String,byte[]> stubYamls)
Deploys the given class in the path corresponding to the given namespace.- Parameters:
namespaceName
- Name of the namespace classes belongs to.classesToDeploy
- bytecode of the classes to be deployed.classesAspects
- bytes of the aspects of this classstubYamls
- Stub yamls.
-
enrichClass
void enrichClass(String namespaceName, String className, byte[] classToDeploy, byte[] classAspects, byte[] stubYaml)
Enriches the given class in the path corresponding to the given namespace.- Parameters:
namespaceName
- Name of the namespace which class belongs to.className
- Name of the class to deployclassToDeploy
- bytecode of the class to be deployed.classAspects
- bytes of the aspects of this classstubYaml
- Stub yaml
-
newPersistentInstance
ObjectID newPersistentInstance(SessionID sessionID, MetaClassID classID, ImplementationID implementationID, Map<MetaClassID,byte[]> ifaceBitMaps, SerializedParametersOrReturn params)
Create an instance of the class with id provided using constructor with id and params specified and store it.- Parameters:
sessionID
- Session ID to useclassID
- Id of the class to useimplementationID
- ID of the implementation of the constructorifaceBitMaps
- Interface bitmaps (for parameters)params
- Parameters- Returns:
- ObjectID of the persisted instance.
-
storeObjects
void storeObjects(SessionID sessionID, List<ObjectWithDataParamOrReturn> objects, boolean moving, Set<ObjectID> idsWithAlias)
Store objects into Database.- Parameters:
sessionID
- SessionID sessionIDobjects
- Serialized objects to store (still volatile parameters)moving
- If true, indicates that objects are being moved from another DS.idsWithAlias
- Objects with alias
-
getCopyOfObject
SerializedParametersOrReturn getCopyOfObject(SessionID sessionID, ObjectID objectID, boolean recursive)
Retrieves the given object and all subobjects as volatile new objects with new OIDs- Parameters:
sessionID
- ID of the current sessionobjectID
- ID of the object to retrieverecursive
- retrieve a copy of the whole object copying also its subobjects or only the main object- Returns:
- a copy of the object
-
updateObject
void updateObject(SessionID sessionID, ObjectID intoObjectID, SerializedParametersOrReturn fromObject)
Method that updates an object (into) with contents obtained from object (from)- Parameters:
sessionID
- id of the session requesting this methodintoObjectID
- id of the object to put contents intofromObject
- object to get contents from
-
getObjects
List<ObjectWithDataParamOrReturn> getObjects(SessionID sessionID, Set<ObjectID> objectIDs, Set<ObjectID> alreadyObtainedObjs, boolean recursive, ExecutionEnvironmentID replicaDestBackendID, int updateReplicaLocs)
Get the serialized objects with id provided- Parameters:
sessionID
- ID of sessionobjectIDs
- IDs of the objects to getalreadyObtainedObjs
- IDs of already obtained objectsrecursive
- Indicates if, per each object to get, also obtain its associated objects.replicaDestBackendID
- Destination backend of objects being obtained for replicaupdateReplicaLocs
- If 1, provided replica dest backend id must be added to replica locs of obtained objects If 2, provided replica dest backend id must be removed from replica locs If 0, replicaDestBackendID field is ignored- Returns:
- Map of serialized object where key is the objectID. Object is not serialized if flag getOnlyRefs=true
-
makePersistent
void makePersistent(SessionID sessionID, List<ObjectWithDataParamOrReturn> objectsToPersist)
This function will deserialize make persistent "parameters" (i.e. object to persist and subobjects if needed) into dataClay memory heap using the same design as for volatile parameters. Eventually, dataClay GC will collect them, and then they will be registered in LogicModule if needed (if objects were created with alias, they must have metadata already).- Parameters:
sessionID
- ID of session of make persistent callobjectsToPersist
- objects to store.
-
federate
void federate(SessionID sessionID, ObjectID objectID, ExecutionEnvironmentID externalExecutionEnvironmentID, boolean recursive)
Federate object with ID provided to external EE specified- Parameters:
sessionID
- ID of the session sending the objectobjectID
- ID of the object to federateexternalExecutionEnvironmentID
- ID of external execution environment to federaterecursive
- Indicates if all sub-objects must be replicated as well.
-
notifyFederation
void notifyFederation(SessionID sessionID, List<ObjectWithDataParamOrReturn> objectsToPersist)
New federated object arrives and must be stored in current backend.- Parameters:
sessionID
- ID of the session sending the objectobjectsToPersist
- Data of the object to persist
-
unfederate
void unfederate(SessionID sessionID, ObjectID objectID, ExecutionEnvironmentID externalExecutionEnvironmentID, boolean recursive)
Unfederate object with ID provided to external EE specified- Parameters:
sessionID
- ID of the sessionobjectID
- ID of the object to unfederateexternalExecutionEnvironmentID
- ID of external execution environment to unfederaterecursive
- Indicates if all sub-objects must be unfederated as well.
-
notifyUnfederation
void notifyUnfederation(SessionID sessionID, Set<ObjectID> objectIDs)
Unfederate objects with ID provided.- Parameters:
sessionID
- ID of the session.objectIDs
- ID of the objects to unfederate.
-
executeImplementation
SerializedParametersOrReturn executeImplementation(ObjectID objectID, ImplementationID implID, SerializedParametersOrReturn params, SessionID sessionID)
This function executes a method.- Parameters:
objectID
- ID of the object with the information to use by the implementationimplID
- Implementation ID of operation to executeparams
- Serialized parameter values used while invoking the operationsessionID
- ID of the session of the execution- Returns:
- Serialized operation result (all objects serialized, sepparately).
-
synchronize
void synchronize(SessionID sessionID, ObjectID objectID, ImplementationID implID, SerializedParametersOrReturn params, ExecutionEnvironmentID callingBackend)
This function synchronizes changes in object field- Parameters:
objectID
- ID of the object with the information to use by the implementationimplID
- Implementation ID of operation to executeparams
- Serialized parameter values used while invoking the operationsessionID
- ID of the session of the executioncallingBackend
- ID of calling backend or Null if called by client
-
newVersion
ObjectID newVersion(SessionID sessionID, ObjectID objectID, ExecutionEnvironmentID destBackendID)
This operation creates a new version of the object with ID provided in the backend specified- Parameters:
sessionID
- SessionobjectID
- ID of the objectdestBackendID
- ID of destination backend- Returns:
- ID of the version created
-
consolidateVersion
void consolidateVersion(SessionID sessionID, ObjectID versionObjectID)
Consolidates object with ID provided- Parameters:
sessionID
- ID of sessionversionObjectID
- ID of the object of the version
-
upsertObjects
void upsertObjects(SessionID sessionID, List<ObjectWithDataParamOrReturn> objectBytes)
Updates objects or insert if they do not exist with the values in objectBytes. NOTE: This function is recursive, it is going to other DSs if needed.- Parameters:
sessionID
- ID of session needed.objectBytes
- Map of objects to update.
-
newReplica
Set<ObjectID> newReplica(SessionID sessionID, ObjectID objectID, ExecutionEnvironmentID destBackendID, boolean recursive)
This operation creates a new replica of the object with ID provided in the backend specified- Parameters:
sessionID
- SessionobjectID
- ID of the objectdestBackendID
- ID of destination backendrecursive
- Indicates if all sub-objects must be replicated as well.- Returns:
- ids of replicated objects
-
moveObjects
Set<ObjectID> moveObjects(SessionID sessionID, ObjectID objectID, ExecutionEnvironmentID destStLocation, boolean recursive)
Move object from this location to the one specified- Parameters:
sessionID
- Session IDobjectID
- ID of the object to movedestStLocation
- Destination locationrecursive
- Indicates if all sub-objects (in this location or others) must be moved as well.- Returns:
- Set of moved objects
-
removeObjects
Map<ObjectID,ExecutionEnvironmentID> removeObjects(SessionID sessionID, Set<ObjectID> objectIDs, boolean recursive, boolean moving, ExecutionEnvironmentID newHint)
This operation removes the objects with IDs provided NOTE: This function is recursive, it is going to other DSs if needed.- Parameters:
sessionID
- Session IDobjectIDs
- ID of the objects to removerecursive
- Indicates if remove is recursive or not.moving
- Indicates remove is caused by a movement of an object.newHint
- New hint in case of move.- Returns:
- IDs of the objects removed and their backends.
-
getClassIDFromObjectInMemory
MetaClassID getClassIDFromObjectInMemory(ObjectID objectID)
Get ClassID from object in memory. Used in case the object is still pending to register and Hints point to this DS.- Parameters:
objectID
- ID of the object- Returns:
- Class ID of the object
-
migrateObjectsToBackends
Tuple<Map<StorageLocationID,Set<ObjectID>>,Set<ObjectID>> migrateObjectsToBackends(Map<StorageLocationID,StorageLocation> backends)
Migrate every object of this backend to one of the backends specified- Parameters:
backends
- Specifications of the backends- Returns:
- For each backend specified, the set of IDs of migrated objects (ands their new handler IDs) from this backend to it. Also return the objects that could not be migrated at all.
-
registerPendingObjects
void registerPendingObjects()
Register all pending objects
-
exists
boolean exists(ObjectID objectID)
Check if the object exists EE memory- Parameters:
objectID
- ID of the object to check- Returns:
- TRUE if the object exists in EE memory.
-
existsInDB
boolean existsInDB(ObjectID objectID)
Check if the object exists in SL or in any EE memory associated to current SL- Parameters:
objectID
- ID of the object to check- Returns:
- TRUE if the object either exists in SL disk or in EE memory.
-
store
void store(ExecutionEnvironmentID eeID, ObjectID objectID, byte[] bytes)
Store the object.- Parameters:
eeID
- ID of the EE triggering the callobjectID
- ID of the objectbytes
- Bytes of the object
-
get
byte[] get(ExecutionEnvironmentID eeID, ObjectID objectID)
Get serialized object identified by ObjectID- Parameters:
eeID
- ID of the EE triggering the callobjectID
- ID of the object- Returns:
- Bytes of the serialized object with ID provided.
-
update
void update(ExecutionEnvironmentID eeID, ObjectID objectID, byte[] newbytes, boolean dirty)
Updates an object identified by the ID provided with the new values provided.- Parameters:
eeID
- ID of the EE triggering the callobjectID
- ID of the object.newbytes
- New byte valuesdirty
- dirty Indicates object has been modified. If false, it means that bytes only contains reference counting information. DESIGN NOTE: in order to be able to find out which references where removed in complex objects (arrays, collections) GlobalGc decreases all pointed references in a Get procedure and increase them again (except removed ones) during update. While in EE, objects have memory references so they cannot be removed neither.
-
delete
void delete(ExecutionEnvironmentID eeID, ObjectID objectID)
Deletes and object from the database.- Parameters:
eeID
- ID of the EE triggering the callobjectID
- ID of the object to delete
-
closeSessionInDS
void closeSessionInDS(SessionID sessionID)
Close session in DS. Used to notify that some objects are not longer 'retained' by sessions.- Parameters:
sessionID
- ID of session.
-
updateRefs
void updateRefs(Map<ObjectID,Integer> updateCounterRefs)
Update counters of references.- Parameters:
updateCounterRefs
- Update counter of references.
-
detachObjectFromSession
void detachObjectFromSession(ObjectID objectID, SessionID sessionID)
Detach object from session, i.e. remove reference from session provided to object, "dear garbage-collector, the session is not using the object anymore"- Parameters:
objectID
- ID of the objectsessionID
- ID of the session not using the object anymore
-
deleteAlias
void deleteAlias(SessionID sessionID, ObjectID objectID)
Delete alias of object with ID provided- Parameters:
objectID
- ID of the object to delete the alias fromsessionID
- ID of the session deleting the alias
-
getRetainedReferences
Set<ObjectID> getRetainedReferences()
Get IDs of references retained by EE.- Returns:
- References retained by EE (sessions, alias...)
-
cleanExecutionClassDirectory
void cleanExecutionClassDirectory()
Deletes all the classes in the execution class directory
-
closeDbHandler
void closeDbHandler()
Close DBHandler.
-
shutDown
void shutDown()
Shutdown server. Called from Logic Module.
-
disconnectFromOthers
void disconnectFromOthers()
Disconnect server from others servers. Called from Logic Module.
-
activateTracing
void activateTracing(int currentAvailableTaskID)
Activate tracing.- Parameters:
currentAvailableTaskID
- Current starting task ID in Extrae
-
deactivateTracing
void deactivateTracing()
Deactivate Extrae tracing
-
getTraces
Map<String,byte[]> getTraces()
Get Extrae traces (mpits and set files)- Returns:
- Extrae traces (mpits and set files)
-
getNumObjectsInEE
int getNumObjectsInEE()
Get number of alive objects in current EE- Returns:
- number of alive objects in current EE
-
getNumObjects
int getNumObjects()
Get number of objects in SL and all its associated EEs- Returns:
- number of objects in SL and all its associated EEs
-
-