btrbk: tidy table_formats

pull/409/head
Axel Burri 2021-04-16 21:09:47 +02:00
parent bd68b15ebc
commit f197a08650
1 changed files with 81 additions and 64 deletions

145
btrbk
View File

@ -189,80 +189,97 @@ my %config_options = (
my @config_target_types = qw(send-receive raw); my @config_target_types = qw(send-receive raw);
my %table_formats = ( my %table_formats = (
list_volume => { table => [ qw( -volume_host -volume_port volume_path ) ], list_volume => {
long => [ qw( volume_host -volume_port volume_path -volume_rsh ) ], table => [ qw( -volume_host -volume_port volume_path ) ],
raw => [ qw( volume_url volume_host volume_port volume_path volume_rsh ) ], long => [ qw( volume_host -volume_port volume_path -volume_rsh ) ],
}, raw => [ qw( volume_url volume_host volume_port volume_path volume_rsh ) ],
list_source => { table => [ qw( -source_host -source_port source_subvolume snapshot_path snapshot_name ) ], },
long => [ qw( source_host -source_port source_subvolume snapshot_path snapshot_name -source_rsh ) ],
raw => [ qw( source_url source_host source_port source_path snapshot_path snapshot_name source_rsh ) ],
},
list_target => { table => [ qw( -target_host -target_port target_path ) ],
long => [ qw( target_host -target_port target_path -target_rsh ) ],
raw => [ qw( target_url target_host target_port target_path target_rsh ) ],
},
list => { table => [ qw( -source_host -source_port source_subvolume snapshot_path snapshot_name -target_host -target_port target_path ) ],
long => [ qw( -source_host -source_port source_subvolume snapshot_path snapshot_name -target_host -target_port target_path target_type snapshot_preserve target_preserve ) ],
raw => [ qw( source_url source_host source_port source_subvolume snapshot_path snapshot_name target_url target_host target_port target_path target_type snapshot_preserve target_preserve source_rsh target_rsh ) ],
},
resolved => { table => [ qw( -source_host -source_port source_subvolume snapshot_subvolume status -target_host -target_port target_subvolume ) ], list_source => {
long => [ qw( -source_host -source_port source_subvolume snapshot_subvolume status -target_host -target_port target_subvolume target_type ) ], table => [ qw( -source_host -source_port source_subvolume snapshot_path snapshot_name ) ],
raw => [ qw( type source_url source_host source_port source_path snapshot_path snapshot_name status target_url target_host target_port target_path target_type source_rsh target_rsh ) ], long => [ qw( source_host -source_port source_subvolume snapshot_path snapshot_name -source_rsh ) ],
# NOTE: snapshot_path is ambigous and does NOT print SUBVOL_PATH here (should be snapshot_subvolume, left as-is for compatibility) raw => [ qw( source_url source_host source_port source_path snapshot_path snapshot_name source_rsh ) ],
}, },
snapshots => { table => [ qw( -source_host -source_port source_subvolume snapshot_subvolume status ) ], list_target => {
long => [ qw( -source_host -source_port source_subvolume snapshot_subvolume status ) ], table => [ qw( -target_host -target_port target_path ) ],
raw => [ qw( source_url source_host source_port source_path snapshot_subvolume snapshot_name status source_rsh ) ], long => [ qw( target_host -target_port target_path -target_rsh ) ],
}, raw => [ qw( target_url target_host target_port target_path target_rsh ) ],
},
stats => { table => [ qw( -source_host -source_port source_subvolume snapshot_subvolume -target_host -target_port -target_subvolume snapshots -backups ) ], list => {
long => [ qw( -source_host -source_port source_subvolume snapshot_subvolume -target_host -target_port -target_subvolume snapshot_status backup_status snapshots -backups -correlated -orphaned -incomplete ) ], table => [ qw( -source_host -source_port source_subvolume snapshot_path snapshot_name -target_host -target_port target_path ) ],
raw => [ qw( source_url source_host source_port source_subvolume snapshot_subvolume snapshot_name target_url target_host target_port target_subvolume snapshot_status backup_status snapshots backups correlated orphaned incomplete ) ], long => [ qw( -source_host -source_port source_subvolume snapshot_path snapshot_name -target_host -target_port target_path target_type snapshot_preserve target_preserve ) ],
RALIGN => { snapshots=>1, backups=>1, correlated=>1, orphaned=>1, incomplete=>1 }, raw => [ qw( source_url source_host source_port source_subvolume snapshot_path snapshot_name target_url target_host target_port target_path target_type snapshot_preserve target_preserve source_rsh target_rsh ) ],
}, },
schedule => { table => [ qw( action -host -port subvolume scheme reason ) ], resolved => {
long => [ qw( action -host -port root_path subvolume_path scheme reason ) ], # NOTE: snapshot_path is ambigous and does NOT print SUBVOL_PATH here (should be snapshot_subvolume, left as-is for compatibility)
raw => [ qw( topic action url host port path hod dow min h d w m y) ], table => [ qw( -source_host -source_port source_subvolume snapshot_subvolume status -target_host -target_port target_subvolume ) ],
}, long => [ qw( -source_host -source_port source_subvolume snapshot_subvolume status -target_host -target_port target_subvolume target_type ) ],
raw => [ qw( type source_url source_host source_port source_path snapshot_path snapshot_name status target_url target_host target_port target_path target_type source_rsh target_rsh ) ],
},
usage => { table => [ qw( -host -port path size used free ) ], snapshots => {
long => [ qw( type -host -port path size used device_size device_allocated device_unallocated device_missing device_used free free_min data_ratio metadata_ratio global_reserve global_reserve_used ) ], table => [ qw( -source_host -source_port source_subvolume snapshot_subvolume status ) ],
raw => [ qw( type host port path size used device_size device_allocated device_unallocated device_missing device_used free free_min data_ratio metadata_ratio global_reserve global_reserve_used ) ], long => [ qw( -source_host -source_port source_subvolume snapshot_subvolume status ) ],
RALIGN => { size=>1, used=>1, device_size=>1, device_allocated=>1, device_unallocated=>1, device_missing=>1, device_used=>1, free=>1, free_min=>1, data_ratio=>1, metadata_ratio=>1, global_reserve=>1, global_reserve_used=>1 }, raw => [ qw( source_url source_host source_port source_path snapshot_subvolume snapshot_name status source_rsh ) ],
}, },
transaction => { table => [ qw( type status -target_host -target_port target_subvolume -source_host -source_port source_subvolume parent_subvolume ) ], stats => {
long => [ qw( localtime type status duration target_host -target_port target_subvolume source_host -source_port source_subvolume parent_subvolume message ) ], table => [ qw( -source_host -source_port source_subvolume snapshot_subvolume -target_host -target_port -target_subvolume snapshots -backups ) ],
tlog => [ qw( localtime type status target_url source_url parent_url message ) ], long => [ qw( -source_host -source_port source_subvolume snapshot_subvolume -target_host -target_port -target_subvolume snapshot_status backup_status snapshots -backups -correlated -orphaned -incomplete ) ],
syslog => [ qw( type status target_url source_url parent_url message ) ], raw => [ qw( source_url source_host source_port source_subvolume snapshot_subvolume snapshot_name target_url target_host target_port target_subvolume snapshot_status backup_status snapshots backups correlated orphaned incomplete ) ],
raw => [ qw( time localtime type status duration target_url source_url parent_url message ) ], RALIGN => { snapshots=>1, backups=>1, correlated=>1, orphaned=>1, incomplete=>1 },
}, },
origin_tree => { table => [ qw( tree uuid parent_uuid received_uuid ) ], schedule => {
long => [ qw( tree uuid parent_uuid received_uuid recursion ) ], table => [ qw( action -host -port subvolume scheme reason ) ],
raw => [ qw( tree uuid parent_uuid received_uuid recursion ) ], long => [ qw( action -host -port root_path subvolume_path scheme reason ) ],
}, raw => [ qw( topic action url host port path hod dow min h d w m y) ],
},
diff => { table => [ qw( flags count size file ) ], usage => {
long => [ qw( flags count size file ) ], table => [ qw( -host -port path size used free ) ],
raw => [ qw( flags count size file ) ], long => [ qw( type -host -port path size used device_size device_allocated device_unallocated device_missing device_used free free_min data_ratio metadata_ratio global_reserve global_reserve_used ) ],
RALIGN => { count=>1, size=>1 }, raw => [ qw( type host port path size used device_size device_allocated device_unallocated device_missing device_used free free_min data_ratio metadata_ratio global_reserve global_reserve_used ) ],
}, RALIGN => { size=>1, used=>1, device_size=>1, device_allocated=>1, device_unallocated=>1, device_missing=>1, device_used=>1, free=>1, free_min=>1, data_ratio=>1, metadata_ratio=>1, global_reserve=>1, global_reserve_used=>1 },
},
fs_list => { table => [ qw( -host mount_source mount_subvol mount_point id flags subvolume_path path ) ], transaction => {
short => [ qw( -host mount_source id flags path ) ], table => [ qw( type status -target_host -target_port target_subvolume -source_host -source_port source_subvolume parent_subvolume ) ],
long => [ qw( -host mount_source id top cgen gen uuid parent_uuid received_uuid flags path ) ], long => [ qw( localtime type status duration target_host -target_port target_subvolume source_host -source_port source_subvolume parent_subvolume message ) ],
raw => [ qw( host mount_source mount_subvol mount_point mount_subvolid id top_level cgen gen uuid parent_uuid received_uuid readonly path subvolume_path subvolume_rel_path url ) ], tlog => [ qw( localtime type status target_url source_url parent_url message ) ],
}, syslog => [ qw( type status target_url source_url parent_url message ) ],
raw => [ qw( time localtime type status duration target_url source_url parent_url message ) ],
},
extent_diff => { table => [ qw( total exclusive -diff -set subvol ) ], origin_tree => {
long => [ qw( id cgen gen total exclusive -diff -set subvol ) ], table => [ qw( tree uuid parent_uuid received_uuid ) ],
raw => [ qw( id cgen gen total exclusive -diff -set subvol ) ], long => [ qw( tree uuid parent_uuid received_uuid recursion ) ],
RALIGN => { total=>1, exclusive=>1, diff=>1, set=>1, cgen=>1, gen=>1 }, raw => [ qw( tree uuid parent_uuid received_uuid recursion ) ],
}, },
diff => {
table => [ qw( flags count size file ) ],
long => [ qw( flags count size file ) ],
raw => [ qw( flags count size file ) ],
RALIGN => { count=>1, size=>1 },
},
fs_list => {
table => [ qw( -host mount_source mount_subvol mount_point id flags subvolume_path path ) ],
short => [ qw( -host mount_source id flags path ) ],
long => [ qw( -host mount_source id top cgen gen uuid parent_uuid received_uuid flags path ) ],
raw => [ qw( host mount_source mount_subvol mount_point mount_subvolid id top_level cgen gen uuid parent_uuid received_uuid readonly path subvolume_path subvolume_rel_path url ) ],
},
extent_diff => {
table => [ qw( total exclusive -diff -set subvol ) ],
long => [ qw( id cgen gen total exclusive -diff -set subvol ) ],
raw => [ qw( id cgen gen total exclusive -diff -set subvol ) ],
RALIGN => { total=>1, exclusive=>1, diff=>1, set=>1, cgen=>1, gen=>1 },
},
); );
my %backend_cmd_map = ( my %backend_cmd_map = (