public interface StorageFile extends MemoryZone
Storage
.
All implementation classes should provide a constructor with one argument of long type that specifies the StorageFile's size.
Modifier and Type | Interface and Description |
---|---|
static class |
StorageFile.StorageFileShareMode |
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.
|
StorageFile |
clone()
Creates a clone of this entity and sets its parent to null.
|
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. |
Storage |
getParent()
Returns the parent of this entity, or null if no parent is set
|
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. |
User |
getUser()
Returns the
User that owns this StorageFile. |
void |
setPlacementPolicy(SfPlacementPolicy policy)
This method is called by
SfPlacementPolicy when placing this StorageFile on a storage. |
void |
setShareMode(StorageFile.StorageFileShareMode newShareMode)
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. |
getMemoryMap, getMetaData, getSize, isReplicaOf, modify, removeMemoryMap, setMetaData, setSize
addEntity, getConfig, getConfigRec, getEntities, getId, getLogger, getName, getProperties, getProperty, getProperty, hasParentRec, lockParent, lockParentRec, removeEntity, setConfig, setName, setParent, 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
StorageFile clone()
Entity
This is a deep clone method which also clones almost all children entities and sets their parents
to the newly created clone.
The only children which are not cloned are those implementing the UncloneableEntity
interface.
Implementations must ensure that the new clone will be independent from the current entity.
Storage getParent()
Entity
getParent
in interface Entity
getParent
in interface MemoryZone
StorageFile.StorageFileShareMode getShareMode()
StorageFile.StorageFileShareMode
of this file.StorageFile.StorageFileShareMode
of this filevoid setShareMode(StorageFile.StorageFileShareMode newShareMode)
StorageFile.StorageFileShareMode
of this file.boolean canAppend()
boolean canWrite()
boolean canRead()
void dealWithOperationActivation(StorageOperation operation)
StorageOperation
when it is started.operation
- void dealWithOperationDeactivation(StorageOperation operation, long oldCompletedLength)
StorageOperation
when it is stopped.operation
- 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
).SfPlacementPolicy getPlacementPolicy()
SfPlacementPolicy
that was used when placing this StorageFile in the current storage.
null is returned if this StorageFile has no defined SfPlacementPolicy
.SfPlacementPolicy
that was used when placing this StorageFile or nullvoid setPlacementPolicy(SfPlacementPolicy policy)
SfPlacementPolicy
when placing this StorageFile on a storage.
You should not need to call this method if you are not implementing a placement policy.
policy
- void unplace()
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.
User getUser()
User
that owns this StorageFile.User
that owns this StorageFile