thoughts_tool/platform/
constants.rs

1/// Platform-specific constants for mount operations
2#[cfg(target_os = "linux")]
3pub mod linux {
4    /// Default mount options for mergerfs
5    pub const DEFAULT_MOUNT_OPTIONS: &[&str] = &[
6        "category.create=mfs",
7        "moveonenospc=true",
8        "dropcacheonclose=true",
9        "fsname=thoughts",
10    ];
11
12    /// Path to check for active mounts
13    pub const PROC_MOUNTS: &str = "/proc/mounts";
14
15    /// Path to mountinfo for detailed mount information
16    pub const PROC_MOUNTINFO: &str = "/proc/self/mountinfo";
17
18    /// Filesystem type identifier for mergerfs
19    pub const MERGERFS_FSTYPE: &str = "fuse.mergerfs";
20}
21
22#[cfg(target_os = "macos")]
23pub mod macos {
24    /// Default volume name for FUSE mounts
25    pub const DEFAULT_VOLUME_NAME: &str = "Thoughts";
26
27    /// Default mount options for FUSE-T with unionfs-fuse
28    pub const DEFAULT_MOUNT_OPTIONS: &[&str] = &[
29        "volname=Thoughts",
30        "local",
31        "cow",
32        "hide_meta_files",
33        "use_ino",
34        "max_files=32768",
35    ];
36
37    /// FUSE-T filesystem path
38    pub const FUSE_T_FS_PATH: &str = "/Library/Filesystems/fuse-t.fs";
39
40    /// unionfs-fuse binary names to search for
41    pub const UNIONFS_BINARIES: &[&str] = &["unionfs-fuse", "unionfs"];
42
43    /// Mount command for listing mounts
44    pub const MOUNT_CMD: &str = "mount";
45
46    /// Diskutil command for volume operations
47    pub const DISKUTIL_CMD: &str = "diskutil";
48}
49
50/// Common constants across platforms
51pub mod common {
52    use std::time::Duration;
53
54    /// Default permissions for mount point directories
55    pub const MOUNT_POINT_PERMISSIONS: u32 = 0o755;
56
57    /// Timeout for mount operations
58    pub const MOUNT_TIMEOUT: Duration = Duration::from_secs(30);
59
60    /// Timeout for unmount operations
61    pub const UNMOUNT_TIMEOUT: Duration = Duration::from_secs(10);
62
63    /// Maximum retries for mount operations
64    pub const MAX_MOUNT_RETRIES: u32 = 3;
65
66    /// Delay between mount retries
67    pub const MOUNT_RETRY_DELAY: Duration = Duration::from_millis(500);
68
69    /// Maximum time to wait for mount visibility after successful mount command
70    pub const MOUNT_VERIFY_TIMEOUT: Duration = Duration::from_secs(3);
71}