public class RaftJournalUtils extends Object
Modifier and Type | Method and Description |
---|---|
static <T> CompletableFuture<T> |
completeExceptionally(Exception e)
Creates a future that is completed exceptionally.
|
static File |
createTempSnapshotFile(org.apache.ratis.statemachine.impl.SimpleStateMachineStorage storage)
Creates a temporary snapshot file.
|
static org.apache.ratis.protocol.RaftPeerId |
getPeerId(InetSocketAddress address)
Gets the raft peer id.
|
static org.apache.ratis.protocol.RaftPeerId |
getPeerId(String host,
int port)
Gets the raft peer id.
|
static File |
getRaftJournalDir(File baseDir)
Gets the raft journal dir.
|
public static final String RAFT_DIR
public static org.apache.ratis.protocol.RaftPeerId getPeerId(InetSocketAddress address)
address
- the address of the serverpublic static org.apache.ratis.protocol.RaftPeerId getPeerId(String host, int port)
host
- the hostname of the serverport
- the port of the serverpublic static File getRaftJournalDir(File baseDir)
baseDir
- the journal base dirpublic static File createTempSnapshotFile(org.apache.ratis.statemachine.impl.SimpleStateMachineStorage storage) throws IOException
storage
- the snapshot storageIOException
- if error occurred while creating the snapshot filepublic static <T> CompletableFuture<T> completeExceptionally(Exception e)
T
- the type of the futuree
- the exception to be returned by the futureCopyright © 2023. All Rights Reserved.