Class StorageLocationService


  • public final class StorageLocationService
    extends Object
    This class is responsible to manage data of the objects stored in the system.
    • Constructor Detail

      • StorageLocationService

        public StorageLocationService​(DBHandlerConf dbHandlerconf)
        Constructor
        Parameters:
        dbHandlerconf - Configuration for the db handler
    • Method Detail

      • initialize

        public void initialize​(DataServiceRuntime theruntime,
                               ExecutionEnvironmentID associatedEEID)
        Initialize
        Parameters:
        theruntime - Runtime to be used in Storage Location.
        associatedEEID - Associated EE ID.
      • store

        public void store​(ExecutionEnvironmentID eeID,
                          ObjectID objectID,
                          byte[] bytes)
        Store the object.
        Parameters:
        eeID - ID of the EE triggering the call
        objectID - ID of the object
        bytes - Bytes of the object
      • get

        public byte[] get​(ExecutionEnvironmentID eeID,
                          ObjectID objectID)
        Get from DB
        Parameters:
        eeID - ID of the EE triggering the call
        objectID - ID of the object
        Returns:
        Bytes of object
      • exists

        public boolean exists​(ExecutionEnvironmentID eeID,
                              ObjectID objectID)
        Check if object exists in DB
        Parameters:
        eeID - ID of the EE triggering the call
        objectID - ID of the object
        Returns:
        TRUE if object exists. FALSE otherwise.
      • update

        public 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 call
        objectID - ID of the object.
        newbytes - New byte values
        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

        public void delete​(ExecutionEnvironmentID eeID,
                           ObjectID objectID)
        Deletes and object from the database.
        Parameters:
        eeID - ID of the EE triggering the call
        objectID - ID of the object to delete
      • vacuum

        public void vacuum​(ExecutionEnvironmentID eeID)
        Vacuum database.
        Parameters:
        eeID - ID of the EE to vacuum
      • updateRefs

        public void updateRefs​(Map<ObjectID,​Integer> updateCounterRefs)
        Update counters of references.
        Parameters:
        updateCounterRefs - Update counter of references.
      • getDbHandler

        public DBHandler getDbHandler​(ExecutionEnvironmentID eeID)
        Get DbHandler. Used for testing purposes.
        Parameters:
        eeID - ID of EE
        Returns:
        DbHandler.
      • associateExecutionEnvironment

        public void associateExecutionEnvironment​(ExecutionEnvironmentID executionEnvironmentID)
        Associate execution environment id to this SL
        Parameters:
        executionEnvironmentID - ID to associate
      • getAssociateExecutionEnvironments

        public Set<ExecutionEnvironmentID> getAssociateExecutionEnvironments()
        Get associated execution environments id to this SL
        Returns:
        associated execution environments
      • shutDownGarbageCollector

        public void shutDownGarbageCollector()
        Shutdown storage location
      • getNumReferencesTo

        public int getNumReferencesTo​(ObjectID objectID)
        Return number of references pointing to object.
        Parameters:
        objectID - ID of object
        Returns:
        Number of references pointing to object
      • getNumObjects

        public int getNumObjects()
        Return number of objects in current SL and associated EEs
        Returns:
        Number of objects in current SL and associated EEs
      • exists

        public boolean exists​(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.