Merge lp:~sergiusens/snapweb/sizeSupport into lp:~snappy-dev/snapweb/trunk

Proposed by Sergio Schvezov on 2015-05-03
Status: Merged
Approved by: John Lenton on 2015-05-05
Approved revision: 117
Merged at revision: 111
Proposed branch: lp:~sergiusens/snapweb/sizeSupport
Merge into: lp:~snappy-dev/snapweb/trunk
Prerequisite: lp:~sergiusens/snapweb/golint
Diff against target: 135 lines (+48/-10)
3 files modified
snappy/common_test.go (+16/-0)
snappy/converge.go (+14/-10)
snappy/converge_test.go (+18/-0)
To merge this branch: bzr merge lp:~sergiusens/snapweb/sizeSupport
Reviewer Review Type Date Requested Status
John Lenton 2015-05-03 Approve on 2015-05-05
Stephen Stewart (community) 2015-05-03 Approve on 2015-05-05
Review via email: mp+258144@code.launchpad.net

This proposal supersedes a proposal from 2015-05-03.

Commit Message

Add size reporting support

To post a comment you must log in.
lp:~sergiusens/snapweb/sizeSupport updated on 2015-05-03
116. By Sergio Schvezov on 2015-05-03

adding some extra magic to size stub

John Lenton (chipaca) wrote :

lgtm, fwiw

lp:~sergiusens/snapweb/sizeSupport updated on 2015-05-03
117. By Sergio Schvezov on 2015-05-03

Adding readbility space

Stephen Stewart (stephen-stewart) wrote :

17:31 < sergiusens> beowulf: btw, that was the outcome from size support?
[...]
17:36 < beowulf> sergiusens: about adding it to the store or using it as is? adding to the store i can talk to beuno about tomorrow, though i think he's already aware
17:38 < sergiusens> beowulf: can you comment on my MP then so we don't lose this info; if it's fine as it is now, let's just get that in and add a work item
17:38 < beowulf> sergiusens: using it as is is fine, it'll just be a little inconsistent around the edges of installing
[..]
17:38 < beowulf> sergiusens: ack

review: Approve
John Lenton (chipaca) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'snappy/common_test.go'
2--- snappy/common_test.go 2015-05-03 19:54:18 +0000
3+++ snappy/common_test.go 2015-05-03 22:05:46 +0000
4@@ -87,6 +87,22 @@
5 return p.installed
6 }
7
8+func (p fakeSnappyPart) InstalledSize() int64 {
9+ if p.installed {
10+ return 30
11+ }
12+
13+ return -1
14+}
15+
16+func (p fakeSnappyPart) DownloadSize() int64 {
17+ if !p.installed {
18+ return 60
19+ }
20+
21+ return -1
22+}
23+
24 func (p fakeSnappyPart) Name() string {
25 return p.name
26 }
27
28=== modified file 'snappy/converge.go'
29--- snappy/converge.go 2015-05-03 20:35:34 +0000
30+++ snappy/converge.go 2015-05-03 22:05:46 +0000
31@@ -28,16 +28,18 @@
32 )
33
34 type snapPkg struct {
35- Name string `json:"name"`
36- Origin string `json:"origin"`
37- Version string `json:"version"`
38- Icon string `json:"icon"`
39- Status string `json:"status"`
40- Message string `json:"message,omitempty"`
41- Progress float64 `json:"progress,omitempty"`
42- Type snappy.SnapType `json:"type,omitempty"`
43- UIPort uint64 `json:"ui_port,omitempty"`
44- UIUri string `json:"ui_uri,omitempty"`
45+ Name string `json:"name"`
46+ Origin string `json:"origin"`
47+ Version string `json:"version"`
48+ Icon string `json:"icon"`
49+ Status string `json:"status"`
50+ Message string `json:"message,omitempty"`
51+ Progress float64 `json:"progress,omitempty"`
52+ InstalledSize int64 `json:"installed_size,omitempty"`
53+ DownloadSize int64 `json:"download_size,omitempty"`
54+ Type snappy.SnapType `json:"type,omitempty"`
55+ UIPort uint64 `json:"ui_port,omitempty"`
56+ UIUri string `json:"ui_uri,omitempty"`
57 }
58
59 type response struct {
60@@ -180,8 +182,10 @@
61 }
62
63 snap.Icon = iconPath
64+ snap.InstalledSize = snapQ.InstalledSize()
65 } else {
66 snap.Icon = snapQ.Icon()
67+ snap.DownloadSize = snapQ.DownloadSize()
68 }
69
70 if stat, ok := h.installStatus.Get(snap.Name); ok {
71
72=== modified file 'snappy/converge_test.go'
73--- snappy/converge_test.go 2015-05-03 20:35:34 +0000
74+++ snappy/converge_test.go 2015-05-03 22:05:46 +0000
75@@ -169,14 +169,20 @@
76 c.Check(snaps[0].Name, Equals, "app1.canonical")
77 c.Check(snaps[0].Version, Equals, "1.0")
78 c.Check(snaps[0].Status, Equals, webprogress.StatusInstalled)
79+ c.Check(snaps[0].InstalledSize, Equals, int64(30))
80+ c.Check(snaps[0].DownloadSize, Equals, int64(0))
81
82 c.Check(snaps[1].Name, Equals, "app2.canonical")
83 c.Check(snaps[1].Version, Equals, "2.0")
84 c.Check(snaps[1].Status, Equals, webprogress.StatusInstalled)
85+ c.Check(snaps[1].InstalledSize, Equals, int64(30))
86+ c.Check(snaps[1].DownloadSize, Equals, int64(0))
87
88 c.Check(snaps[2].Name, Equals, "app3.canonical")
89 c.Check(snaps[2].Version, Equals, "3.0")
90 c.Check(snaps[2].Status, Equals, webprogress.StatusInstalled)
91+ c.Check(snaps[2].InstalledSize, Equals, int64(30))
92+ c.Check(snaps[2].DownloadSize, Equals, int64(0))
93
94 // Installed and remotes
95 snaps = mergeSnaps(installed, remotes, false)
96@@ -186,18 +192,26 @@
97 c.Check(snaps[0].Name, Equals, "app1.canonical")
98 c.Check(snaps[0].Version, Equals, "1.0")
99 c.Check(snaps[0].Status, Equals, webprogress.StatusInstalled)
100+ c.Check(snaps[0].InstalledSize, Equals, int64(30))
101+ c.Check(snaps[0].DownloadSize, Equals, int64(0))
102
103 c.Check(snaps[1].Name, Equals, "app2.canonical")
104 c.Check(snaps[1].Version, Equals, "2.0")
105 c.Check(snaps[1].Status, Equals, webprogress.StatusInstalled)
106+ c.Check(snaps[1].InstalledSize, Equals, int64(30))
107+ c.Check(snaps[1].DownloadSize, Equals, int64(0))
108
109 c.Check(snaps[2].Name, Equals, "app3.canonical")
110 c.Check(snaps[2].Version, Equals, "3.0")
111 c.Check(snaps[2].Status, Equals, webprogress.StatusInstalled)
112+ c.Check(snaps[2].InstalledSize, Equals, int64(30))
113+ c.Check(snaps[2].DownloadSize, Equals, int64(0))
114
115 c.Check(snaps[3].Name, Equals, "app3.ubuntu")
116 c.Check(snaps[3].Version, Equals, "3.0")
117 c.Check(snaps[3].Status, Equals, webprogress.StatusUninstalled)
118+ c.Check(snaps[3].InstalledSize, Equals, int64(0))
119+ c.Check(snaps[3].DownloadSize, Equals, int64(60))
120 }
121
122 func (s *MergeSuite) TestManyInstalledAndManyRemotesSomeInstalling(c *C) {
123@@ -235,8 +249,12 @@
124 c.Check(snaps[3].Name, Equals, "app4.ubuntu")
125 c.Check(snaps[3].Version, Equals, "2.0")
126 c.Check(snaps[3].Status, Equals, webprogress.StatusInstalling)
127+ c.Check(snaps[3].InstalledSize, Equals, int64(0))
128+ c.Check(snaps[3].DownloadSize, Equals, int64(60))
129
130 c.Check(snaps[4].Name, Equals, "app5.ubuntu")
131 c.Check(snaps[4].Version, Equals, "3.0")
132 c.Check(snaps[4].Status, Equals, webprogress.StatusUninstalled)
133+ c.Check(snaps[4].InstalledSize, Equals, int64(0))
134+ c.Check(snaps[4].DownloadSize, Equals, int64(60))
135 }

Subscribers

People subscribed via source and target branches