-
Notifications
You must be signed in to change notification settings - Fork 377
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1185 from vrothberg/pull-improvements
copy to storage: commit layers as early as possible
- Loading branch information
Showing
3 changed files
with
348 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package types | ||
|
||
import ( | ||
"context" | ||
"io" | ||
|
||
publicTypes "github.com/containers/image/v5/types" | ||
) | ||
|
||
// ImageDestinationWithOptions is an internal extension to the ImageDestination | ||
// interface. | ||
type ImageDestinationWithOptions interface { | ||
publicTypes.ImageDestination | ||
|
||
// PutBlobWithOptions is a wrapper around PutBlob. If | ||
// options.LayerIndex is set, the blob will be committed directly. | ||
// Either by the calling goroutine or by another goroutine already | ||
// committing layers. | ||
// | ||
// Please note that TryReusingBlobWithOptions and PutBlobWithOptions | ||
// *must* be used the together. Mixing the two with non "WithOptions" | ||
// functions is not supported. | ||
PutBlobWithOptions(ctx context.Context, stream io.Reader, blobinfo publicTypes.BlobInfo, options PutBlobOptions) (publicTypes.BlobInfo, error) | ||
|
||
// TryReusingBlobWithOptions is a wrapper around TryReusingBlob. If | ||
// options.LayerIndex is set, the reused blob will be recoreded as | ||
// already pulled. | ||
// | ||
// Please note that TryReusingBlobWithOptions and PutBlobWithOptions | ||
// *must* be used the together. Mixing the two with non "WithOptions" | ||
// functions is not supported. | ||
TryReusingBlobWithOptions(ctx context.Context, blobinfo publicTypes.BlobInfo, options TryReusingBlobOptions) (bool, publicTypes.BlobInfo, error) | ||
} | ||
|
||
// PutBlobOptions are used in PutBlobWithOptions. | ||
type PutBlobOptions struct { | ||
// Cache to look up blob infos. | ||
Cache publicTypes.BlobInfoCache | ||
// Denotes whether the blob is a config or not. | ||
IsConfig bool | ||
// The corresponding index in the layer slice. | ||
LayerIndex *int | ||
} | ||
|
||
// TryReusingBlobOptions are used in TryReusingBlobWithOptions. | ||
type TryReusingBlobOptions struct { | ||
// Cache to look up blob infos. | ||
Cache publicTypes.BlobInfoCache | ||
// Use an equivalent of the desired blob. | ||
CanSubstitute bool | ||
// The corresponding index in the layer slice. | ||
LayerIndex *int | ||
} |
Oops, something went wrong.