Package org.elasticsearch.index.translog
Class TruncateTranslogCommand
- java.lang.Object
-
- org.elasticsearch.cli.Command
-
- org.elasticsearch.cli.EnvironmentAwareCommand
-
- org.elasticsearch.index.translog.TruncateTranslogCommand
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class TruncateTranslogCommand extends EnvironmentAwareCommand
-
-
Field Summary
-
Fields inherited from class org.elasticsearch.cli.Command
description, parser
-
-
Constructor Summary
Constructors Constructor Description TruncateTranslogCommand()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidexecute(Terminal terminal, joptsimple.OptionSet options, Environment env)Execute the command with the initializedEnvironment.static java.util.Set<java.nio.file.Path>filesInDirectory(java.nio.file.Path directory)Return a Set of all files in a given directoryjoptsimple.OptionParsergetParser()protected voidprintAdditionalHelp(Terminal terminal)static voidwarnAboutDeletingFiles(Terminal terminal, java.util.Set<java.nio.file.Path> files, boolean batchMode)Show a warning about deleting files, asking for a confirmation ifbatchModeis falsestatic intwriteEmptyTranslog(java.nio.file.Path filename, java.lang.String translogUUID)Write a translog containing the given translog UUID to the given location.-
Methods inherited from class org.elasticsearch.cli.Command
addShutdownHook, close, exit, main
-
Methods inherited from class org.elasticsearch.cli.EnvironmentAwareCommand
createEnv, execute
-
-
-
-
Method Detail
-
getParser
public joptsimple.OptionParser getParser()
-
printAdditionalHelp
protected void printAdditionalHelp(Terminal terminal)
- Overrides:
printAdditionalHelpin classCommand
-
execute
protected void execute(Terminal terminal, joptsimple.OptionSet options, Environment env) throws java.lang.Exception
Description copied from class:EnvironmentAwareCommandExecute the command with the initializedEnvironment.- Specified by:
executein classEnvironmentAwareCommand- Throws:
java.lang.Exception
-
writeEmptyTranslog
public static int writeEmptyTranslog(java.nio.file.Path filename, java.lang.String translogUUID) throws java.io.IOExceptionWrite a translog containing the given translog UUID to the given location. Returns the number of bytes written.- Throws:
java.io.IOException
-
warnAboutDeletingFiles
public static void warnAboutDeletingFiles(Terminal terminal, java.util.Set<java.nio.file.Path> files, boolean batchMode)
Show a warning about deleting files, asking for a confirmation ifbatchModeis false
-
filesInDirectory
public static java.util.Set<java.nio.file.Path> filesInDirectory(java.nio.file.Path directory) throws java.io.IOExceptionReturn a Set of all files in a given directory- Throws:
java.io.IOException
-
-