Skip to content

Commit

Permalink
server: Add skyd backup help menu and improve other help menus
Browse files Browse the repository at this point in the history
  • Loading branch information
ohsayan committed May 20, 2024
1 parent 315182b commit f4ab45f
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 2 deletions.
37 changes: 37 additions & 0 deletions server/help_text/backup
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
███████ ██  ██ ██  ██ ████████  █████  ██████  ██  ███████
██      ██  ██   ██  ██     ██    ██   ██ ██   ██ ██  ██
███████ █████    ████   ██  ███████ ██████  ██  █████
     ██ ██  ██   ██   ██  ██   ██ ██   ██ ██  ██
███████ ██  ██  ██  ██  ██  ██ ██████  ███████ ███████

Skytable {version} | https://github.com/skytable/skytable
Copyright (c) Sayan N. <ohsayan@outlook.com>

Skytable database server daemon (skyd): data backup utility

Details:
The `backup` subcommand is used to back up database data into a reliable format
for easily restoring database data without manual intervention.

Usage: skyd backup [FLAGS] [OPTIONS]

Options:
--path <path> (required) Path to the backup that is to be created

Flags:
--verify-integrity Must verify integrity before backing up
--unsafe-allow-dirty (unsafe) Copy files as-is, even if the database is running
and in a (potentially) dirty state

Examples:
skyd backup --verify-integrity --path /mnt/nfsbackups/mybackup-DDMMYYYY

Notes:
- The backup pointed to must be a manifest based backup. Otherwise it cannot be
restored using this tool and needs manual intervention
- If you use the `--unsafe-allow-other-host` flag you must guarantee that it is ok
to restore a backup from a potentially different node
- `--verify-integrity` is almost always unnecessary as on startup `skyd` will always
verify the integrity of the on-disk data.

{further_assistance}
5 changes: 5 additions & 0 deletions server/help_text/compact
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ Copyright (c) Sayan N. <ohsayan@outlook.com>

Skytable database server daemon (skyd): database file optimization utility

Details:
The `compact` subcommand optimizes the database files by removing any stale or deleted
data and/or applying other operations. This can help improve database performance,
efficiency and reduce disk usage.

Usage: skyd compact

Examples:
Expand Down
6 changes: 6 additions & 0 deletions server/help_text/help
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,18 @@ Copyright (c) Sayan N. <ohsayan@outlook.com>

Skytable database server daemon (skyd)

Details:
The Skytable database server daemon starts the database server and listens for database
requests at the given endpoints based on the provided configuration.

Usage: skyd [FLAGS] [OPTIONS]
skyd [FLAGS] [OPTIONS] [COMMAND] [OPTIONS]

Commands:
repair Check and repair any detected database storage errors
compact Force optimize all database files
backup Back up database data
restore Restore data from an existing backup

Flags:
-h, --help Display this help menu and exit.
Expand Down
4 changes: 4 additions & 0 deletions server/help_text/repair
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ Copyright (c) Sayan N. <ohsayan@outlook.com>

Skytable database server daemon (skyd): database repair utility

Details:
The `repair` subcommand checks the integrity of all database files and attempts to repair
any files that are found to have issues such as data corruption or inconsistencies.

Usage: skyd repair

Examples:
Expand Down
8 changes: 6 additions & 2 deletions server/help_text/restore
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@ Copyright (c) Sayan N. <ohsayan@outlook.com>

Skytable database server daemon (skyd): data restore utility

Details:
The `restore` subcommand is used to restore data from an existing manifest-based
backup located at the given path.

Usage: skyd restore [FLAGS] [OPTIONS]
skyd restore [FLAGS] [OPTIONS]

Required options:
Options:
--path <path> (required) Path to the backup that is to be restored

Flags:
--verify-integrity Must verify integrity before backing up
--verify-integrity Must verify integrity before restoring data
--unsafe-allow-other-host (unsafe) Enable restoring backup from a different host

Examples:
Expand Down
2 changes: 2 additions & 0 deletions server/src/engine/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,7 @@ fn arg_decode_rs_window<CS: ConfigurationSource>(
pub(super) const TXT_HELP: &str = include_str!(concat!(env!("OUT_DIR"), "/skyd-help"));
pub(super) const TXT_HELP_REPAIR: &str = include_str!(concat!(env!("OUT_DIR"), "/skyd-repair"));
pub(super) const TXT_HELP_COMPACT: &str = include_str!(concat!(env!("OUT_DIR"), "/skyd-compact"));
pub(super) const TXT_HELP_BACKUP: &str = include_str!(concat!(env!("OUT_DIR"), "/skyd-backup"));
pub(super) const TXT_HELP_RESTORE: &str = include_str!(concat!(env!("OUT_DIR"), "/skyd-restore"));

#[derive(Debug, PartialEq)]
Expand Down Expand Up @@ -704,6 +705,7 @@ pub fn parse_cli_args<'a, T: ArgItem>(
CliMultiCommand::SubcommandHelp(_, subcommand) => match subcommand.name() {
"repair" => CLIConfigParseReturn::Help(TXT_HELP_REPAIR.to_owned()),
"compact" => CLIConfigParseReturn::Help(TXT_HELP_COMPACT.to_owned()),
"backup" => CLIConfigParseReturn::Help(TXT_HELP_BACKUP.to_owned()),
"restore" => CLIConfigParseReturn::Help(TXT_HELP_RESTORE.to_owned()),
_ => {
return Err(ConfigError::with_src(
Expand Down

0 comments on commit f4ab45f

Please sign in to comment.