Package org.cloudbus.cloudsim.resources
Class SanStorage
java.lang.Object
org.cloudbus.cloudsim.resources.HarddriveStorage
org.cloudbus.cloudsim.resources.SanStorage
- All Implemented Interfaces:
FileStorage
,Resource
,ResourceCapacity
public class SanStorage extends HarddriveStorage
SanStorage represents a Storage Area Network (SAN) composed of a set of
hard disks connected in a LAN.
Capacity of individual disks are abstracted, thus only the overall capacity of the SAN is
considered.
WARNING: This class is not yet fully functional. Effects of network contention are not considered in the simulation. So, time for file transfer is underestimated in the presence of high network load.
- Since:
- CloudSim Toolkit 1.0
- Author:
- Rodrigo N. Calheiros, Manoel Campos da Silva Filho
- To do something:
- See the warning in class documentation.
-
Field Summary
Fields inherited from interface org.cloudbus.cloudsim.resources.FileStorage
FILE_NOT_FOUND
-
Constructor Summary
Constructors Constructor Description SanStorage(long capacity, double bandwidth, double networkLatency)
Creates a new SAN with a given capacity, latency, and bandwidth of the network connection.SanStorage(String name, long capacity, double bandwidth, double networkLatency)
Creates a new SAN with a given capacity, latency, and bandwidth of the network connection and with a specific name. -
Method Summary
Modifier and Type Method Description double
addFile(File file)
Adds a file to the storage.double
addReservedFile(File file)
Adds a file for which the space has already been reserved.double
deleteFile(File file)
Removes a file from the storage.double
getBandwidth()
Gets the bandwidth of the SAN network (in Megabits/s).double
getNetworkLatency()
Gets the SAN's network latency (in seconds).double
getTransferTime(int fileSize)
Gets the transfer time of a given file.void
setBandwidth(double bandwidth)
Sets the bandwidth of the SAN network (in Megabits/s).void
setNetworkLatency(double networkLatency)
Sets the latency of the SAN network (in seconds).String
toString()
Methods inherited from class org.cloudbus.cloudsim.resources.HarddriveStorage
addFile, contains, contains, deleteFile, getAllocatedResource, getAvailableResource, getAvgSeekTime, getCapacity, getFile, getFileList, getFileNameList, getLatency, getMaxTransferRate, getName, getNumStoredFile, getTransferTime, getTransferTime, getTransferTime, hasFile, hasPotentialAvailableSpace, isAmountAvailable, isAmountAvailable, isFull, renameFile, reserveSpace, setAvgSeekTime, setAvgSeekTime, setLatency, setMaxTransferRate
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.cloudbus.cloudsim.resources.Resource
getPercentUtilization, isAmountAvailable, isSubClassOf
-
Constructor Details
-
SanStorage
public SanStorage(long capacity, double bandwidth, double networkLatency) throws IllegalArgumentExceptionCreates a new SAN with a given capacity, latency, and bandwidth of the network connection.- Parameters:
capacity
- Total storage capacity of the SANbandwidth
- Network bandwidth (in Megabits/s)networkLatency
- Network latency (in seconds)- Throws:
IllegalArgumentException
- when the name and the capacity are not valid
-
SanStorage
Creates a new SAN with a given capacity, latency, and bandwidth of the network connection and with a specific name.- Parameters:
name
- the name of the new storage devicecapacity
- Storage device capacitybandwidth
- Network bandwidth (in Megabits/s)networkLatency
- Network latency (in seconds)- Throws:
IllegalArgumentException
- when the name and the capacity are not valid
-
-
Method Details
-
addReservedFile
Description copied from interface:FileStorage
Adds a file for which the space has already been reserved. The time taken (in seconds) for adding the specified file can also be found usingFile.getTransactionTime()
.- Specified by:
addReservedFile
in interfaceFileStorage
- Overrides:
addReservedFile
in classHarddriveStorage
- Parameters:
file
- the file to be added- Returns:
- the time (in seconds) required to add the file
-
addFile
Description copied from class:HarddriveStorage
Adds a file to the storage. The time taken (in seconds) for adding the specified file can also be found usingFile.getTransactionTime()
.First, the method checks if there is enough space on the storage, then it checks if the file with the same name is already taken to avoid duplicate filenames.
- Specified by:
addFile
in interfaceFileStorage
- Overrides:
addFile
in classHarddriveStorage
- Parameters:
file
- the file to be added- Returns:
- the time taken (in seconds) for adding the specified file or zero if there isn't available storage space.
-
getTransferTime
public double getTransferTime(int fileSize)Gets the transfer time of a given file. The network latency is added to the transfer time.- Specified by:
getTransferTime
in interfaceFileStorage
- Overrides:
getTransferTime
in classHarddriveStorage
- Parameters:
fileSize
- the size of the file to compute the transfer time (in MByte)- Returns:
- the transfer time in seconds
-
deleteFile
Description copied from interface:FileStorage
Removes a file from the storage. The time taken (in seconds) for deleting the specified file can also be found usingFile.getTransactionTime()
.- Specified by:
deleteFile
in interfaceFileStorage
- Overrides:
deleteFile
in classHarddriveStorage
- Parameters:
file
- the file to be removed- Returns:
- the time taken (in seconds) for deleting the specified file
-
getBandwidth
public double getBandwidth()Gets the bandwidth of the SAN network (in Megabits/s).- Returns:
- the bandwidth (in Megabits/s)
-
setBandwidth
public final void setBandwidth(double bandwidth)Sets the bandwidth of the SAN network (in Megabits/s).- Parameters:
bandwidth
- the bandwidth to set (in Megabits/s)- Throws:
IllegalArgumentException
- when the bandwidth is lower or equal to zero
-
getNetworkLatency
public double getNetworkLatency()Gets the SAN's network latency (in seconds).- Returns:
- the SAN's network latency (in seconds)
-
setNetworkLatency
public final void setNetworkLatency(double networkLatency)Sets the latency of the SAN network (in seconds).- Parameters:
networkLatency
- the latency to set (in seconds)- Throws:
IllegalArgumentException
- when the latency is lower or equal to zero
-
toString
-