Do short exclusions for remote backups (also bump version as protocol version incompatible)

This commit is contained in:
Olivier 'reivilibre' 2022-07-08 15:31:12 +01:00
parent 080875bfce
commit 8612804298
6 changed files with 16 additions and 8 deletions

4
Cargo.lock generated
View File

@ -404,7 +404,7 @@ dependencies = [
[[package]]
name = "datman"
version = "0.6.0-alpha.4"
version = "0.6.0-alpha.5"
dependencies = [
"anyhow",
"arc-interner",
@ -1733,7 +1733,7 @@ dependencies = [
[[package]]
name = "yama"
version = "0.6.0-alpha.4"
version = "0.6.0-alpha.5"
dependencies = [
"anyhow",
"blake",

View File

@ -1,6 +1,6 @@
[package]
name = "datman"
version = "0.6.0-alpha.4"
version = "0.6.0-alpha.5"
authors = ["Olivier 'reivilibre' <olivier@librepush.net>"]
edition = "2021"
repository = "https://bics.ga/reivilibre/yama"
@ -30,7 +30,7 @@ humansize = "1.1.1"
chrono = "0.4.19"
itertools = "0.10.1"
hostname = "0.3.1"
yama = { path = "../yama", version = "0.6.0-alpha.1" }
yama = { path = "../yama", version = "0.6.0-alpha.5" }
metrics = "0.17.1"
bare-metrics-recorder = { version = "0.1.0" }
comfy-table = "6.0.0-rc.1"

View File

@ -213,6 +213,7 @@ pub fn interactive_labelling_session(path: &Path, source_name: String) -> anyhow
&mut write,
directory.as_ref(),
!*cross_filesystems,
&BTreeSet::new(),
)?
.ok_or_else(|| anyhow!("Remote scan failed (does the directory exist?)"))?
.replace_meta(&None);

View File

@ -5,8 +5,9 @@ use crate::tree::FileTree;
use anyhow::{anyhow, bail};
use chrono::Utc;
use log::info;
use std::collections::BTreeSet;
use std::io::{Read, Write};
use std::path::Path;
use std::path::{Path, PathBuf};
use std::process::{Child, Command, Stdio};
use std::sync::Arc;
use yama::commands::{load_pile_descriptor, open_pile};
@ -49,11 +50,13 @@ pub fn scanning<R: Read, W: Write>(
write: &mut W,
path: &Path,
one_filesystem: bool,
exclusions: &BTreeSet<PathBuf>,
) -> anyhow::Result<Option<FileTree<(), (), (), ()>>> {
info!("Scanning.");
write_message(write, &"scan")?;
write_message(write, &path)?;
write_message(write, &one_filesystem)?;
write_message(write, exclusions)?;
write.flush()?;
let scan_result: Option<FileTree<(), (), (), ()>> = read_message(read)?;
@ -200,6 +203,9 @@ pub fn backup_remote_source_to_destination<PT: ProgressTracker + Send + 'static>
info!("Connecting...");
introduction(&mut read, &mut write)?;
let rules = load_labelling_rules(desc_path, source_name)?;
let exclusions = rules.get_exclusions_set(directory);
// then request to scan
info!("Requesting scan... (this may take some time)");
let scan_result = scanning(
@ -207,10 +213,10 @@ pub fn backup_remote_source_to_destination<PT: ProgressTracker + Send + 'static>
&mut write,
directory.as_ref(),
!*cross_filesystems,
&exclusions,
)?
.ok_or_else(|| anyhow!("Remote scan failed (does the directory exist?)"))?;
let rules = load_labelling_rules(desc_path, source_name)?;
let mut root =
label_filter_and_convert(scan_result, descriptor, source_name, &rules, dest)?
.ok_or_else(|| anyhow!("Empty filter..."))?;

View File

@ -44,7 +44,8 @@ pub fn introduction<R: Read, W: Write>(read: &mut R, write: &mut W) -> anyhow::R
pub fn scanning<R: Read, W: Write>(read: &mut R, write: &mut W) -> anyhow::Result<()> {
let path: PathBuf = read_message(read)?;
let one_filesystem: bool = read_message(read)?;
let scan_result = scan(&path, one_filesystem, &BTreeSet::new())?;
let exclusions: BTreeSet<PathBuf> = read_message(read)?;
let scan_result = scan(&path, one_filesystem, &exclusions)?;
write_message(write, &scan_result)?;
write.flush()?;
Ok(())

View File

@ -1,6 +1,6 @@
[package]
name = "yama"
version = "0.6.0-alpha.4"
version = "0.6.0-alpha.5"
authors = ["Olivier 'reivilibre' <olivier@librepush.net>"]
edition = "2018"
description = "Deduplicated, compressed and encrypted content pile manager"