Skip to content

Commit f7c0791

Browse files
[PSL-1216] optimize multi-volume registration
1 parent 8e6b576 commit f7c0791

File tree

25 files changed

+45099
-46221
lines changed

25 files changed

+45099
-46221
lines changed

walletnode/api/design/cascade.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ var _ = Service("cascade", func() {
173173
Payload(func() {
174174
Extend(DownloadTaskStatePayload)
175175
})
176-
Result(ArrayOf(TaskHistory))
176+
Result(DownloadTaskStatus)
177177

178178
HTTP(func() {
179179
GET("/downloads/{file_id}/status")

walletnode/api/design/common.go

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ var RegisterTaskPayload = Type("RegisterTaskPayload", func() {
7272
var DownloadTaskStatePayload = Type("DownloadTaskStatePayload", func() {
7373
Attribute("file_id", String, "File ID returned by Download V2 API", func() {
7474
TypeName("file_id")
75-
MinLength(8)
76-
MaxLength(8)
75+
MinLength(6)
76+
MaxLength(6)
7777
Example("n6Qn6TFM")
7878
})
7979
Required("file_id")
@@ -128,6 +128,62 @@ var TaskHistory = Type("TaskHistory", func() {
128128
Required("status")
129129
})
130130

131+
// DownloadTaskStatus is status of the download task
132+
var DownloadTaskStatus = Type("DownloadTaskStatus", func() {
133+
Attribute("total_volumes", Int, func() {
134+
Description("Total Volumes")
135+
Example(1)
136+
})
137+
138+
Attribute("downloaded_volumes", Int, func() {
139+
Description("Number of volumes successfully downloaded")
140+
Example(1)
141+
})
142+
143+
Attribute("volumes_download_in_progress", Int, func() {
144+
Description("Number of volumes currently being downloaded")
145+
Example(1)
146+
})
147+
148+
Attribute("volumes_pending_download", Int, func() {
149+
Description("Number of volumes awaiting schedule")
150+
Example(1)
151+
})
152+
153+
Attribute("volumes_download_failed", Int, func() {
154+
Description("Number of volumes failed to download")
155+
Example(1)
156+
})
157+
158+
Attribute("task_status", String, func() {
159+
Description("Status of the operation")
160+
Example("In Progress")
161+
Enum("Completed", "Failed", "In Progress")
162+
})
163+
164+
Attribute("size_of_the_file_megabytes", Int, func() {
165+
Description("size of the file in megabytes")
166+
Example(1)
167+
})
168+
169+
Attribute("data_downloaded_megabytes", Int, func() {
170+
Description("data downloaded in megabytes so far")
171+
Example(1)
172+
})
173+
174+
Attribute("message", String, func() {
175+
Description("message string (if any)")
176+
Example("Balance less than maximum fee provied in the request, could not gather enough confirmations...")
177+
})
178+
179+
Attribute("details", Details, func() {
180+
Description("details of the status")
181+
})
182+
183+
Required("total_volumes", "downloaded_volumes", "volumes_download_in_progress", "volumes_download_failed", "task_status", "details",
184+
"volumes_pending_download", "size_of_the_file_megabytes", "data_downloaded_megabytes")
185+
})
186+
131187
// ActionDetailsResult - result of posting action details
132188
var ActionDetailsResult = ResultType("application/sense.start-action", func() {
133189
TypeName("actionDetailResult")

walletnode/api/gen/cascade/client.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

walletnode/api/gen/cascade/service.go

Lines changed: 26 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

walletnode/api/gen/http/cascade/client/cli.go

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

walletnode/api/gen/http/cascade/client/encode_decode.go

Lines changed: 20 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)