pub struct LockFile {
pub locked_dependencies: Vec<LockedDependency>,
pub lockfile_version: u32,
pub config_hash: String,
pub generated_at: String,
pub config_modified: Option<String>,
}Expand description
Lock file containing all resolved dependencies and metadata
The lock file ensures reproducible builds by recording exact versions and integrity information for all dependencies.
Fields§
§locked_dependencies: Vec<LockedDependency>List of all locked dependencies
lockfile_version: u32Version of the lockfile format for compatibility
config_hash: StringHash of the configuration that generated this lock
generated_at: StringTimestamp when this lock was generated (nanoseconds since epoch)
config_modified: Option<String>Configuration file modification time (nanoseconds since epoch)
Implementations§
Source§impl LockFile
impl LockFile
Sourcepub fn new(
locked_dependencies: Vec<LockedDependency>,
config_hash: String,
) -> Self
pub fn new( locked_dependencies: Vec<LockedDependency>, config_hash: String, ) -> Self
Create a new lockfile with current timestamp and version
§Arguments
locked_dependencies- Vector of resolved dependenciesconfig_hash- Hash of the configuration that generated this lock
Sourcepub fn with_config_modified(
locked_dependencies: Vec<LockedDependency>,
config_hash: String,
config_modified: Option<String>,
) -> Self
pub fn with_config_modified( locked_dependencies: Vec<LockedDependency>, config_hash: String, config_modified: Option<String>, ) -> Self
Create a new lockfile with config modification time
§Arguments
locked_dependencies- Vector of resolved dependenciesconfig_hash- Hash of the configurationconfig_modified- Optional config file modification timestamp
Sourcepub fn is_compatible_with_config(&self, config_hash: &str) -> bool
pub fn is_compatible_with_config(&self, config_hash: &str) -> bool
Check if this lockfile is compatible with the given config hash
Sourcepub fn is_newer_than_config(&self, config_path: &Path) -> Result<bool>
pub fn is_newer_than_config(&self, config_path: &Path) -> Result<bool>
Check if the lockfile is up-to-date based on config file modification time
Sourcepub fn is_up_to_date(
&self,
config_path: &Path,
current_config_hash: &str,
dependencies: &[LockedDependency],
) -> Result<bool>
pub fn is_up_to_date( &self, config_path: &Path, current_config_hash: &str, dependencies: &[LockedDependency], ) -> Result<bool>
Enhanced lockfile validation that checks multiple criteria
Sourcepub fn dependencies_match(&self, other_deps: &[LockedDependency]) -> bool
pub fn dependencies_match(&self, other_deps: &[LockedDependency]) -> bool
Compare two sets of locked dependencies, accounting for order independence
Sourcepub fn compute_config_hash(
config_content: &str,
dependencies: &[DependencyConfig],
) -> String
pub fn compute_config_hash( config_content: &str, dependencies: &[DependencyConfig], ) -> String
Compute a hash of the relevant configuration that affects locking This focuses only on the dependency specifications, not formatting/comments
Sourcepub fn get_config_modification_time(config_path: &Path) -> Result<String>
pub fn get_config_modification_time(config_path: &Path) -> Result<String>
Get the modification time of a config file as nanoseconds since epoch