Backup service supports conditional filtering of key data
Discussed in https://github.com/buckyos/CYFS/discussions/263
Originally posted by wugren May 12, 2023 Sometimes, some configuration directories do not need to be backed up, and it is hoped that they can be excluded through parameters.
The current uni backup mechanism uses a built-in dir and file list in the process of backing up key data, the filter needs to be expanded on this list, and for directories, each internal subdirectory and file in the backup, the filter also needs to be applied to ensure that the granularity of the file can be processed correctly
In terms of usage, consider adding a key data filter list to backup params, which specifies the directories and files to be filtered. In order to provide broader support, consider supporting the glob paradigm for the filter list, so that users will have more freedom when editing the filters.
The following improvements and support have been added
- uni backup of cyfs-backup supports filter
The
key_data_filtersparameter has been added to specify a set of key data file paths to be filtered, support glob pattern, and support filtering files and directories.
https://github.com/buckyos/CYFS/blob/89110cca0f10409ee6958a85845c64436ead849f/src/component/cyfs-backup-lib/src/backup/uni_backup_task.rs#L31-L41
- cyfs-backuo-tool's restore function supports
--key-data-filterparameter Support passing multiple parameters, that is, you can specify multiple file paths to be filtered, such as
. /cyfs-backup --mode backup --id test --key-data-filter /cyfs/etc/gateway/** --key-data-filter /cyfs/etc/ood-daemon/**
The above backup command filters the configuration directories of ood-daemon and gateway under /cyfs/etc. The configuration and directories of other services are not affected