Update comments to reflect actual implementation

This commit is contained in:
Zhaofeng Li 2023-01-01 20:59:02 -07:00
parent 5404345bc7
commit a3636339e0
2 changed files with 6 additions and 10 deletions

View file

@ -41,9 +41,9 @@ type CompressorFn<C> = Box<dyn FnOnce(C) -> Box<dyn AsyncRead + Unpin + Send> +
/// Applies compression to a stream, computing hashes along the way.
///
/// Our strategy is to stream into a temporary file on S3, performing compression
/// and computing the hashes along the way. We delete the temporary file on S3
/// if the hashes do not match.
/// Our strategy is to stream directly onto a UUID-keyed file on the
/// storage backend, performing compression and computing the hashes
/// along the way. We delete the file if the hashes do not match.
///
/// ```text
/// ┌───────────────────────────────────►NAR Hash
@ -76,7 +76,7 @@ trait UploadPathNarInfoExt {
/// the `holders_count` of one `nar` row with same NAR hash. If rows were
/// updated, it means the NAR exists in the global cache and we can deduplicate
/// after confirming the NAR hash ("Deduplicate" case). Otherwise, we perform
/// a new upload to S3 ("New NAR" case).
/// a new upload to the storage backend ("New NAR" case).
#[instrument(skip_all)]
#[axum_macros::debug_handler]
pub(crate) async fn upload_path(
@ -259,7 +259,7 @@ async fn upload_path_new(
let mut stream = CompressionStream::new(stream, compressor);
// Stream the object to S3
// Stream the object to the storage backend
backend
.upload_file(key, stream.stream())
.await

View file

@ -90,10 +90,6 @@ pub struct Model {
pub compression: String,
/// The remote file backing this NAR.
///
/// Currently we only support S3-compatible providers, though it
/// should be easy to add in support for other forms of object storage
/// or even local storage.
pub remote_file: Json<RemoteFile>,
/// Unique string identifying the remote file.
@ -104,7 +100,7 @@ pub struct Model {
///
/// This is for preventing garbage collection of NARs when
/// there is a pending upload that can be deduplicated and
/// there is no existing object references.
/// there are no existing object references.
pub holders_count: i32,
/// Timestamp when the NAR is created.