@ThreadSafe public class RocksInodeStore extends Object implements InodeStore
InodeStore.Factory, InodeStore.WriteBatch
Constructor and Description |
---|
RocksInodeStore(String baseDir)
Creates and initializes a rocks block 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.
|
void |
close() |
InodeStore.WriteBatch |
createWriteBatch()
Creates a write batch.
|
CheckpointName |
getCheckpointName() |
Optional<Inode> |
getChild(Long inodeId,
String name,
ReadOption option) |
Optional<Long> |
getChildId(Long inodeId,
String name,
ReadOption option) |
CloseableIterator<Long> |
getChildIds(Long inodeId,
ReadOption option)
Returns an iterable for the ids of the children of the given directory.
|
CloseableIterator<InodeView> |
getCloseableIterator()
The name is intentional, in order to distinguish from the
Iterable interface. |
Pair<org.rocksdb.RocksDB,AtomicReference<org.rocksdb.ColumnFamilyHandle>> |
getDBInodeColumn()
A testing only method to access the internal objects.
|
Optional<MutableInode<?>> |
getMutable(long id,
ReadOption option)
Gets a mutable representation of the specified inode.
|
boolean |
hasChildren(InodeDirectoryView inode,
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.
|
boolean |
supportsBatchWrite() |
String |
toStringEntries() |
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, get, getInodePathString, getMutable, remove, removeInodeAndParentEdge, writeNewInode
get, getChild, getChild, getChild, getChildId, getChildId, getChildIds, getChildIds, getChildren, getChildren, getChildren, getChildren, getChildrenFrom, getChildrenPrefix, getChildrenPrefixFrom, hasChildren
public RocksInodeStore(String baseDir)
baseDir
- the base directory in which to store inode metadatapublic 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 InodeStore.WriteBatch createWriteBatch()
InodeStore
InodeStore.supportsBatchWrite()
.createWriteBatch
in interface InodeStore
InodeStore.WriteBatch
which can be used to perform a batched writepublic void clear()
InodeStore
clear
in interface InodeStore
public 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<Long> getChildIds(Long inodeId, ReadOption option)
ReadOnlyInodeStore
getChildIds
in interface ReadOnlyInodeStore
inodeId
- an inode id to list child ids foroption
- the optionspublic Optional<Long> getChildId(Long inodeId, String name, ReadOption option)
getChildId
in interface ReadOnlyInodeStore
inodeId
- an inode idname
- an inode nameoption
- the optionspublic Optional<Inode> getChild(Long inodeId, String name, ReadOption option)
getChild
in interface ReadOnlyInodeStore
inodeId
- an inode idname
- an inode nameoption
- the optionspublic boolean hasChildren(InodeDirectoryView inode, ReadOption option)
hasChildren
in interface ReadOnlyInodeStore
inode
- an inode directoryoption
- the optionspublic Set<EdgeEntry> allEdges()
allEdges
in interface ReadOnlyInodeStore
public Set<MutableInode<?>> allInodes()
allInodes
in interface ReadOnlyInodeStore
public CloseableIterator<InodeView> getCloseableIterator()
Iterable
interface.public boolean supportsBatchWrite()
supportsBatchWrite
in interface InodeStore
public CheckpointName getCheckpointName()
getCheckpointName
in interface Checkpointed
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 void close()
close
in interface InodeStore
close
in interface Closeable
close
in interface AutoCloseable
public String toStringEntries()
public Pair<org.rocksdb.RocksDB,AtomicReference<org.rocksdb.ColumnFamilyHandle>> getDBInodeColumn()
Copyright © 2023. All Rights Reserved.