T - the concrete subclass of this object@NotThreadSafe public abstract class MutableInode<T extends MutableInode> extends java.lang.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 |
| 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(java.lang.String user,
java.util.List<java.lang.String> groups,
AclAction action)
Checks whether the user or one of the groups has the permission to take the action.
|
boolean |
equals(java.lang.Object o) |
static MutableInode<?> |
fromProto(InodeMeta.InodeOrBuilder inode) |
abstract FileInfo |
generateClientFileInfo(java.lang.String path)
Generates a
FileInfo of the file or folder. |
AccessControlList |
getACL() |
long |
getCreationTimeMs() |
java.lang.String |
getGroup() |
long |
getId() |
long |
getLastAccessTimeMs() |
long |
getLastModificationTimeMs() |
java.util.Set<java.lang.String> |
getMediumTypes() |
short |
getMode() |
java.lang.String |
getName() |
java.lang.String |
getOwner() |
long |
getParentId() |
AclActions |
getPermission(java.lang.String user,
java.util.List<java.lang.String> groups)
Gets the permitted actions for a user.
|
PersistenceState |
getPersistenceState() |
protected abstract T |
getThis() |
long |
getTtl() |
TtlAction |
getTtlAction() |
java.lang.String |
getUfsFingerprint() |
java.util.Map<java.lang.String,byte[]> |
getXAttr() |
int |
hashCode() |
boolean |
isDeleted() |
boolean |
isDirectory() |
boolean |
isFile() |
boolean |
isPersisted() |
boolean |
isPinned() |
T |
removeAcl(java.util.List<AclEntry> entries)
Removes ACL entries.
|
T |
removeExtendedAcl()
Removes the extended ACL entries.
|
T |
replaceAcl(java.util.List<AclEntry> entries)
Replaces all existing ACL entries with a new list of entries.
|
T |
setAcl(java.util.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(java.lang.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(java.util.Set<java.lang.String> mediumTypes) |
T |
setMode(short mode) |
T |
setName(java.lang.String name) |
T |
setOwner(java.lang.String owner) |
T |
setParentId(long parentId) |
T |
setPersistenceState(PersistenceState persistenceState) |
T |
setPinned(boolean pinned) |
T |
setTtl(long ttl) |
T |
setTtlAction(TtlAction ttlAction) |
T |
setUfsFingerprint(java.lang.String ufsFingerprint) |
T |
setXAttr(java.util.Map<java.lang.String,byte[]> xAttr) |
abstract Journal.JournalEntry |
toJournalEntry(java.lang.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(java.util.List<AclEntry> entries)
Update Mask for the Inode.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitcompareTo, getDefaultACL, toPrototoJournalEntryprotected 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 InodeViewpublic java.lang.String getGroup()
public long getTtl()
public TtlAction getTtlAction()
getTtlAction in interface InodeViewTtlActionpublic long getLastModificationTimeMs()
getLastModificationTimeMs in interface InodeViewpublic long getLastAccessTimeMs()
getLastAccessTimeMs in interface InodeViewpublic java.lang.String getName()
public short getMode()
public PersistenceState getPersistenceState()
getPersistenceState in interface InodeViewPersistenceState of the inodepublic long getParentId()
getParentId in interface InodeViewpublic java.lang.String getOwner()
public boolean isDeleted()
public boolean isDirectory()
isDirectory in interface InodeViewpublic boolean isFile()
public boolean isPinned()
public boolean isPersisted()
isPersisted in interface InodeViewpublic java.lang.String getUfsFingerprint()
getUfsFingerprint in interface InodeViewpublic AccessControlList getACL()
@Nullable public java.util.Map<java.lang.String,byte[]> getXAttr()
public java.util.Set<java.lang.String> getMediumTypes()
getMediumTypes in interface InodeViewpublic T removeExtendedAcl()
public T removeAcl(java.util.List<AclEntry> entries)
entries - the ACL entries to removepublic T replaceAcl(java.util.List<AclEntry> entries)
entries - the new list of ACL entriespublic T updateMask(java.util.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(java.lang.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(java.lang.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(java.lang.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 java.lang.UnsupportedOperationException
acl - set the default ACL associated with this inodejava.lang.UnsupportedOperationException - if the inode is a filepublic T setAcl(java.util.List<AclEntry> entries)
entries - the ACL entriespublic T setInternalAcl(AccessControlList acl)
acl - the specified ACLpublic T setUfsFingerprint(java.lang.String ufsFingerprint)
ufsFingerprint - the ufs fingerprint to usepublic T setXAttr(java.util.Map<java.lang.String,byte[]> xAttr)
xAttr - The new set of extended attributespublic T setMediumTypes(java.util.Set<java.lang.String> mediumTypes)
mediumTypes - the medium types to pin topublic abstract FileInfo generateClientFileInfo(java.lang.String path)
InodeViewFileInfo of the file or folder.generateClientFileInfo in interface InodeViewpath - the path of the fileFileInfoprotected abstract T getThis()
this so that the abstract class can use the fluent builder patternpublic boolean checkPermission(java.lang.String user,
java.util.List<java.lang.String> groups,
AclAction action)
InodeViewcheckPermission in interface InodeViewuser - the user checking permissiongroups - the groups the user belongs toaction - the action to takeAccessControlList.checkPermission(String, List, AclAction)public AclActions getPermission(java.lang.String user, java.util.List<java.lang.String> groups)
InodeViewgetPermission in interface InodeViewuser - 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 int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic abstract Journal.JournalEntry toJournalEntry(java.lang.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 © 2019. All Rights Reserved.