pub struct DeploymentRecordFile {
pub profiles: HashMap<String, HashMap<String, DeploymentRecord>>,
}Expand description
The on-disk record file: a map of network key → (alias → record).
Fields§
§profiles: HashMap<String, HashMap<String, DeploymentRecord>>Implementations§
Source§impl DeploymentRecordFile
impl DeploymentRecordFile
Sourcepub fn read<P: AsRef<Path>>(path: P) -> Result<Self, String>
pub fn read<P: AsRef<Path>>(path: P) -> Result<Self, String>
Read the record file at path. A missing or empty file is treated as a
fresh (empty) record set; a present-but-corrupt file is an error so the
operator is told to inspect it rather than silently overwriting it.
Sourcepub fn write<P: AsRef<Path>>(&self, path: P) -> Result<(), String>
pub fn write<P: AsRef<Path>>(&self, path: P) -> Result<(), String>
Write the record file to path. Uses an atomic write: serializes to a
sibling temp file, syncs to disk, then renames over the target. This
prevents a crash or full-disk mid-write from leaving a partial or empty
file that would block subsequent deploys with a parse error.
Serialization errors (none expected for this type) and I/O errors are returned to the caller, which warns but never fails the deployment on a record-write problem.
Sourcepub fn records_for(
&self,
network: &str,
) -> Option<&HashMap<String, DeploymentRecord>>
pub fn records_for( &self, network: &str, ) -> Option<&HashMap<String, DeploymentRecord>>
Records for a single network key, if any exist.
Sourcepub fn record_for(
&self,
network: &str,
alias: &str,
) -> Option<&DeploymentRecord>
pub fn record_for( &self, network: &str, alias: &str, ) -> Option<&DeploymentRecord>
Record for a single alias on a network, if present.
Sourcepub fn set_record(
&mut self,
network: &str,
alias: &str,
record: DeploymentRecord,
)
pub fn set_record( &mut self, network: &str, alias: &str, record: DeploymentRecord, )
Insert (or replace) a record for an alias on a network.
Sourcepub fn remove_record(&mut self, network: &str, alias: &str)
pub fn remove_record(&mut self, network: &str, alias: &str)
Remove a record for an alias on a network (used when a recorded contract is found to no longer exist on-chain and gets re-deployed).