CYFS icon indicating copy to clipboard operation
CYFS copied to clipboard

Backup service supports conditional filtering of key data

Open lurenpluto opened this issue 2 years ago • 2 comments

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.

lurenpluto avatar May 12 '23 09:05 lurenpluto

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.

lurenpluto avatar May 12 '23 09:05 lurenpluto

The following improvements and support have been added

  1. uni backup of cyfs-backup supports filter The key_data_filters parameter 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

  1. cyfs-backuo-tool's restore function supports --key-data-filter parameter 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

lurenpluto avatar May 13 '23 07:05 lurenpluto