Package org.basex.core.cmd
Class OptimizeAll
java.lang.Object
org.basex.core.jobs.Job
org.basex.core.Command
org.basex.core.cmd.ACreate
org.basex.core.cmd.OptimizeAll
Evaluates the 'optimize all' command and rebuilds all data structures of
the currently opened database. This effectively eliminates all fragmentation
and can lead to significant space savings after updates.
- Author:
- BaseX Team 2005-21, BSD License, Leo Woerteler
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbuild(CmdBuilder cb) Builds a string representation from the command.booleanCloses an open data reference and returnstrueif this command will change theContext.data()reference.static voidoptimizeAll(Data data, Context context, MainOptions options, OptimizeAll cmd) Optimizes all data structures and closes the database.protected booleanrun()Executes the command and serializes the result (internal call).booleanReturns true if this command can be stopped.Methods inherited from class org.basex.core.cmd.ACreate
addLocks, supportsProgMethods inherited from class org.basex.core.Command
addLocks, baseURI, baseURI, close, error, exception, execute, execute, getOption, getOption, info, info, init, maxResults, result, run, run, setInput, setInput, toString, toString, updated, updating
-
Constructor Details
-
OptimizeAll
public OptimizeAll()Default constructor.
-
-
Method Details
-
run
protected boolean run()Description copied from class:CommandExecutes the command and serializes the result (internal call). -
newData
Description copied from class:CommandCloses an open data reference and returnstrueif this command will change theContext.data()reference. This method is only required by the GUI. -
stoppable
public boolean stoppable()Description copied from class:CommandReturns true if this command can be stopped. This method is only required by the GUI. -
build
Description copied from class:CommandBuilds a string representation from the command. This string must be correctly built, as commands are sent to the server as strings. -
optimizeAll
public static void optimizeAll(Data data, Context context, MainOptions options, OptimizeAll cmd) throws IOException Optimizes all data structures and closes the database. Recreates the database, drops the old instance and renames the recreated instance.- Parameters:
data- disk datacontext- database contextoptions- main optionscmd- command reference ornull- Throws:
IOException- I/O Exception during index rebuildBaseXException- database exception
-