Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
dc77bbcf
Unverified
Commit
dc77bbcf
authored
Jul 31, 2024
by
Blake Mizerany
Committed by
GitHub
Jul 31, 2024
Browse files
server: fix json marshalling of downloadBlobPart (#6108)
parent
c4c84b7a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
server/download.go
server/download.go
+30
-0
No files found.
server/download.go
View file @
dc77bbcf
...
...
@@ -61,6 +61,36 @@ type blobDownloadPart struct {
*
blobDownload
`json:"-"`
}
type
jsonBlobDownloadPart
struct
{
N
int
Offset
int64
Size
int64
Completed
int64
}
func
(
p
*
blobDownloadPart
)
MarshalJSON
()
([]
byte
,
error
)
{
return
json
.
Marshal
(
jsonBlobDownloadPart
{
N
:
p
.
N
,
Offset
:
p
.
Offset
,
Size
:
p
.
Size
,
Completed
:
p
.
Completed
.
Load
(),
})
}
func
(
p
*
blobDownloadPart
)
UnmarshalJSON
(
b
[]
byte
)
error
{
var
j
jsonBlobDownloadPart
if
err
:=
json
.
Unmarshal
(
b
,
&
j
);
err
!=
nil
{
return
err
}
*
p
=
blobDownloadPart
{
N
:
j
.
N
,
Offset
:
j
.
Offset
,
Size
:
j
.
Size
,
}
p
.
Completed
.
Store
(
j
.
Completed
)
return
nil
}
const
(
numDownloadParts
=
64
minDownloadPartSize
int64
=
100
*
format
.
MegaByte
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment