public class VirtualStorageDynamic extends VirtualMemoryUnitDynamic<StorageFile,Storage> implements VirtualStorage
VirtualMemoryUnitDynamic
NotifierImpl.NotifyEvent
FailureProneEntity.FailureState
StorageFile.StorageFileShareMode
Constructor and Description |
---|
VirtualStorageDynamic()
Empty constructor that creates a storage with zero capacity.
|
VirtualStorageDynamic(long capacity) |
Modifier and Type | Method and Description |
---|---|
boolean |
canAppend()
Returns true if an append operation can run now on this file.
|
boolean |
canRead()
Returns true if a read operation can run now on this file.
|
boolean |
canWrite()
Returns true if a write operation can run now on this file.
|
VirtualStorageDynamic |
clone()
Creates a clone of this
Notifier . |
void |
dealWithOperationActivation(StorageOperation operation)
This method is called by a
StorageOperation when it is started. |
void |
dealWithOperationDeactivation(StorageOperation operation,
long oldCompletedLength)
This method is called by a
StorageOperation when it is stopped. |
SfPlacementPolicy |
getPlacementPolicy()
Returns the
SfPlacementPolicy that was used when placing this StorageFile in the current storage. |
StorageFile.StorageFileShareMode |
getShareMode()
Returns the
StorageFile.StorageFileShareMode of this file. |
List<StorageFile> |
getStorageFiles()
Alias for
MemoryUnit.getMemoryZones() . |
StorageProvisioner |
getStorageProvisioner()
Returns the
StorageProvisioner . |
User |
getUser()
Returns the
User that owns this StorageFile. |
void |
setParent(Entity parent)
Updates the parent of this entity.
This method makes sure that the old and the new parent keep their entities list updated, by automatically calling Entity.addEntity(Entity) and Entity.removeEntity(Entity) . |
void |
setPlacementPolicy(SfPlacementPolicy policy)
This method is called by
SfPlacementPolicy when placing this StorageFile on a storage. |
void |
setShareMode(StorageFile.StorageFileShareMode shareMode)
Updates the
StorageFile.StorageFileShareMode of this file. |
void |
setUser(User user)
Updates the
User that owns this StorageFile. |
void |
unplace()
Unplaces current StorageFile using current set
SfPlacementPolicy , or sets a null parent for current VM
if no SfPlacementPolicy was set.In both situations, this method guarantees that the current StorageFile's parent will be set to null. |
allocate, free, getSize
getMemoryMap, getMetaData, getParent, getParentHost, getRealFreeCapacity, isAllocated, isCapacityReserved, isReplicaOf, modify, removeMemoryMap, setAllocated, setCapacity, setIsCapacityReserved, setMetaData, setSize, supportsFailureStateUpdate
addEntity, findReplica, getCapacity, getEntities, getFreeCapacity, getMemoryZones, removeEntity
getFailureState, setFailureState
getConfig, getConfigRec, getId, getLogger, getName, getNextId, getProperties, getProperty, getProperty, hashCode, hasParentRec, lockParent, lockParentRec, setConfig, setName, setProperty, toString, unlockParent, unlockParentRec, unsetProperty
addProbe, getProbe, getProbe, getProbes, removeProbe, removeProbe
addGlobalListener, addListener, cancelNotifications, cleanupListeners, disableNotifications, enableNotifications, getGlobalListeners, getListeners, isNotificationsDisabled, notify, notifyNow, removeAllGlobalListeners, removeAllListeners, removeAllListeners, removeGlobalListener, removeListener
getParent
getRealFreeCapacity, isCapacityReserved, setIsCapacityReserved
isAllocated, setAllocated
allocate, findReplica, free, getCapacity, getFreeCapacity, getMemoryZones, getParentHost, setCapacity
getFailureState, setFailureState, supportsFailureStateUpdate
getMemoryMap, getMetaData, getSize, isReplicaOf, modify, removeMemoryMap, setMetaData, setSize
addEntity, getConfig, getConfigRec, getEntities, getId, getLogger, getName, getProperties, getProperty, getProperty, hasParentRec, lockParent, lockParentRec, removeEntity, setConfig, setName, setProperty, unlockParent, unlockParentRec, unsetProperty
addGlobalListener, addListener, cancelNotifications, cleanupListeners, disableNotifications, enableNotifications, getGlobalListeners, getListeners, isNotificationsDisabled, notify, notifyNow, removeAllGlobalListeners, removeAllListeners, removeAllListeners, removeGlobalListener, removeListener
addProbe, getProbe, getProbe, getProbes, removeProbe, removeProbe
public VirtualStorageDynamic()
This constructor is provided only to satisfy the Entity
contract.
You should use VirtualStorageDynamic(long)
though.
public VirtualStorageDynamic(long capacity)
public VirtualStorageDynamic clone()
Notifier
Notifier
.
The clone will contain a new empty listeners list and is independent from this object.
clone
in interface Entity
clone
in interface FailureProneEntity
clone
in interface Notifier
clone
in interface MemoryUnit<StorageFile>
clone
in interface MemoryZone
clone
in interface VirtualMemoryUnit<StorageFile,Storage>
clone
in interface Storage
clone
in interface StorageFile
clone
in interface VirtualStorage
clone
in class VirtualMemoryUnitDynamic<StorageFile,Storage>
public void setParent(Entity parent)
Entity
Entity.addEntity(Entity)
and Entity.removeEntity(Entity)
.
A CoreNotificationCodes.ENTITY_PARENT_CHANGED
notification is thrown.
Additionally, each descendant of this entity (ie: entities who have this entity as their direct or not direct parent) are
notified using CoreNotificationCodes.ENTITY_ANCESTOR_CHANGED
.
setParent
in interface Entity
setParent
in class EntityImpl
public final List<StorageFile> getStorageFiles()
Storage
MemoryUnit.getMemoryZones()
.getStorageFiles
in interface Storage
public StorageProvisioner getStorageProvisioner()
Storage
StorageProvisioner
.getStorageProvisioner
in interface Storage
StorageProvisioner
public StorageFile.StorageFileShareMode getShareMode()
StorageFile
StorageFile.StorageFileShareMode
of this file.getShareMode
in interface StorageFile
StorageFile.StorageFileShareMode
of this filepublic void setShareMode(StorageFile.StorageFileShareMode shareMode)
StorageFile
StorageFile.StorageFileShareMode
of this file.setShareMode
in interface StorageFile
public boolean canAppend()
StorageFile
canAppend
in interface StorageFile
public boolean canWrite()
StorageFile
canWrite
in interface StorageFile
public boolean canRead()
StorageFile
canRead
in interface StorageFile
public void dealWithOperationActivation(StorageOperation operation)
StorageFile
StorageOperation
when it is started.dealWithOperationActivation
in interface StorageFile
public void dealWithOperationDeactivation(StorageOperation operation, long oldCompletedLength)
StorageFile
StorageOperation
when it is stopped.dealWithOperationDeactivation
in interface StorageFile
oldCompletedLength
- the completed length before this operation is started. This can be used to
compute newly completed length during current run (using operation.getCompletedLength() - oldCompletedLength
).public SfPlacementPolicy getPlacementPolicy()
StorageFile
SfPlacementPolicy
that was used when placing this StorageFile in the current storage.
null is returned if this StorageFile has no defined SfPlacementPolicy
.getPlacementPolicy
in interface StorageFile
SfPlacementPolicy
that was used when placing this StorageFile or nullpublic void setPlacementPolicy(SfPlacementPolicy policy)
StorageFile
SfPlacementPolicy
when placing this StorageFile on a storage.
You should not need to call this method if you are not implementing a placement policy.
setPlacementPolicy
in interface StorageFile
public void unplace()
StorageFile
SfPlacementPolicy
, or sets a null parent for current VM
if no SfPlacementPolicy
was set.CoreNotificationCodes.ENTITY_PARENT_CHANGED
to know when
all actions have been taken.
If you only want to set a null parent for this StorageFile then use Entity.setParent(Entity)
.
Which will set the null parent immediately.
unplace
in interface StorageFile
public User getUser()
StorageFile
User
that owns this StorageFile.getUser
in interface StorageFile
User
that owns this StorageFilepublic void setUser(User user)
StorageFile
User
that owns this StorageFile.setUser
in interface StorageFile