@@ -60,7 +60,12 @@ pub const ZSTD_COMPRESSION_LEVEL: i32 = 4;
60
60
/// Primarily intended for development and testing.
61
61
pub const ENV_PATH : & str = "NETPULSE_STORE_PATH" ;
62
62
63
+ /// How long to wait between running workloads for the daemon
63
64
pub const DEFAULT_PERIOD : i64 = 60 ;
65
+ /// Environment variable name for the time period after which the daemon wakes up.
66
+ ///
67
+ /// If set, its value will be used instead of [DEFAULT_PERIOD].
68
+ /// Primarily intended for development and testing.
64
69
pub const ENV_PERIOD : & str = "NETPULSE_PERIOD" ;
65
70
66
71
/// Version information for the store format.
@@ -630,36 +635,39 @@ impl Store {
630
635
& mut self . checks
631
636
}
632
637
633
- /// Reads only the version field from a store file without loading the entire store .
638
+ /// Reads only the [Version] from a store file without loading the entire [Store] .
634
639
///
635
640
/// This function efficiently checks the store version by:
636
- /// 1. Opening the store file
641
+ /// 1. Opening the store file (decompressing it if enabled)
637
642
/// 2. Deserializing only the version field
638
643
/// 3. Skipping the rest of the data
639
644
///
640
645
/// This is more efficient than loading the full store when only version
641
- /// information is needed, such as during version compatibility checks.
646
+ /// information is needed, such as during version compatibility checks. It may also keep
647
+ /// working if the format/version of the store is incompatible with what this version of
648
+ /// netpulse uses.
642
649
///
643
650
/// # Feature Flags
644
651
///
645
652
/// If the "compression" feature is enabled, this function will decompress
646
- /// the store file using zstd before reading the version.
653
+ /// the store file using [ zstd] before reading the version.
647
654
///
648
655
/// # Errors
649
656
///
650
657
/// Returns [StoreError] if:
651
658
/// - Store file doesn't exist ([`StoreError::DoesNotExist`])
652
659
/// - Store file is corrupt or truncated ([`StoreError::Load`])
653
- /// - File permissions prevent reading
654
- /// - Decompression fails (with "compression" feature)
660
+ /// - File permissions prevent reading ([`StoreError::Io`])
661
+ /// - Decompression fails (with "compression" feature) ([`StoreError::Io`])
655
662
///
656
663
/// # Examples
657
664
///
658
665
/// ```rust,no_run
659
- /// use netpulse::Store;
666
+ /// use netpulse::store::Store;
667
+ /// use netpulse::errors::StoreError;
660
668
///
661
669
/// match Store::peek_file_version() {
662
- /// Ok(version) => println!("Store version: {}", version),
670
+ /// Ok(version) => println!("Store version in file : {}", version),
663
671
/// Err(StoreError::DoesNotExist) => println!("No store file found"),
664
672
/// Err(e) => eprintln!("Error reading store version: {}", e),
665
673
/// }
0 commit comments