Commit Graph

1521 Commits

Author SHA1 Message Date
Wolfgang Bumiller 6486cb853f first api macro usage test/example
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-27 10:05:37 +01:00
Christian Ebner 951cf17ee3 catalog_shell: major refactoring of cli command definition and parsing
By changing the way shell commands are defined and parsed, this makes it more
straight forward to extend the current functionality.
The readline input is parsed based on the provided command definition and the
given parameters and options are passed to a command specific callback function.
In addition, the provided command definition including its description is used
to generate a help string to display.
The help command shows a list of all supported commands or the help string for
the provided command.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-11-26 13:01:00 +01:00
Christian Ebner 59bc6ad676 catalog_shell: check and return on empty list in order to avoid division by zero
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-11-26 12:55:33 +01:00
Christian Ebner 4e56b2f792 catalog_shell: do not restore full archive if no entries are selected for restore-selected
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-11-26 12:55:18 +01:00
Dietmar Maurer 12b4098660 src/cli/format.rs: move doc generation code into extra file 2019-11-26 12:12:53 +01:00
Dietmar Maurer 2f2b87e659 src/pxar/fuse.rs: add impl Context 2019-11-26 11:16:46 +01:00
Dietmar Maurer eedd1f95eb src/pxar/fuse.rs: move init and destroy into Session 2019-11-26 11:08:55 +01:00
Dietmar Maurer 970687c982 src/pxar/fuse.rs: cleanup - remove setup_session (moved into new) 2019-11-26 11:04:46 +01:00
Dietmar Maurer 2a11191072 src/pxar/fuse.rs: rename from_decoder into new, new into from_path 2019-11-26 10:56:41 +01:00
Dietmar Maurer 99b5b6cba9 src/pxar/decoder.rs: use trait object as reader
So that the Decoder is no longer genertic.
2019-11-26 10:45:11 +01:00
Dietmar Maurer f701d0335e src/pxar/sequential_decoder.rs: remove callback from new()
And use an extra functzion  set_callback() to configure that.

Also rewrite pxar/fuse.rs and implement a generic Session (will get
further cleanups with next patches).
2019-11-26 09:56:48 +01:00
Dietmar Maurer 49fddd985c src/cli/command.rs: use static array for arg_param 2019-11-25 11:16:41 +01:00
Dietmar Maurer 329d40b50b rename ApiHandler::Async into ApiHandler::AsyncHttp 2019-11-23 09:03:21 +01:00
Dietmar Maurer 70fbac84da src/server/rest.rs: simplify code 2019-11-22 18:44:14 +01:00
Dietmar Maurer 2bbd835b9b src/server/rest.rs: rename get_request_parameters_async to get_request_parameters 2019-11-22 17:24:16 +01:00
Dietmar Maurer 75a5a68944 src/server/rest.rs - only pass ObjectSchema to get_request_parameters_async() 2019-11-22 17:22:07 +01:00
Dietmar Maurer ad51d02aa9 src/server/rest.rs: cleanup async code 2019-11-22 13:02:05 +01:00
Wolfgang Bumiller be2bb37205 remove api_schema submodule
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-22 09:31:45 +01:00
Dietmar Maurer e57e1cd82d move src/api_schema/config.rs -> src/server/config.rs 2019-11-22 09:23:03 +01:00
Dietmar Maurer 8256b0e417 src/api_schema/registry.rs: remove dead code 2019-11-22 09:04:52 +01:00
Christian Ebner 3cf73c4e53 src/bin/proxmox-backup-client.rs: impl shell subcommand for client
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-11-22 08:22:50 +01:00
Christian Ebner f14c96ea38 src/backup/catalog_shell.rs: impl shell to inspect and restore a snapshot via the catalog
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-11-22 07:54:04 +01:00
Christian Ebner 38446a9551 src/backup/readline.rs: impl wrapper for GNU readline
In order to provide the context needed for tab completion via the readline
callback, the needed mut ref is passed via a thread local storage key.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-11-22 07:46:24 +01:00
Christian Ebner 6dba015043 src/backup/catalog.rs: derive Clone for DirEntry and DirEntryAttribute
This is needed in order to explicitly clone the values when needed in the
catalog shell implementation.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-11-22 07:15:39 +01:00
Christian Ebner c9f002213e src/backup/catalog.rs: impl DirEntry::is_directory()
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-11-22 07:14:00 +01:00
Christian Ebner d3bcc7f261 src/pxar/sequential_decoder.rs: create all directories in target path
Create the full target path and not fail if an intermediate directory does not
exist.
This is needed in order to restore multiple archives via the catalog, where the
target should further contain each archive name as subdir.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-11-22 07:11:49 +01:00
Christian Ebner b6ca690095 src/pxar/decoder.rs: return also payload size in lookup
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-11-22 07:05:14 +01:00
Dietmar Maurer 45cc157f7c docs: add backup reader protocol 2019-11-22 06:59:37 +01:00
Wolfgang Bumiller cad540e969 api/compat: remove remaining api_schema references
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-21 14:53:15 +01:00
Wolfgang Bumiller a2479cfa1a api/compat: drop more compat imports from api_schema.rs
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-21 14:36:28 +01:00
Wolfgang Bumiller cc4ecf80b0 api/compat: drop api_handler submodule
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-21 14:18:41 +01:00
Wolfgang Bumiller 4f1963d259 api/comapt: drop schema submodule
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-21 14:17:36 +01:00
Wolfgang Bumiller 2194824f77 api: BoxFut -> ApiFuture
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-21 14:16:37 +01:00
Wolfgang Bumiller 3d482025b3 move api schema into proxmox::api crate
And leave some compat imports in api_schema.rs to get it to
build with minimal changes.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-21 14:14:54 +01:00
Dietmar Maurer 552c225948 sort all property lookup tables
Required, because we use binary sreach to find items.
2019-11-21 13:32:09 +01:00
Dietmar Maurer 255f378a1b use const api definitions 2019-11-21 13:32:09 +01:00
Wolfgang Bumiller c5946faffd drop md5 crate dependency
we already depend on openssl which also provides md5

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-14 11:19:43 +01:00
Wolfgang Bumiller f569acc5e2 drop uuid crate dependency
proxmox::tools now has a Uuid module using the native
libuuid.

Adds build dependency: libuuid1 (which is a Pre-Depends of
util-linux, so always installed anyway).

Drops uuid + 16 more crate dependencies.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-14 10:22:29 +01:00
Christian Ebner b423958d8e catalog: fix issue with DirEntry start
start has to be the parent start - offset

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-11-12 17:18:13 +01:00
Dietmar Maurer 780dd2b0a1 src/backup/catalog.rs: add some docs 2019-11-12 13:23:40 +01:00
Dietmar Maurer 6aa906b547 src/backup/catalog.rs - CatalogReader: verify magic number 2019-11-12 12:54:06 +01:00
Dietmar Maurer 2ec208aef5 src/backup/catalog.rs - CatalogReader::dump(): use root() 2019-11-12 12:47:21 +01:00
Dietmar Maurer 8f24a9ea18 src/backup/catalog.rs - Direntry::parse: abort if callback return false 2019-11-12 11:41:44 +01:00
Dietmar Maurer 7d017123fd src/backup/catalog.rs: impl read_dir() and lookup(), refactor common code 2019-11-12 11:41:44 +01:00
Dietmar Maurer dc9596de45 src/backup/catalog.rs: move CatalogEntryType from src/pxar/catalog.rs 2019-11-12 11:41:44 +01:00
Dietmar Maurer 55c0b3cc7c src/backup/catalog.rs - DirEntry: factor out name attribute
And avoid allocations inside parse().
2019-11-12 11:41:44 +01:00
Christian Ebner 3f1c5b5e65 catalog: impl std::fmt::Display trait for CatalogEntryType
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-11-12 07:00:08 +01:00
Dietmar Maurer f89359c2f3 src/backup/catalog.rs: clenup - use single impl block 2019-11-10 11:38:31 +01:00
Dietmar Maurer e8d8fdc61d src/backup/catalog.rs: remove unused code 2019-11-10 11:37:06 +01:00
Dietmar Maurer c74c074bfd src/backup/catalog.rs: write MAGIC at start of file 2019-11-10 11:36:45 +01:00