This repository has been archived on 2026-08-30. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
varde/varde-daemon/src/lib.rs
T

26 lines
806 B
Rust
Raw Normal View History

//! varde-daemon library surface.
//!
//! The daemon is a binary, but its internals are exposed as a library so
//! integration tests can run real daemons in-process on ephemeral sockets.
pub mod config;
pub mod daemon;
pub mod meta;
pub mod server;
pub mod store;
pub mod transfer;
use std::sync::Arc;
use anyhow::Result;
/// Run a daemon with the given config until the future is dropped or the
/// listener fails. The socket is bound before the accept loop starts, so
/// once this future has been polled the socket path exists.
pub async fn run(config: config::Config) -> Result<()> {
let socket_path = config.socket_path.clone();
let daemon = Arc::new(daemon::Daemon::open(config).await?);
let listener = server::bind_socket(&socket_path)?;
server::serve(listener, daemon).await
}