@NotThreadSafe public final class InodeFile extends Inode<InodeFile>
Inode.lockRead()
or Inode.lockWrite()
) before methods are called.mCreationTimeMs, mDirectory, mId, mTtl, mTtlAction
Modifier and Type | Method and Description |
---|---|
void |
complete(long length)
Completes the file.
|
static InodeFile |
create(long blockContainerId,
long parentId,
String name,
long creationTimeMs,
CreateFileOptions options)
Creates an
InodeFile . |
static InodeFile |
fromJournalEntry(File.InodeFileEntry entry)
Converts the entry to an
InodeFile . |
FileInfo |
generateClientFileInfo(String path)
Generates a
FileInfo of the file or folder. |
long |
getBlockIdByIndex(int blockIndex)
Gets the block id for a given index.
|
List<Long> |
getBlockIds() |
long |
getBlockSizeBytes() |
long |
getLength() |
long |
getNewBlockId() |
protected InodeFile |
getThis() |
boolean |
isCacheable() |
boolean |
isCompleted() |
void |
reset()
Resets the file inode.
|
InodeFile |
setBlockIds(List<Long> blockIds) |
InodeFile |
setBlockSizeBytes(long blockSizeBytes) |
InodeFile |
setCacheable(boolean cacheable) |
InodeFile |
setCompleted(boolean completed) |
InodeFile |
setLength(long length) |
Journal.JournalEntry |
toJournalEntry() |
String |
toString() |
compareAndSwap, equals, getCreationTimeMs, getGroup, getId, getLastModificationTimeMs, getMode, getName, getOwner, getParentId, getPersistenceState, getTtl, getTtlAction, getUfsFingerprint, hashCode, isDeleted, isDirectory, isFile, isPersisted, isPinned, isReadLocked, isWriteLocked, lockRead, lockReadAndCheckNameAndParent, lockReadAndCheckParent, lockWrite, lockWriteAndCheckNameAndParent, lockWriteAndCheckParent, setCreationTimeMs, setDeleted, setGroup, setLastModificationTimeMs, setLastModificationTimeMs, setMode, setName, setOwner, setParentId, setPersistenceState, setPinned, setTtl, setTtlAction, setUfsFingerprint, toStringHelper, unlockRead, unlockWrite
protected InodeFile getThis()
public FileInfo generateClientFileInfo(String path)
Inode
FileInfo
of the file or folder.generateClientFileInfo
in class Inode<InodeFile>
path
- the path of the fileFileInfo
public void reset()
public long getBlockSizeBytes()
public long getLength()
public long getNewBlockId()
public long getBlockIdByIndex(int blockIndex) throws BlockInfoException
blockIndex
- the index to get the block id forBlockInfoException
- if the index of the block is out of rangepublic boolean isCacheable()
public boolean isCompleted()
public InodeFile setBlockSizeBytes(long blockSizeBytes)
blockSizeBytes
- the block size to usepublic InodeFile setBlockIds(List<Long> blockIds)
blockIds
- the id's of the blockpublic InodeFile setCacheable(boolean cacheable)
cacheable
- the cacheable flag value to usepublic InodeFile setCompleted(boolean completed)
completed
- the complete flag value to usepublic InodeFile setLength(long length)
length
- the length to usepublic void complete(long length) throws InvalidFileSizeException, FileAlreadyCompletedException
Constants.UNKNOWN_SIZE
, is valid. Cannot complete an already complete file,
unless the completed length was previously Constants.UNKNOWN_SIZE
.length
- The new length of the file, cannot be negative, but can be
Constants.UNKNOWN_SIZE
InvalidFileSizeException
- if invalid file size is encounteredFileAlreadyCompletedException
- if the file is already completedpublic static InodeFile fromJournalEntry(File.InodeFileEntry entry)
InodeFile
.entry
- the entry to convertInodeFile
representationpublic static InodeFile create(long blockContainerId, long parentId, String name, long creationTimeMs, CreateFileOptions options)
InodeFile
.blockContainerId
- block container id of this inodeparentId
- id of the parent of this inodename
- name of this inodecreationTimeMs
- the creation time for this inodeoptions
- options to create this fileInodeFile
representationpublic Journal.JournalEntry toJournalEntry()
Journal.JournalEntry
representing this objectCopyright © 2023. All Rights Reserved.