Polish: extract src/lib.rs #87
@@ -3,6 +3,10 @@ name = "claw-store"
|
|||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
name = "claw_store"
|
||||||
|
path = "src/lib.rs"
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "claw-store"
|
name = "claw-store"
|
||||||
path = "src/main.rs"
|
path = "src/main.rs"
|
||||||
|
|||||||
@@ -24,27 +24,13 @@ use std::ffi::OsStr;
|
|||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::time::{Duration, UNIX_EPOCH};
|
use std::time::{Duration, UNIX_EPOCH};
|
||||||
|
|
||||||
// Same module tree as main.rs / claw_cargo.rs — bin-only crate,
|
// Polish (2026-07-14): lib split. Bin pulls from the library crate
|
||||||
// so we redeclare the mods here. Only `cluster::blob` is actually
|
// rather than re-declaring every internal module. Adds/removes to
|
||||||
// used from this bin.
|
// the module tree happen in exactly one place (src/lib.rs).
|
||||||
mod actions;
|
use claw_store::cluster::blob::{BlobId, BlobStore};
|
||||||
mod cargo_init;
|
use claw_store::cluster::refs::RefStore;
|
||||||
mod cluster;
|
use claw_store::cluster::snapshot::SnapshotStore;
|
||||||
mod config;
|
use claw_store::cluster::tags::TagStore;
|
||||||
mod daemon;
|
|
||||||
mod head_watch;
|
|
||||||
mod hot;
|
|
||||||
mod manifest;
|
|
||||||
mod restore;
|
|
||||||
mod serve;
|
|
||||||
mod snapshot;
|
|
||||||
mod sync;
|
|
||||||
mod zfs;
|
|
||||||
|
|
||||||
use cluster::blob::{BlobId, BlobStore};
|
|
||||||
use cluster::refs::RefStore;
|
|
||||||
use cluster::snapshot::SnapshotStore;
|
|
||||||
use cluster::tags::TagStore;
|
|
||||||
|
|
||||||
const TTL: Duration = Duration::from_secs(1);
|
const TTL: Duration = Duration::from_secs(1);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
//! Clawstor library — the shared code that every binary in this
|
||||||
|
//! crate pulls in.
|
||||||
|
//!
|
||||||
|
//! Historically this crate was bin-only: each of `claw-store`,
|
||||||
|
//! `claw-cargo`, and `claw-fuse` re-declared the full `mod ...` list
|
||||||
|
//! at its own root. That worked but meant a new bin had to duplicate
|
||||||
|
//! 13 lines of module registration (and stayed one edit-slip away
|
||||||
|
//! from silently dropping a module).
|
||||||
|
//!
|
||||||
|
//! This file lifts the shared modules into a proper library crate.
|
||||||
|
//! Bins now write `use claw_store::cluster::blob::BlobStore;` and get
|
||||||
|
//! the same symbols. Existing internal paths — the ones that use
|
||||||
|
//! `crate::cluster::...` inside bins — keep working because each bin
|
||||||
|
//! still has its own `mod cluster;` at the bin root that re-declares
|
||||||
|
//! the same file tree.
|
||||||
|
//!
|
||||||
|
//! Future work: migrate the bin-internal `mod ...` blocks to
|
||||||
|
//! `use claw_store::...` and delete this parallel structure.
|
||||||
|
|
||||||
|
pub mod actions;
|
||||||
|
pub mod cargo_init;
|
||||||
|
pub mod cluster;
|
||||||
|
pub mod config;
|
||||||
|
pub mod daemon;
|
||||||
|
pub mod head_watch;
|
||||||
|
pub mod hot;
|
||||||
|
pub mod manifest;
|
||||||
|
pub mod restore;
|
||||||
|
pub mod serve;
|
||||||
|
pub mod snapshot;
|
||||||
|
pub mod sync;
|
||||||
|
pub mod zfs;
|
||||||
Reference in New Issue
Block a user