hu.mta.sztaki.lpds.cloud.simulator.io
Class Repository

java.lang.Object
  extended by hu.mta.sztaki.lpds.cloud.simulator.io.NetworkNode
      extended by hu.mta.sztaki.lpds.cloud.simulator.io.Repository

public class Repository
extends NetworkNode

This class represents the storage entities in the system. Data transfers could take place among these entities. Data is simulated to be stored in the repositories. To allow initial contents in a repository without delays, the class contains the registerObject function. For regular use during the simulation, please use its requestContentDelivery, and duplicateContent functions.

Author:
"Gabor Kecskemeti, Distributed and Parallel Systems Group, University of Innsbruck (c) 2013" "Gabor Kecskemeti, Laboratory of Parallel and Distributed Systems, MTA SZTAKI (c) 2012"

Nested Class Summary
private static interface Repository.MainStorageActivity
           
 
Nested classes/interfaces inherited from class hu.mta.sztaki.lpds.cloud.simulator.io.NetworkNode
NetworkNode.NetworkException, NetworkNode.SingleTransfer
 
Field Summary
(package private)  HashMap<String,StorageObject> contents
          Stuff that is already in the current repository
private  long currentStorageUse
          The current total size of the contents in the actual repository object
private  long maxStorageCapacity
          The total possible size of the contents in the current repository
private  long promisedStorage
          The amount of contents that are about to arrive.
(package private)  HashSet<String> underTransfer
          Contents that are under transfer, to ensure that we are not allowing the deletion of contents that are being transferred currently
 
Fields inherited from class hu.mta.sztaki.lpds.cloud.simulator.io.NetworkNode
diskinbws, diskoutbws, inbws, meminbws, memoutbws, outbws
 
Constructor Summary
Repository(long capacity, String id, long maxInBW, long maxOutBW, long diskBW, Map<String,Integer> latencyMap)
          Constructor for repository objects
 
Method Summary
 Collection<StorageObject> contents()
          Offers an unmodifiable list of contents.
 boolean deregisterObject(StorageObject so)
          This function is designed to simulate the erase function of the repository given that its user knows the StorageObject to be dropped.
 boolean deregisterObject(String soid)
          This function is designed to simulate the erase function of the repository given that its user knows the identifier of the content to be dropped.
 boolean duplicateContent(String id, String newId, ResourceConsumption.ConsumptionEvent ev)
          Initiates the duplication of some repository content
 boolean fetchObjectToMemory(StorageObject so, ResourceConsumption.ConsumptionEvent ev)
           
 long getFreeStorageCapacity()
           
 long getMaxStorageCapacity()
           
 StorageObject lookup(String soid)
          Searches and returns the storage object with a given identifier
private static boolean manageStoragePromise(long size, String id, Repository target, Repository.MainStorageActivity mainActivity)
           
 boolean registerObject(StorageObject so)
          This function is designed to initially set up the repository contents.
 boolean requestContentDelivery(String id, Repository target, ResourceConsumption.ConsumptionEvent ev)
          Initiates transfer from a remote location
 boolean requestContentDelivery(String id, String newId, Repository target, ResourceConsumption.ConsumptionEvent ev)
          This function registers a storage object for transfer.
 boolean storeInMemoryObject(StorageObject so, ResourceConsumption.ConsumptionEvent ev)
           
 String toString()
           
 
Methods inherited from class hu.mta.sztaki.lpds.cloud.simulator.io.NetworkNode
checkConnectivity, getDiskbw, getInputbw, getName, getOutputbw, initTransfer, pushFromMemory, readToMemory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

contents

final HashMap<String,StorageObject> contents
Stuff that is already in the current repository


underTransfer

final HashSet<String> underTransfer
Contents that are under transfer, to ensure that we are not allowing the deletion of contents that are being transferred currently


maxStorageCapacity

private final long maxStorageCapacity
The total possible size of the contents in the current repository


currentStorageUse

private long currentStorageUse
The current total size of the contents in the actual repository object


promisedStorage

private long promisedStorage
The amount of contents that are about to arrive.

Constructor Detail

Repository

public Repository(long capacity,
                  String id,
                  long maxInBW,
                  long maxOutBW,
                  long diskBW,
                  Map<String,Integer> latencyMap)
Constructor for repository objects

Parameters:
capacity - the storage capacity of the repository
maxInBW - the input network bandwidth of the repository
maxOutBW - the output network bandwidth of the repository
diskBW - the disk bandwidth of the repository
Method Detail

registerObject

public boolean registerObject(StorageObject so)
This function is designed to initially set up the repository contents. It does not simulate data movement, for data movement simulation please use the request content delivery function. The function also ensures that the given StorageObject is only stored once.

Parameters:
so - is the object to be stored
Returns:
true if the reuqested object was stored, false when there is not enough space to store the object

deregisterObject

public boolean deregisterObject(StorageObject so)
This function is designed to simulate the erase function of the repository given that its user knows the StorageObject to be dropped.

Parameters:
so - The storage object to be removed from the repository
Returns:
  • true, if the requested object was dropped from the repo,
  • false if there are ongoing transfers involving the object

deregisterObject

public boolean deregisterObject(String soid)
This function is designed to simulate the erase function of the repository given that its user knows the identifier of the content to be dropped.

Parameters:
soid - The storage object identifier
Returns:
  • true, if the requested object was dropped from the repo,
  • false if there are ongoing transfers involving the object

requestContentDelivery

public boolean requestContentDelivery(String id,
                                      Repository target,
                                      ResourceConsumption.ConsumptionEvent ev)
                               throws NetworkNode.NetworkException
Initiates transfer from a remote location

Parameters:
id - The storage object id that will be transferred
target - The target repository where the transferred data will reside
ev - the event to be fired if the transfer is completed
Returns:
true if the transfer was successfully initiated, false otherwise
Throws:
NetworkNode.NetworkException

duplicateContent

public boolean duplicateContent(String id,
                                String newId,
                                ResourceConsumption.ConsumptionEvent ev)
                         throws NetworkNode.NetworkException
Initiates the duplication of some repository content

Parameters:
id - The storage object id that will be duplicated
newId - The name of the copied storage object id if the target is the same repository where the request is made.
ev - the event to be fired if the transfer is completed
Returns:
true if the duplication request was successfully initiated, false otherwise
Throws:
NetworkNode.NetworkException

requestContentDelivery

public boolean requestContentDelivery(String id,
                                      String newId,
                                      Repository target,
                                      ResourceConsumption.ConsumptionEvent ev)
                               throws NetworkNode.NetworkException
This function registers a storage object for transfer. This object must be already stored in the requested repository. After the transfer is completed the function ensures that the target repository registers the transferred object.

Parameters:
id - The storage object id that will be transferred
newId - The name of the copied storage object id if it needs to be changed. If the target is the same repository this must be specified. If the caller needs the same storage id then null can be specified here.
target - The target repository where the transferred data will reside. If the target is the same repository please check the specific requirements for newId!
ev - the event to be fired if the transfer is completed
Returns:
true if the transfer was successfully initiated, false otherwise (the system will not fire a transfer event if false is returned!)
Throws:
NetworkNode.NetworkException

manageStoragePromise

private static boolean manageStoragePromise(long size,
                                            String id,
                                            Repository target,
                                            Repository.MainStorageActivity mainActivity)
                                     throws NetworkNode.NetworkException
Throws:
NetworkNode.NetworkException

storeInMemoryObject

public boolean storeInMemoryObject(StorageObject so,
                                   ResourceConsumption.ConsumptionEvent ev)
                            throws NetworkNode.NetworkException
Throws:
NetworkNode.NetworkException

fetchObjectToMemory

public boolean fetchObjectToMemory(StorageObject so,
                                   ResourceConsumption.ConsumptionEvent ev)

lookup

public StorageObject lookup(String soid)
Searches and returns the storage object with a given identifier

Parameters:
soid - the id of the storage object in question
Returns:
if found, the storage object, otherwise null

contents

public Collection<StorageObject> contents()
Offers an unmodifiable list of contents.

Returns:
the list of storage objects stored in this repository

toString

public String toString()
Overrides:
toString in class NetworkNode

getMaxStorageCapacity

public long getMaxStorageCapacity()

getFreeStorageCapacity

public long getFreeStorageCapacity()


Copyright © 2012–2015 University of Innsbruck & MTA SZTAKI. All rights reserved.