Skip to content

Using conserve as a library #161

Closed
Closed

Description

@azzamsa

Hi.

I plan to use conserve as library. Is there any starting point for me?
Something like trust-dns client where it explains the minimal working example and docs for using it as a library (not as CLI).

Thanks for conserve.

Activity

  1. azzamsa commented on Sep 3, 2021

    @azzamsa
    Author

    Fortunately, I am able to build the backup MWE by reading trough /bin/conserve.rs, tests/api/backup.rs, and the documentation

    use std::path::Path;
    
    use conserve::archive::Archive;
    use conserve::backup::{backup, BackupOptions};
    use conserve::live_tree::LiveTree;
    
    fn main() {
        let archive = Path::new("/home/user/playground/backup/storage/");
        // must be a directory
        let source = "/home/user/playground/backup/source/";
    
        // create archive
        // Archive::create_path(archive).unwrap();
    
        // backup
        backup(
            &Archive::open_path(&archive).unwrap(),
            &LiveTree::open(source).unwrap(),
            &BackupOptions::default(),
        )
        .expect("backup");
    
        println!("Hello, world!");
    }
  2. sourcefrog commented on Sep 3, 2021

    @sourcefrog
    Owner

    Hi @azzamsa great to hear that you're interested. For now the existing code, as you found, is the best guide, but we can certainly talk about how to make it easier to use.

    What were you thinking to build on top of it?

    Bear in mind the GPL v2 license imposes some requirements on programs that include Conserve.

  3. self-assigned this
    on Sep 3, 2021
  4. Repository owner locked and limited conversation to collaborators on Sep 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions