@ThreadSafe public class HeapInodeStore extends Object implements InodeStore
InodeStore.Factory, InodeStore.WriteBatch
Constructor and Description |
---|
HeapInodeStore()
Construct a heap inode store.
|
Modifier and Type | Method and Description |
---|---|
void |
addChild(long parentId,
String childName,
Long childId)
Makes an inode the child of the specified parent.
|
Set<EdgeEntry> |
allEdges() |
Set<MutableInode<?>> |
allInodes() |
void |
clear()
Removes all inodes and edges.
|
CheckpointName |
getCheckpointName() |
Optional<Inode> |
getChild(Long inodeId,
String child,
ReadOption option) |
Optional<Long> |
getChildId(Long inodeId,
String child,
ReadOption option) |
CloseableIterator<Long> |
getChildIds(Long inodeId,
ReadOption option)
Returns an iterable for the ids of the children of the given directory.
|
CloseableIterator<? extends Inode> |
getChildren(Long inodeId,
ReadOption option)
Returns an iterator over the children of the specified inode.
|
Optional<MutableInode<?>> |
getMutable(long id,
ReadOption option)
Gets a mutable representation of the specified inode.
|
boolean |
hasChildren(InodeDirectoryView dir,
ReadOption option) |
void |
remove(Long inodeId)
Removes an inode from the inode store.
|
void |
removeChild(long parentId,
String name)
Removes a child from a parent inode.
|
void |
restoreFromCheckpoint(CheckpointInputStream input)
Restores state from a checkpoint.
|
static Iterator<Long> |
sortedMapToIterator(SortedMap<String,Long> childrenMap,
ReadOption option)
Helper function that returns an iterator over the sorted map using the given
read options.
|
void |
writeInode(MutableInode<?> inode)
Adds the given inode, or overwrites it if it already exists.
|
void |
writeNewInode(MutableInode<?> inode)
Adds a new inode.
|
void |
writeToCheckpoint(OutputStream output)
Writes a checkpoint of all state to the given output stream.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addChild, close, createWriteBatch, get, getInodePathString, getMutable, remove, removeInodeAndParentEdge, supportsBatchWrite
get, getChild, getChild, getChild, getChildId, getChildId, getChildIds, getChildIds, getChildren, getChildren, getChildren, getChildrenFrom, getChildrenPrefix, getChildrenPrefixFrom, hasChildren
restoreFromCheckpoint, writeToCheckpoint
public void remove(Long inodeId)
InodeStore
remove
in interface InodeStore
inodeId
- an inode to removepublic void writeNewInode(MutableInode<?> inode)
InodeStore
InodeStore.writeInode(MutableInode)
, but with an added information that
the inode is new. This allows some inode stores to perform extra optimizations.
This method requires an inode lock manager read or write lock on the written inode.writeNewInode
in interface InodeStore
inode
- the inode to writepublic void writeInode(MutableInode<?> inode)
InodeStore
InodeStore.writeNewInode(MutableInode)
.
This method requires an inode lock manager read or write lock on the written inode.writeInode
in interface InodeStore
inode
- the inode to writepublic void addChild(long parentId, String childName, Long childId)
InodeStore
addChild
in interface InodeStore
parentId
- the parent idchildName
- the child namechildId
- the child inode idpublic void removeChild(long parentId, String name)
InodeStore
removeChild
in interface InodeStore
parentId
- the parent inode idname
- the child namepublic Optional<MutableInode<?>> getMutable(long id, ReadOption option)
InodeStore
getMutable
in interface InodeStore
id
- an inode idoption
- read optionspublic CloseableIterator<? extends Inode> getChildren(Long inodeId, ReadOption option)
ReadOnlyInodeStore
getChildren
in interface ReadOnlyInodeStore
inodeId
- an inode idoption
- the optionspublic Optional<Long> getChildId(Long inodeId, String child, ReadOption option)
getChildId
in interface ReadOnlyInodeStore
inodeId
- an inode idchild
- an inode nameoption
- the optionspublic Optional<Inode> getChild(Long inodeId, String child, ReadOption option)
getChild
in interface ReadOnlyInodeStore
inodeId
- an inode idchild
- an inode nameoption
- the optionspublic boolean hasChildren(InodeDirectoryView dir, ReadOption option)
hasChildren
in interface ReadOnlyInodeStore
dir
- an inode directoryoption
- the optionspublic Set<EdgeEntry> allEdges()
allEdges
in interface ReadOnlyInodeStore
public Set<MutableInode<?>> allInodes()
allInodes
in interface ReadOnlyInodeStore
public void clear()
InodeStore
clear
in interface InodeStore
public void writeToCheckpoint(OutputStream output) throws IOException, InterruptedException
Checkpointed
InterruptedException
if they get
interrupted while running.writeToCheckpoint
in interface Checkpointed
output
- the output stream to write toIOException
InterruptedException
public void restoreFromCheckpoint(CheckpointInputStream input) throws IOException
Checkpointed
restoreFromCheckpoint
in interface Checkpointed
input
- an input stream with checkpoint dataIOException
public CheckpointName getCheckpointName()
getCheckpointName
in interface Checkpointed
public CloseableIterator<Long> getChildIds(Long inodeId, ReadOption option)
ReadOnlyInodeStore
getChildIds
in interface ReadOnlyInodeStore
inodeId
- an inode id to list child ids foroption
- the optionspublic static Iterator<Long> sortedMapToIterator(SortedMap<String,Long> childrenMap, ReadOption option)
childrenMap
- the map to create the iterator fromoption
- the read options to useCopyright © 2023. All Rights Reserved.