T
- the concrete subclass of this object@NotThreadSafe public abstract class MutableInode<T extends MutableInode> extends Object implements InodeView
MutableInode
is an abstract class, with information shared by all types of Inodes.Modifier and Type | Field and Description |
---|---|
protected AccessControlList |
mAcl |
protected long |
mCreationTimeMs |
protected boolean |
mDirectory |
protected long |
mId |
protected long |
mTtl |
protected TtlAction |
mTtlAction |
static com.google.common.collect.ImmutableSet<String> |
NO_MEDIUM |
Modifier | Constructor and Description |
---|---|
protected |
MutableInode(long id,
boolean isDirectory) |
Modifier and Type | Method and Description |
---|---|
MutableInodeDirectory |
asDirectory()
Casts the inode as an
InodeDirectory if it is one, otherwise throws an
exception. |
MutableInodeFile |
asFile() |
boolean |
checkPermission(String user,
List<String> groups,
AclAction action)
Checks whether the user or one of the groups has the permission to take the action.
|
boolean |
equals(Object o) |
static MutableInode<?> |
fromProto(InodeMeta.InodeOrBuilder inode) |
abstract FileInfo |
generateClientFileInfo(String path)
Generates a
FileInfo of the file or folder. |
AccessControlList |
getACL() |
long |
getCreationTimeMs() |
String |
getGroup() |
long |
getId() |
long |
getLastAccessTimeMs() |
long |
getLastModificationTimeMs() |
com.google.common.collect.ImmutableSet<String> |
getMediumTypes() |
short |
getMode() |
String |
getName() |
String |
getOwner() |
long |
getParentId() |
AclActions |
getPermission(String user,
List<String> groups)
Gets the permitted actions for a user.
|
PersistenceState |
getPersistenceState() |
protected abstract T |
getThis() |
long |
getTtl() |
TtlAction |
getTtlAction() |
String |
getUfsFingerprint() |
Map<String,byte[]> |
getXAttr() |
int |
hashCode() |
boolean |
isDeleted() |
boolean |
isDirectory() |
boolean |
isFile() |
boolean |
isPersisted() |
boolean |
isPinned() |
T |
removeAcl(List<AclEntry> entries)
Removes ACL entries.
|
T |
removeExtendedAcl()
Removes the extended ACL entries.
|
T |
replaceAcl(List<AclEntry> entries)
Replaces all existing ACL entries with a new list of entries.
|
T |
setAcl(List<AclEntry> entries)
Sets ACL entries into the internal ACL.
|
T |
setCreationTimeMs(long creationTimeMs) |
abstract T |
setDefaultACL(DefaultAccessControlList acl) |
T |
setDeleted(boolean deleted) |
T |
setGroup(String group) |
T |
setInternalAcl(AccessControlList acl)
Sets the internal ACL to a specified ACL.
|
T |
setLastAccessTimeMs(long lastAccessTimeMs) |
T |
setLastAccessTimeMs(long lastAccessTimeMs,
boolean override) |
T |
setLastModificationTimeMs(long lastModificationTimeMs)
Sets the last modification time of the inode to the new time if the new time is more recent.
|
T |
setLastModificationTimeMs(long lastModificationTimeMs,
boolean override) |
T |
setMediumTypes(com.google.common.collect.ImmutableSet<String> mediumTypes) |
T |
setMode(short mode) |
T |
setName(String name) |
T |
setOwner(String owner) |
T |
setParentId(long parentId) |
T |
setPersistenceState(PersistenceState persistenceState) |
T |
setPinned(boolean pinned) |
T |
setTtl(long ttl) |
T |
setTtlAction(TtlAction ttlAction) |
T |
setUfsFingerprint(String ufsFingerprint) |
T |
setXAttr(Map<String,byte[]> xAttr) |
T |
setXAttr(Map<String,byte[]> xAttr,
File.XAttrUpdateStrategy strategy) |
abstract Journal.JournalEntry |
toJournalEntry(String path) |
protected InodeMeta.Inode.Builder |
toProtoBuilder() |
protected com.google.common.base.MoreObjects.ToStringHelper |
toStringHelper() |
void |
updateFromEntry(File.UpdateInodeEntry entry)
Updates this inode's state from the given entry.
|
T |
updateMask(List<AclEntry> entries)
Update Mask for the Inode.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
compareTo, getDefaultACL, toProto
toJournalEntry
public static final com.google.common.collect.ImmutableSet<String> NO_MEDIUM
protected long mCreationTimeMs
protected final boolean mDirectory
protected final long mId
protected long mTtl
protected TtlAction mTtlAction
protected AccessControlList mAcl
public long getCreationTimeMs()
getCreationTimeMs
in interface InodeView
public String getGroup()
public long getTtl()
public TtlAction getTtlAction()
getTtlAction
in interface InodeView
TtlAction
public long getLastModificationTimeMs()
getLastModificationTimeMs
in interface InodeView
public long getLastAccessTimeMs()
getLastAccessTimeMs
in interface InodeView
public String getName()
public short getMode()
public PersistenceState getPersistenceState()
getPersistenceState
in interface InodeView
PersistenceState
of the inodepublic long getParentId()
getParentId
in interface InodeView
public String getOwner()
public boolean isDeleted()
public boolean isDirectory()
isDirectory
in interface InodeView
public boolean isFile()
public boolean isPinned()
public boolean isPersisted()
isPersisted
in interface InodeView
public String getUfsFingerprint()
getUfsFingerprint
in interface InodeView
public AccessControlList getACL()
public com.google.common.collect.ImmutableSet<String> getMediumTypes()
getMediumTypes
in interface InodeView
public T removeExtendedAcl()
public T removeAcl(List<AclEntry> entries)
entries
- the ACL entries to removepublic T replaceAcl(List<AclEntry> entries)
entries
- the new list of ACL entriespublic T updateMask(List<AclEntry> entries)
entries
- the list of ACL entriespublic T setCreationTimeMs(long creationTimeMs)
creationTimeMs
- the creation time to use (in milliseconds)public T setDeleted(boolean deleted)
deleted
- the deleted flag to usepublic T setGroup(String group)
group
- the group of the inodepublic T setLastModificationTimeMs(long lastModificationTimeMs)
lastModificationTimeMs
- the last modification time to usepublic T setLastModificationTimeMs(long lastModificationTimeMs, boolean override)
lastModificationTimeMs
- the last modification time to useoverride
- if true, sets the value regardless of the previous last modified time,
should be set to true for journal replaypublic T setLastAccessTimeMs(long lastAccessTimeMs)
lastAccessTimeMs
- the last access time to usepublic T setLastAccessTimeMs(long lastAccessTimeMs, boolean override)
lastAccessTimeMs
- the last access time to useoverride
- if true, sets the value regardless of the previous last access time,
should be set to true for journal replaypublic T setName(String name)
name
- the name to usepublic T setParentId(long parentId)
parentId
- the parent id to usepublic T setTtl(long ttl)
ttl
- the TTL to use, in millisecondspublic T setTtlAction(TtlAction ttlAction)
ttlAction
- the TtlAction
to usepublic T setPersistenceState(PersistenceState persistenceState)
persistenceState
- the PersistenceState
to usepublic T setPinned(boolean pinned)
pinned
- the pinned flag value to usepublic T setOwner(String owner)
owner
- the owner name of the inodepublic T setMode(short mode)
mode
- the mode of the inodepublic abstract T setDefaultACL(DefaultAccessControlList acl) throws UnsupportedOperationException
acl
- set the default ACL associated with this inodeUnsupportedOperationException
- if the inode is a filepublic T setAcl(List<AclEntry> entries)
entries
- the ACL entriespublic T setInternalAcl(AccessControlList acl)
acl
- the specified ACLpublic T setUfsFingerprint(String ufsFingerprint)
ufsFingerprint
- the ufs fingerprint to usepublic T setXAttr(Map<String,byte[]> xAttr)
xAttr
- The new set of extended attributespublic T setXAttr(Map<String,byte[]> xAttr, File.XAttrUpdateStrategy strategy) throws IllegalArgumentException
xAttr
- The new set of extended attributesstrategy
- The update strategy to useIllegalArgumentException
public T setMediumTypes(com.google.common.collect.ImmutableSet<String> mediumTypes)
mediumTypes
- the medium types to pin topublic abstract FileInfo generateClientFileInfo(String path)
InodeView
FileInfo
of the file or folder.generateClientFileInfo
in interface InodeView
path
- the path of the fileFileInfo
protected abstract T getThis()
this
so that the abstract class can use the fluent builder patternpublic boolean checkPermission(String user, List<String> groups, AclAction action)
InodeView
checkPermission
in interface InodeView
user
- the user checking permissiongroups
- the groups the user belongs toaction
- the action to takeAccessControlList.checkPermission(String, List, AclAction)
public AclActions getPermission(String user, List<String> groups)
InodeView
getPermission
in interface InodeView
user
- the usergroups
- the groups the user belongs toAccessControlList.getPermission(String, List)
public MutableInodeDirectory asDirectory()
InodeDirectory
if it is one, otherwise throws an
exception.
This gives convenience in method chaining, e.g.
inode.asDirectory().getChildren()
instead of
((MutableInodeDirectory) inode).getChildren()public MutableInodeFile asFile()
public void updateFromEntry(File.UpdateInodeEntry entry)
entry
- the entrypublic abstract Journal.JournalEntry toJournalEntry(String path)
path
- path of the inodeprotected com.google.common.base.MoreObjects.ToStringHelper toStringHelper()
protected InodeMeta.Inode.Builder toProtoBuilder()
public static MutableInode<?> fromProto(InodeMeta.InodeOrBuilder inode)
inode
- a protocol buffer inodeMutableInode
representation for the inodeCopyright © 2023. All Rights Reserved.