Crate liboxen

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::from_dir("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
API - helpful library functions to interact with oxen repositories
command
Oxen Commands - entry point for all Oxen commands
config
Configuration for Oxen, including user configuration and remote host configuration
constants
Constants used throughout the codebase
core
Core functionality for Oxen
error
Errors for the oxen library
io
migrations
model
The structs and enums that are used to represent the data in the oxen library
namespaces
opts
Command line option structs.
repositories
Repositories
resource
storage
test
Helpers for our unit and integration tests
util
Various utility functions
view
Views are the data structures that are returned by the API endpoints.

Macros§

current_function