Add snapshotter key to snapshot events

Consumers of snapshot events require the snapshotter
field to refer to the related snapshot.

Signed-off-by: Derek McGowan <derek@mcg.dev>
This commit is contained in:
Derek McGowan
2022-06-20 18:09:15 -07:00
parent b56cac143a
commit 4ac1031e0c
5 changed files with 90 additions and 24 deletions

View File

@@ -13,6 +13,8 @@ func (m *SnapshotPrepare) Field(fieldpath []string) (string, bool) {
return string(m.Key), len(m.Key) > 0
case "parent":
return string(m.Parent), len(m.Parent) > 0
case "snapshotter":
return string(m.Snapshotter), len(m.Snapshotter) > 0
}
return "", false
}
@@ -28,6 +30,8 @@ func (m *SnapshotCommit) Field(fieldpath []string) (string, bool) {
return string(m.Key), len(m.Key) > 0
case "name":
return string(m.Name), len(m.Name) > 0
case "snapshotter":
return string(m.Snapshotter), len(m.Snapshotter) > 0
}
return "", false
}
@@ -41,6 +45,8 @@ func (m *SnapshotRemove) Field(fieldpath []string) (string, bool) {
switch fieldpath[0] {
case "key":
return string(m.Key), len(m.Key) > 0
case "snapshotter":
return string(m.Snapshotter), len(m.Snapshotter) > 0
}
return "", false
}