public class HarddriveStorage extends java.lang.Object implements Storage
| Constructor and Description |
|---|
HarddriveStorage(double capacity)
Creates a new harddrive storage with a given capacity.
|
HarddriveStorage(java.lang.String name,
double capacity)
Creates a new harddrive storage with a given name and capacity.
|
| Modifier and Type | Method and Description |
|---|---|
double |
addFile(File file)
Adds a file to the storage.
|
double |
addFile(java.util.List<File> list)
Adds a set of files to the storage.
|
double |
addReservedFile(File file)
Adds a file for which the space has already been reserved.
|
boolean |
contains(File file)
Checks whether a certain file is on the storage or not.
|
boolean |
contains(java.lang.String fileName)
Checks whether a certain file is on the storage or not.
|
double |
deleteFile(File file)
Removes a file from the storage.
|
File |
deleteFile(java.lang.String fileName)
Removes a file from the storage.
|
double |
deleteFile(java.lang.String fileName,
File file)
Removes a file from the storage.
|
double |
getAvailableSpace()
Gets the available space on this storage in MB.
|
double |
getAvgSeekTime()
Gets the average seek time of the harddrive in seconds.
|
double |
getCapacity()
Gets the total capacity of the storage in MB.
|
double |
getCurrentSize()
Gets the current size of the stored files in MB.
|
File |
getFile(java.lang.String fileName)
Gets the file with the specified name.
|
java.util.List<java.lang.String> |
getFileNameList()
Gets the list of file names located on this storage.
|
double |
getLatency()
Gets the latency of this harddrive in seconds.
|
double |
getMaxTransferRate()
Gets the maximum transfer rate of the storage in MB/sec.
|
java.lang.String |
getName()
Gets the name of the storage.
|
int |
getNumStoredFile()
Gets the number of files stored on this storage.
|
boolean |
hasPotentialAvailableSpace(int fileSize)
Checks whether there is enough space on the storage for a certain file.
|
boolean |
isFull()
Checks if the storage is full or not.
|
boolean |
renameFile(File file,
java.lang.String newName)
Renames a file on the storage.
|
boolean |
reserveSpace(int fileSize)
Makes a reservation of the space on the storage to store a file.
|
boolean |
setAvgSeekTime(double seekTime)
Sets the average seek time of the storage in seconds.
|
boolean |
setAvgSeekTime(double seekTime,
ContinuousDistribution gen)
Sets the average seek time and a new generator of seek times in seconds.
|
boolean |
setLatency(double latency)
Sets the latency of this harddrive in seconds.
|
boolean |
setMaxTransferRate(int rate)
Sets the maximum transfer rate of this storage system in MB/sec.
|
public HarddriveStorage(java.lang.String name,
double capacity)
throws ParameterException
name - the name of the new harddrive storagecapacity - the capacity in MByteParameterException - when the name and the capacity are not validpublic HarddriveStorage(double capacity)
throws ParameterException
capacity - the capacity in MByteParameterException - when the capacity is not validpublic double getAvailableSpace()
getAvailableSpace in interface Storagepublic boolean isFull()
public int getNumStoredFile()
getNumStoredFile in interface Storagepublic boolean reserveSpace(int fileSize)
reserveSpace in interface StoragefileSize - the size to be reserved in MBpublic double addReservedFile(File file)
gridsim.datagrid.File#getTransactionTime().addReservedFile in interface Storagefile - the file to be addedpublic boolean hasPotentialAvailableSpace(int fileSize)
hasPotentialAvailableSpace in interface StoragefileSize - a FileAttribute object to compare topublic double getCapacity()
getCapacity in interface Storagepublic double getCurrentSize()
getCurrentSize in interface Storagepublic java.lang.String getName()
public boolean setLatency(double latency)
latency - the new latency in secondspublic double getLatency()
public boolean setMaxTransferRate(int rate)
setMaxTransferRate in interface Storagerate - the maximum transfer rate in MB/secpublic double getMaxTransferRate()
getMaxTransferRate in interface Storagepublic boolean setAvgSeekTime(double seekTime)
seekTime - the average seek time in secondspublic boolean setAvgSeekTime(double seekTime,
ContinuousDistribution gen)
seekTime - the average seek time in secondsgen - the ContinuousGenerator which generates seek timespublic double getAvgSeekTime()
public File getFile(java.lang.String fileName)
gridsim.datagrid.File#getTransactionTime().public java.util.List<java.lang.String> getFileNameList()
getFileNameList in interface Storagepublic double addFile(File file)
gridsim.datagrid.File#getTransactionTime().public double addFile(java.util.List<File> list)
gridsim.datagrid.File#getTransactionTime().public File deleteFile(java.lang.String fileName)
gridsim.datagrid.File#getTransactionTime().deleteFile in interface StoragefileName - the name of the file to be removedpublic double deleteFile(java.lang.String fileName,
File file)
gridsim.datagrid.File#getTransactionTime().deleteFile in interface StoragefileName - the name of the file to be removedfile - the file which is removed from the storage is returned through this parameterpublic double deleteFile(File file)
gridsim.datagrid.File#getTransactionTime().deleteFile in interface Storagefile - the file which is removed from the storage is returned through this parameterpublic boolean contains(java.lang.String fileName)
public boolean contains(File file)
public boolean renameFile(File file, java.lang.String newName)
gridsim.datagrid.File#getTransactionTime().renameFile in interface Storagefile - the file we would like to renamenewName - the new name of the file