@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) |
Iterable<Long> |
getChildIds(Long inodeId,
ReadOption option)
Returns an iterable for the ids of the children of the given directory.
|
Iterable<? 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.
|
void |
writeInode(MutableInode<?> inode)
Adds the given inode, or overwrites it if it already exists.
|
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, getMutable, remove, removeInodeAndParentEdge, supportsBatchWrite, writeNewInode
get, getChild, getChild, getChild, getChildId, getChildId, getChildId, getChildIds, getChildIds, getChildIds, getChildren, getChildren, getChildren, hasChildren
public void remove(Long inodeId)
InodeStore
remove
in interface InodeStore
inodeId
- an inode to removepublic 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 Iterable<Long> getChildIds(Long inodeId, ReadOption option)
ReadOnlyInodeStore
getChildIds
in interface ReadOnlyInodeStore
inodeId
- an inode id to list child ids foroption
- the optionspublic Iterable<? 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
Copyright © 2023. All Rights Reserved.