Make Storage Driver API calls context aware.
- Change driver interface to take a context as its first argument - Make newFileReader take a context as its first argument - Make newFileWriter take a context as its first argument - Make blobstore exists and delete take a context as a first argument - Pass the layerreader's context to the storage layer - Pass the app's context to purgeuploads - Store the app's context into the blobstore (was previously null) - Pass the trace'd context to the storage drivers Signed-off-by: Richard Scothern <richard.scothern@gmail.com>
This commit is contained in:
parent
c0d297c011
commit
5d9105bd25
30 changed files with 383 additions and 343 deletions
|
@ -4,6 +4,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/docker/distribution/context"
|
||||
storageDriver "github.com/docker/distribution/registry/storage/driver"
|
||||
)
|
||||
|
||||
|
@ -20,13 +21,13 @@ type WalkFn func(fileInfo storageDriver.FileInfo) error
|
|||
|
||||
// Walk traverses a filesystem defined within driver, starting
|
||||
// from the given path, calling f on each file
|
||||
func Walk(driver storageDriver.StorageDriver, from string, f WalkFn) error {
|
||||
children, err := driver.List(from)
|
||||
func Walk(ctx context.Context, driver storageDriver.StorageDriver, from string, f WalkFn) error {
|
||||
children, err := driver.List(ctx, from)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, child := range children {
|
||||
fileInfo, err := driver.Stat(child)
|
||||
fileInfo, err := driver.Stat(ctx, child)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -37,7 +38,7 @@ func Walk(driver storageDriver.StorageDriver, from string, f WalkFn) error {
|
|||
}
|
||||
|
||||
if fileInfo.IsDir() && !skipDir {
|
||||
Walk(driver, child, f)
|
||||
Walk(ctx, driver, child, f)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue