AppManager: App installation status monitoring
Change-Id: I64f4ae0d27892b74f8827a275907cb75da09a758
diff --git a/core/installer/status/instance.go b/core/installer/status/instance.go
new file mode 100644
index 0000000..285f68c
--- /dev/null
+++ b/core/installer/status/instance.go
@@ -0,0 +1,28 @@
+package status
+
+type InstanceMonitor struct {
+ m Monitor
+ instances map[string][]Resource
+}
+
+func NewInstanceMonitor(m Monitor) *InstanceMonitor {
+ return &InstanceMonitor{
+ m: m,
+ instances: map[string][]Resource{},
+ }
+}
+
+func (m *InstanceMonitor) Monitor(id string, resources []Resource) {
+ m.instances[id] = resources
+}
+
+func (m *InstanceMonitor) Get(id string) (ret map[Resource]Status, err error) {
+ ret = map[Resource]Status{}
+ for _, r := range m.instances[id] {
+ ret[r], err = m.m.Get(r)
+ if err != nil {
+ break
+ }
+ }
+ return
+}