oku_fs/fs/
mod.rs

1#[cfg(feature = "fuse")]
2use debug_ignore::DebugIgnore;
3#[cfg(feature = "fuse")]
4use easy_fuser::templates::DefaultFuseHandler;
5use iroh_blobs::net_protocol::Blobs;
6use iroh_docs::protocol::Docs;
7use std::path::PathBuf;
8#[cfg(feature = "fuse")]
9use std::sync::Arc;
10use std::sync::LazyLock;
11#[cfg(feature = "fuse")]
12use tokio::runtime::Handle;
13use tokio::sync::watch::Sender;
14
15/// Core functionality of an Oku file system.
16pub mod core;
17/// Directory-related functionality of an Oku file system.
18pub mod directory;
19/// File-related functionality of an Oku file system.
20pub mod file;
21/// Implementation of OkuNet.
22pub mod net;
23/// Replica-related functionality of an Oku file system.
24pub mod replica;
25/// Useful functions for implementing the Oku file system.
26pub mod util;
27
28/// The path on disk where the file system is stored.
29pub const FS_PATH: &str = ".oku";
30pub(crate) static NODE_PATH: LazyLock<PathBuf> =
31    LazyLock::new(|| PathBuf::from(FS_PATH).join("node"));
32
33/// An instance of an Oku file system.
34///
35/// The `OkuFs` struct is the primary interface for interacting with an Oku file system.
36#[derive(Clone, Debug)]
37pub struct OkuFs {
38    pub(crate) endpoint: iroh::Endpoint,
39    pub(crate) blobs: Blobs<iroh_blobs::store::fs::Store>,
40    pub(crate) docs: Docs<iroh_blobs::store::fs::Store>,
41    pub(crate) router: iroh::protocol::Router,
42    /// An Iroh node responsible for storing replicas on the local machine, as well as joining swarms to fetch replicas from other nodes.
43    /// A watcher for when replicas are created, deleted, or imported.
44    pub replica_sender: Sender<()>,
45    /// A watcher for whether or not content is being fetched from the OkuNet.
46    pub okunet_fetch_sender: Sender<bool>,
47    #[cfg(feature = "fuse")]
48    pub(crate) fuse_handler: DebugIgnore<Arc<DefaultFuseHandler>>,
49    #[cfg(feature = "fuse")]
50    /// A Tokio runtime handle to perform asynchronous operations with.
51    pub(crate) handle: Handle,
52    pub(crate) dht: mainline::async_dht::AsyncDht,
53}