numtide / nar-serve

Unpack and serve NAR file content on the fly
Apache License 2.0
32 stars 8 forks source link

Implement request merging #10

Open zimbatm opened 4 years ago

zimbatm commented 4 years ago

When multiple clients access the same NAR file at the same time, we could download the file from the S3 bucket only once.

  1. Add a concurrent lock on a per-derivation hash basis.
  2. Associate the NAR stream to the lock.
type CachedBinaryCacheReader struct {
  Reader BinaryCacheReader
  Lock map[string]io.ReaderCloser
  Mutex sync.Mutex
}

func (r CachedBinaryCacheReader) GetFile(ctx context.Context, path string) (io.ReadCloser, error) {

}
stv0g commented 8 months ago

Duplicate of #4?