Bound restore and publication verification downloads

This commit is contained in:
2026-12-01 20:28:13 +00:00
parent 6f5464615e
commit 59813b72fa
15 changed files with 211 additions and 37 deletions

View File

@@ -17,12 +17,13 @@ import (
// S3MaterializeRequest describes one S3-backed audio materialization.
type S3MaterializeRequest struct {
Reporter logging.Reporter
Store storage.ObjectStore
Object storage.ObjectInfo
Bucket string
DestPath string
Prior *manifest.InputRecord
Reporter logging.Reporter
Store storage.ObjectStore
Object storage.ObjectInfo
Bucket string
DestPath string
Prior *manifest.InputRecord
ExpectedSize *int64
}
type S3MaterializeResult struct {
@@ -66,7 +67,7 @@ func MaterializeS3Audio(ctx context.Context, req S3MaterializeRequest) (S3Materi
}
}
}
observed, err := downloadObjectAtomic(ctx, req.Store, key, req.DestPath, req.Reporter)
observed, err := downloadObjectAtomic(ctx, req.Store, key, req.DestPath, req.ExpectedSize, req.Reporter)
if err != nil {
return S3MaterializeResult{}, fmt.Errorf("download s3 audio object %q: %w", key, err)
}
@@ -94,14 +95,14 @@ func validateLocalAudio(path string, expectedSize int64) error {
return nil
}
func downloadObjectAtomic(ctx context.Context, store storage.ObjectStore, key, destPath string, reporter logging.Reporter) (storage.ObjectInfo, error) {
func downloadObjectAtomic(ctx context.Context, store storage.ObjectStore, key, destPath string, expected *int64, reporter logging.Reporter) (storage.ObjectInfo, error) {
var observed storage.ObjectInfo
temporaryPath, err := writeAudioTemp(destPath, func(destination io.Writer) error {
if reporter != nil {
reporter.Progress("downloading audio", "audio", filepath.Base(destPath))
}
var streamErr error
observed, streamErr = storage.StreamObject(ctx, store, key, destination, nil)
observed, streamErr = storage.StreamObject(ctx, store, key, destination, expected)
return streamErr
})
if err != nil {