public final class StorageImplUtils extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
static RaftStorageImpl |
initRaftStorage(String storageDirName,
RaftStorage.StartupOption option,
RaftProperties properties)
Choose a
RaftStorage for the given storage directory name from the given configuration properties
and then try to call RaftStorage.initialize(). |
static RaftStorageImpl |
newRaftStorage(File dir,
SizeInBytes freeSpaceMin,
RaftStorage.StartupOption option,
RaftServerConfigKeys.Log.CorruptionPolicy logCorruptionPolicy)
Create a
RaftStorageImpl. |
static SnapshotManager |
newSnapshotManager(RaftPeerId id,
Supplier<RaftStorageDirectory> dir,
StateMachineStorage smStorage) |
public static SnapshotManager newSnapshotManager(RaftPeerId id, Supplier<RaftStorageDirectory> dir, StateMachineStorage smStorage)
public static RaftStorageImpl newRaftStorage(File dir, SizeInBytes freeSpaceMin, RaftStorage.StartupOption option, RaftServerConfigKeys.Log.CorruptionPolicy logCorruptionPolicy)
RaftStorageImpl.public static RaftStorageImpl initRaftStorage(String storageDirName, RaftStorage.StartupOption option, RaftProperties properties) throws IOException
RaftStorage for the given storage directory name from the given configuration properties
and then try to call RaftStorage.initialize().
RaftStorage.StartupOption.FORMAT:
- When there are more than one existing directories, throw an exception.
- When there is an existing directory, throw an exception.
- When there is no existing directory, try to initialize a new directory from the list specified
in the configuration properties until a directory succeeded or all directories failed.
RaftStorage.StartupOption.RECOVER:
- When there are more than one existing directories, throw an exception.
- When there is an existing directory, if it fails to initialize, throw an exception but not try a new directory.
- When there is no existing directory, if only one directory is specified in the configuration, format it;
otherwise, there are >1 directories specified, throw an exception.storageDirName - the storage directory nameoption - the startup optionproperties - the configuration propertiesIOExceptionCopyright © 2017–2025 The Apache Software Foundation. All rights reserved.