Skip to content

threefoldtech/zinit-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zinit Client

Crates.io Documentation License: MIT

A Rust client library for the Zinit service manager.

Features

  • Zero Configuration: Automatically detects server version and protocol
  • Complete API: All Zinit operations (list, start, stop, create, delete, etc.)
  • Async/Await: Built on Tokio for high performance
  • Type Safe: Strongly typed service states and responses
  • Error Handling: Comprehensive error types with helpful messages
  • Backward Compatible: Works with legacy Zinit installations

Installation

Add this to your Cargo.toml:

[dependencies] zinit-client = "0.4.0"

Quick Start

use zinit_client::ZinitClient; #[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> { let client = ZinitClient::new("/var/run/zinit.sock"); // List all services let services = client.list().await?; println!("Services: {:?}", services); // Start a service client.start("my-service").await?; // Get service status let status = client.status("my-service").await?; println!("Status: {:?}", status); Ok(()) }

API Overview

Service Management

// List all services let services = client.list().await?; // Service lifecycle client.start("service-name").await?; client.stop("service-name").await?; client.restart("service-name").await?; // Get detailed status let status = client.status("service-name").await?; // Create/delete services (if supported by server) client.create_service("name", config).await?; client.delete_service("name").await?;

Examples

Run the demo to see the universal interface in action:

cargo run --example <example_name> <sock_path>

Documentation

For detailed API documentation, visit docs.rs/zinit-client.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A Rust client library for interacting with the Zinit https://github.com/threefoldtech/zinit service manager.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages