Crate liboxen

Source
Expand description

🐂 liboxen

Fast unstructured data version control.

§Examples

Instantiating a new repo:

use liboxen::command;

// Instantiate a new repo
let repo = repositories::init("test_repo")?;
// Add a file to the repo
repositories::add(&repo, "file.txt")?;
// Commit the file
repositories::commit(&repo, "Added file.txt")?;

Push data from local repo to remote repo:

use liboxen::command;
use liboxen::model::LocalRepository;

// Create LocalRepository from existing repo
let repo = LocalRepository::new("test_repo")?;
// Add a file to the repo
repositories::add(&repo, "file.txt")?;
// Commit the file
repositories::commit(&repo, "Added file.txt")?;
// Set remote
let namespace = "ox";
let repo_name = "test_repo";
let host = "0.0.0.0:3000";
let remote_repo = api::client::repositories::create(
    repo, namespace, repo_name, host
).await?;
let remote_url = remote_repo.url();
// Set remote
let remote_name = "origin";
command::config::set_remote(&mut repo, remote_name, &remote_url)?;
// Push to remote
repositories::push(&repo).await?;

Clone data from remote url

use liboxen::command;
use liboxen::model::LocalRepository;

let url = "http://0.0.0.0:3000/ox/test_repo";
let repo_dir = "test_repo";
let opts = CloneOpts::new(url, &repo_dir);
let repo = repositories::clone(&opts).await?;

Modules§

  • API - helpful library functions to interact with oxen repositories
  • Oxen Commands - entry point for all Oxen commands
  • Configuration for Oxen, including user configuration and remote host configuration
  • Constants used throughout the codebase
  • Core functionality for Oxen
  • Errors for the oxen library
  • The structs and enums that are used to represent the data in the oxen library
  • Command line option structs.
  • Repositories
  • Helpers for our unit and integration tests
  • Various utility functions
  • Views are the data structures that are returned by the API endpoints.

Macros§