mirror of
https://git.proxmox.com/git/proxmox-offline-mirror
synced 2025-08-17 13:39:50 +00:00
mirror, pool: fix comment text width
rustfmt ignores those... Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
837867edb2
commit
36949d116b
@ -142,8 +142,9 @@ fn fetch_repo_file(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Helper to fetch InRelease (`detached` == false) or Release/Release.gpg (`detached` == true) files from repository.
|
/// Helper to fetch InRelease or Release/Release.gpg files from repository.
|
||||||
///
|
///
|
||||||
|
/// Set `detached` == false to fetch InRelease or to `detached` == true for Release/Release.gpg.
|
||||||
/// Verifies the contained/detached signature and stores all fetched files under `prefix`.
|
/// Verifies the contained/detached signature and stores all fetched files under `prefix`.
|
||||||
///
|
///
|
||||||
/// Returns the verified raw release file data, or None if the "fetch" part itself fails.
|
/// Returns the verified raw release file data, or None if the "fetch" part itself fails.
|
||||||
@ -259,8 +260,11 @@ fn fetch_release(
|
|||||||
|
|
||||||
/// Helper to fetch an index file referenced by a `ReleaseFile`.
|
/// Helper to fetch an index file referenced by a `ReleaseFile`.
|
||||||
///
|
///
|
||||||
/// Since these usually come in compressed and uncompressed form, with the latter often not actually existing in the source repository as file, this fetches and if necessary decompresses to obtain a copy of the uncompressed data.
|
/// Since these usually come in compressed and uncompressed form, with the latter often not
|
||||||
/// Will skip fetching if both references are already available with the expected checksum in the pool, in which case they will just be re-linked under the new path.
|
/// actually existing in the source repository as file, this fetches and if necessary decompresses
|
||||||
|
/// to obtain a copy of the uncompressed data.
|
||||||
|
/// Will skip fetching if both references are already available with the expected checksum in the
|
||||||
|
/// pool, in which case they will just be re-linked under the new path.
|
||||||
///
|
///
|
||||||
/// Returns the uncompressed data.
|
/// Returns the uncompressed data.
|
||||||
fn fetch_index_file(
|
fn fetch_index_file(
|
||||||
@ -375,9 +379,11 @@ fn fetch_index_file(
|
|||||||
|
|
||||||
/// Helper to fetch arbitrary files like binary packages.
|
/// Helper to fetch arbitrary files like binary packages.
|
||||||
///
|
///
|
||||||
/// Will skip fetching if matching file already exists locally, in which case it will just be re-linked under the new path.
|
/// Will skip fetching if matching file already exists locally, in which case it will just be
|
||||||
|
/// re-linked under the new path.
|
||||||
///
|
///
|
||||||
/// If need_data is false and the mirror config is set to skip verification, reading the file's content will be skipped as well if fetching was skipped.
|
/// If need_data is false and the mirror config is set to skip verification, reading the file's
|
||||||
|
/// content will be skipped as well if fetching was skipped.
|
||||||
fn fetch_plain_file(
|
fn fetch_plain_file(
|
||||||
config: &ParsedMirrorConfig,
|
config: &ParsedMirrorConfig,
|
||||||
url: &str,
|
url: &str,
|
||||||
@ -734,7 +740,10 @@ fn fetch_source_packages(
|
|||||||
/// - Fetch referenced indices according to config
|
/// - Fetch referenced indices according to config
|
||||||
/// - Fetch binary packages referenced by package indices
|
/// - Fetch binary packages referenced by package indices
|
||||||
///
|
///
|
||||||
/// Files will be linked in a temporary directory and only renamed to the final, valid snapshot directory at the end. In case of error, leftover `XXX.tmp` directories at the top level of `base_dir` can be safely removed once the next snapshot was successfully created, as they only contain hardlinks.
|
/// Files will be linked in a temporary directory and only renamed to the final, valid snapshot
|
||||||
|
/// directory at the end. In case of error, leftover `XXX.tmp` directories at the top level of
|
||||||
|
/// `base_dir` can be safely removed once the next snapshot was successfully created, as they only
|
||||||
|
/// contain hardlinks.
|
||||||
pub fn create_snapshot(
|
pub fn create_snapshot(
|
||||||
config: MirrorConfig,
|
config: MirrorConfig,
|
||||||
snapshot: &Snapshot,
|
snapshot: &Snapshot,
|
||||||
@ -908,7 +917,8 @@ pub fn create_snapshot(
|
|||||||
let mut package_index_data = None;
|
let mut package_index_data = None;
|
||||||
|
|
||||||
for reference in files {
|
for reference in files {
|
||||||
// if both compressed and uncompressed are referenced, the uncompressed file may not exist on the server
|
// if both compressed and uncompressed are referenced, the uncompressed file may
|
||||||
|
// not exist on the server
|
||||||
if Some(reference) == uncompressed_ref && files.len() > 1 {
|
if Some(reference) == uncompressed_ref && files.len() > 1 {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1038,7 +1048,8 @@ pub fn create_snapshot(
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Remove a snapshot by removing the corresponding snapshot directory. To actually free up space, a garbage collection needs to be run afterwards.
|
/// Remove a snapshot by removing the corresponding snapshot directory. To actually free up space,
|
||||||
|
/// a garbage collection needs to be run afterwards.
|
||||||
pub fn remove_snapshot(config: &MirrorConfig, snapshot: &Snapshot) -> Result<(), Error> {
|
pub fn remove_snapshot(config: &MirrorConfig, snapshot: &Snapshot) -> Result<(), Error> {
|
||||||
let pool: Pool = pool(config)?;
|
let pool: Pool = pool(config)?;
|
||||||
let path = pool.get_path(Path::new(&snapshot.to_string()))?;
|
let path = pool.get_path(Path::new(&snapshot.to_string()))?;
|
||||||
|
12
src/pool.rs
12
src/pool.rs
@ -96,7 +96,8 @@ impl Pool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the file contents for a given checksum, optionally `verify`ing whether the on-disk data matches the checksum.
|
/// Returns the file contents for a given checksum, optionally `verify`ing whether the on-disk
|
||||||
|
/// data matches the checksum.
|
||||||
pub(crate) fn get_contents(
|
pub(crate) fn get_contents(
|
||||||
&self,
|
&self,
|
||||||
checksums: &CheckSums,
|
checksums: &CheckSums,
|
||||||
@ -115,7 +116,8 @@ impl Pool {
|
|||||||
Ok(data)
|
Ok(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper to return all possible checksum file paths for a given checksum. Checksums considered insecure will be ignored.
|
// Helper to return all possible checksum file paths for a given checksum. Checksums considered
|
||||||
|
// insecure will be ignored.
|
||||||
fn get_checksum_paths(&self, checksums: &CheckSums) -> Result<Vec<PathBuf>, Error> {
|
fn get_checksum_paths(&self, checksums: &CheckSums) -> Result<Vec<PathBuf>, Error> {
|
||||||
if !checksums.is_secure() {
|
if !checksums.is_secure() {
|
||||||
bail!("pool cannot operate on files lacking secure checksum!");
|
bail!("pool cannot operate on files lacking secure checksum!");
|
||||||
@ -383,7 +385,8 @@ impl PoolLockGuard<'_> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Links previously added file into `path` (relative to `link_dir`). Missing parent directories will be created automatically.
|
/// Links previously added file into `path` (relative to `link_dir`). Missing parent
|
||||||
|
/// directories will be created automatically.
|
||||||
pub(crate) fn link_file(&self, checksums: &CheckSums, path: &Path) -> Result<bool, Error> {
|
pub(crate) fn link_file(&self, checksums: &CheckSums, path: &Path) -> Result<bool, Error> {
|
||||||
let path = self.pool.get_path(path)?;
|
let path = self.pool.get_path(path)?;
|
||||||
if !self.pool.path_in_link_dir(&path) {
|
if !self.pool.path_in_link_dir(&path) {
|
||||||
@ -408,7 +411,8 @@ impl PoolLockGuard<'_> {
|
|||||||
link_file_do(source, &path)
|
link_file_do(source, &path)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Unlink a previously linked file at `path` (absolute, must be below `link_dir`). Optionally remove any parent directories that became empty.
|
/// Unlink a previously linked file at `path` (absolute, must be below `link_dir`). Optionally
|
||||||
|
/// remove any parent directories that became empty.
|
||||||
pub(crate) fn unlink_file(
|
pub(crate) fn unlink_file(
|
||||||
&self,
|
&self,
|
||||||
mut path: &Path,
|
mut path: &Path,
|
||||||
|
Loading…
Reference in New Issue
Block a user