public class InodeTreePersistentState extends Object implements Journaled
Constructor and Description |
---|
InodeTreePersistentState(InodeStore inodeStore,
InodeLockManager lockManager,
TtlBucketList ttlBucketList) |
Modifier and Type | Method and Description |
---|---|
void |
applyAndJournal(java.util.function.Supplier<JournalContext> context,
File.DeleteFileEntry entry)
Deletes an inode (may be either a file or directory).
|
long |
applyAndJournal(java.util.function.Supplier<JournalContext> context,
File.NewBlockEntry entry)
Allocates and returns the next block ID for the indicated inode.
|
void |
applyAndJournal(java.util.function.Supplier<JournalContext> context,
File.RenameEntry entry)
Renames an inode.
|
void |
applyAndJournal(java.util.function.Supplier<JournalContext> context,
File.SetAclEntry entry)
Sets an ACL for an inode.
|
void |
applyAndJournal(java.util.function.Supplier<JournalContext> context,
File.UpdateInodeDirectoryEntry entry)
Updates an inode directory's state.
|
void |
applyAndJournal(java.util.function.Supplier<JournalContext> context,
File.UpdateInodeEntry entry)
Updates an inode's state.
|
void |
applyAndJournal(java.util.function.Supplier<JournalContext> context,
File.UpdateInodeFileEntry entry)
Updates an inode file's state.
|
void |
applyAndJournal(java.util.function.Supplier<JournalContext> context,
MutableInode<?> inode,
String path)
Adds an inode to the inode tree.
|
File.UpdateInodeEntry |
applyInodeAccessTime(long inodeId,
long accessTime)
Updates last access time for Inode without journaling.
|
void |
cacheOperation(OperationId opId)
Used to mark an operation as complete in retry-cache.
|
CheckpointName |
getCheckpointName() |
Map<Long,Number> |
getFileSizeHistogram() |
long |
getInodeCount() |
CloseableIterator<Journal.JournalEntry> |
getJournalEntryIterator() |
Set<Long> |
getPinnedInodeFileIds() |
Set<Long> |
getReplicationLimitedFileIds() |
InodeDirectory |
getRoot() |
Set<Long> |
getToBePersistedIds() |
TtlBucketList |
getTtlBuckets() |
boolean |
isOperationComplete(OperationId opId)
Whether given operation is still cached in retry-cache.
|
boolean |
processJournalEntry(Journal.JournalEntry entry)
Attempts to apply a journal entry.
|
void |
resetState()
Resets the object's journaled state.
|
void |
restoreFromCheckpoint(CheckpointInputStream input)
Restores state from a checkpoint.
|
CompletableFuture<Void> |
restoreFromCheckpoint(File directory,
ExecutorService executorService)
Restores state from a checkpoint asynchronously.
|
CompletableFuture<Void> |
writeToCheckpoint(File directory,
ExecutorService executorService)
Writes a checkpoint to the specified directory asynchronously using the provided executor.
|
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
applyAndJournal
public InodeTreePersistentState(InodeStore inodeStore, InodeLockManager lockManager, TtlBucketList ttlBucketList)
inodeStore
- file store which holds inode metadatalockManager
- manager for inode locksttlBucketList
- reference to the ttl bucket list so that the list can be updated when the
inode tree is modifiedpublic boolean isOperationComplete(@Nullable OperationId opId)
opId
- the operation idtrue
if given op is marked completepublic void cacheOperation(@Nullable OperationId opId)
opId
- the operation idpublic Set<Long> getReplicationLimitedFileIds()
public InodeDirectory getRoot()
public long getInodeCount()
public Map<Long,Number> getFileSizeHistogram()
public Set<Long> getToBePersistedIds()
PersistenceState.TO_BE_PERSISTED
public TtlBucketList getTtlBuckets()
public void applyAndJournal(java.util.function.Supplier<JournalContext> context, File.DeleteFileEntry entry)
context
- journal context supplierentry
- delete file entrypublic long applyAndJournal(java.util.function.Supplier<JournalContext> context, File.NewBlockEntry entry)
context
- journal context supplierentry
- new block entrypublic void applyAndJournal(java.util.function.Supplier<JournalContext> context, File.RenameEntry entry)
context
- journal context supplierentry
- rename entrypublic void applyAndJournal(java.util.function.Supplier<JournalContext> context, File.SetAclEntry entry)
context
- journal context supplierentry
- set acl entrypublic void applyAndJournal(java.util.function.Supplier<JournalContext> context, File.UpdateInodeEntry entry)
context
- journal context supplierentry
- update inode entrypublic void applyAndJournal(java.util.function.Supplier<JournalContext> context, File.UpdateInodeDirectoryEntry entry)
context
- journal context supplierentry
- update inode directory entrypublic void applyAndJournal(java.util.function.Supplier<JournalContext> context, File.UpdateInodeFileEntry entry)
context
- journal context supplierentry
- update inode file entrypublic void applyAndJournal(java.util.function.Supplier<JournalContext> context, MutableInode<?> inode, String path)
context
- journal context supplierinode
- an inode to add and create a journal entry forpath
- path of the new inodepublic File.UpdateInodeEntry applyInodeAccessTime(long inodeId, long accessTime)
inodeId
- the id of the target inodeaccessTime
- the new value for last access timepublic boolean processJournalEntry(Journal.JournalEntry entry)
Journaled
processJournalEntry
in interface Journaled
entry
- the entry to applypublic void resetState()
Journaled
resetState
in interface Journaled
public CompletableFuture<Void> writeToCheckpoint(File directory, ExecutorService executorService)
Checkpointed
writeToCheckpoint
in interface Checkpointed
directory
- where the checkpoint will be writtenexecutorService
- to use when running tasks asynchronouslypublic void writeToCheckpoint(OutputStream output) throws IOException, InterruptedException
Checkpointed
InterruptedException
if they get
interrupted while running.writeToCheckpoint
in interface Checkpointed
writeToCheckpoint
in interface Journaled
output
- the output stream to write toIOException
InterruptedException
public CompletableFuture<Void> restoreFromCheckpoint(File directory, ExecutorService executorService)
Checkpointed
restoreFromCheckpoint
in interface Checkpointed
directory
- where the checkpoint will be locatedexecutorService
- to use when running asynchronous taskspublic void restoreFromCheckpoint(CheckpointInputStream input) throws IOException
Checkpointed
restoreFromCheckpoint
in interface Checkpointed
restoreFromCheckpoint
in interface Journaled
input
- an input stream with checkpoint dataIOException
public CloseableIterator<Journal.JournalEntry> getJournalEntryIterator()
getJournalEntryIterator
in interface JournalEntryIterable
CloseableIterator
that iterates all the journal entriespublic CheckpointName getCheckpointName()
getCheckpointName
in interface Checkpointed
Copyright © 2023. All Rights Reserved.