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 void
execute(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.OptionParser
getParser()
protected void
printAdditionalHelp(Terminal terminal)
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 ifbatchMode
is falsestatic int
writeEmptyTranslog(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:
printAdditionalHelp
in classCommand
-
execute
protected void execute(Terminal terminal, joptsimple.OptionSet options, Environment env) throws java.lang.Exception
Description copied from class:EnvironmentAwareCommand
Execute the command with the initializedEnvironment
.- Specified by:
execute
in classEnvironmentAwareCommand
- Throws:
java.lang.Exception
-
writeEmptyTranslog
public static int writeEmptyTranslog(java.nio.file.Path filename, java.lang.String translogUUID) throws java.io.IOException
Write 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 ifbatchMode
is false
-
filesInDirectory
public static java.util.Set<java.nio.file.Path> filesInDirectory(java.nio.file.Path directory) throws java.io.IOException
Return a Set of all files in a given directory- Throws:
java.io.IOException
-
-