summaryrefslogtreecommitdiff
path: root/pkg/domain/entities
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/domain/entities')
-rw-r--r--pkg/domain/entities/engine_image.go2
-rw-r--r--pkg/domain/entities/images.go61
-rw-r--r--pkg/domain/entities/set.go45
3 files changed, 68 insertions, 40 deletions
diff --git a/pkg/domain/entities/engine_image.go b/pkg/domain/entities/engine_image.go
index 27676d781..d44fdaf53 100644
--- a/pkg/domain/entities/engine_image.go
+++ b/pkg/domain/entities/engine_image.go
@@ -7,6 +7,6 @@ import (
type ImageEngine interface {
Delete(ctx context.Context, nameOrId string, opts ImageDeleteOptions) (*ImageDeleteReport, error)
History(ctx context.Context, nameOrId string, opts ImageHistoryOptions) (*ImageHistoryReport, error)
- List(ctx context.Context, opts ImageListOptions) (*ImageListReport, error)
+ List(ctx context.Context, opts ImageListOptions) ([]*ImageSummary, error)
Prune(ctx context.Context, opts ImagePruneOptions) (*ImagePruneReport, error)
}
diff --git a/pkg/domain/entities/images.go b/pkg/domain/entities/images.go
index f18ee2651..f04317e37 100644
--- a/pkg/domain/entities/images.go
+++ b/pkg/domain/entities/images.go
@@ -48,22 +48,24 @@ func (i *Image) Id() string {
}
type ImageSummary struct {
- Identifier
- ID string `json:"Id"`
- ParentId string `json:",omitempty"`
- RepoTags []string `json:",omitempty"`
- Created int `json:",omitempty"`
- Size int `json:",omitempty"`
- SharedSize int `json:",omitempty"`
- VirtualSize int `json:",omitempty"`
- Labels string `json:",omitempty"`
- Containers int `json:",omitempty"`
- ReadOnly bool `json:",omitempty"`
- Dangling bool `json:",omitempty"`
+ ID string `json:"Id"`
+ ParentId string `json:",omitempty"`
+ RepoTags []string `json:",omitempty"`
+ Created int64 `json:",omitempty"`
+ Size int64 `json:",omitempty"`
+ SharedSize int `json:",omitempty"`
+ VirtualSize int64 `json:",omitempty"`
+ Labels map[string]string `json:",omitempty"`
+ Containers int `json:",omitempty"`
+ ReadOnly bool `json:",omitempty"`
+ Dangling bool `json:",omitempty"`
// Podman extensions
- Digest digest.Digest `json:",omitempty"`
- ConfigDigest digest.Digest `json:",omitempty"`
+ Names []string `json:",omitempty"`
+ Digest string `json:",omitempty"`
+ Digests []string `json:",omitempty"`
+ ConfigDigest string `json:",omitempty"`
+ History []string `json:",omitempty"`
}
func (i *ImageSummary) Id() string {
@@ -78,18 +80,6 @@ func (i *ImageSummary) IsDangling() bool {
return i.Dangling
}
-type ImageOptions struct {
- All bool
- Digests bool
- Filter []string
- Format string
- Noheading bool
- NoTrunc bool
- Quiet bool
- Sort string
- History bool
-}
-
type ImageDeleteOptions struct {
Force bool
}
@@ -124,21 +114,14 @@ type ImageInspectOptions struct {
}
type ImageListOptions struct {
- All bool `json:"all" schema:"all"`
- Digests bool `json:"digests" schema:"digests"`
- Filter []string `json:",omitempty"`
- Filters url.Values `json:"filters" schema:"filters"`
- Format string `json:",omitempty"`
- History bool `json:",omitempty"`
- Noheading bool `json:",omitempty"`
- NoTrunc bool `json:",omitempty"`
- Quiet bool `json:",omitempty"`
- Sort string `json:",omitempty"`
+ All bool `json:"all" schema:"all"`
+ Filter []string `json:",omitempty"`
+ Filters url.Values `json:"filters" schema:"filters"`
}
-type ImageListReport struct {
- Images []ImageSummary
-}
+// type ImageListReport struct {
+// Images []ImageSummary
+// }
type ImagePruneOptions struct {
All bool
diff --git a/pkg/domain/entities/set.go b/pkg/domain/entities/set.go
new file mode 100644
index 000000000..c8d6cb1a9
--- /dev/null
+++ b/pkg/domain/entities/set.go
@@ -0,0 +1,45 @@
+package entities
+
+import (
+ "strings"
+)
+
+type stringSet struct {
+ m map[string]struct{}
+}
+
+func NewStringSet(elem ...string) *stringSet {
+ s := &stringSet{}
+ s.m = make(map[string]struct{}, len(elem))
+ for _, e := range elem {
+ s.Add(e)
+ }
+ return s
+}
+
+func (s *stringSet) Add(elem string) {
+ s.m[elem] = struct{}{}
+}
+
+func (s *stringSet) Remove(elem string) {
+ delete(s.m, elem)
+}
+
+func (s *stringSet) Contains(elem string) bool {
+ _, ok := s.m[elem]
+ return ok
+}
+
+func (s *stringSet) Elements() []string {
+ keys := make([]string, len(s.m))
+ i := 0
+ for k := range s.m {
+ keys[i] = k
+ i++
+ }
+ return keys
+}
+
+func (s *stringSet) String() string {
+ return strings.Join(s.Elements(), ", ")
+}