Add support for content labels on commit
Add commit options which allow for setting labels on commit. Prevents potential race between garbage collector reading labels after commit and labels getting set. Signed-off-by: Derek McGowan <derek@mcgstyle.net>
This commit is contained in:
@@ -90,7 +90,7 @@ type Writer interface {
|
||||
|
||||
// Commit commits the blob (but no roll-back is guaranteed on an error).
|
||||
// size and expected can be zero-value when unknown.
|
||||
Commit(size int64, expected digest.Digest) error
|
||||
Commit(size int64, expected digest.Digest, opts ...Opt) error
|
||||
|
||||
// Status returns the current state of write
|
||||
Status() (Status, error)
|
||||
@@ -107,3 +107,13 @@ type Store interface {
|
||||
IngestManager
|
||||
Ingester
|
||||
}
|
||||
|
||||
// Opt is used to alter the mutable properties of content
|
||||
type Opt func(*Info) error
|
||||
|
||||
func WithLabels(labels map[string]string) Opt {
|
||||
return func(info *Info) error {
|
||||
info.Labels = labels
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user