Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3-chunker
Commits
449ca440
Commit
449ca440
authored
Sep 29, 2018
by
Kejie Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add check chunker size
parent
6a392e12
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
parse.go
parse.go
+6
-1
No files found.
parse.go
View file @
449ca440
...
...
@@ -8,7 +8,10 @@ import (
"strings"
)
var
ErrRabinMin
=
errors
.
New
(
"rabin min must be greater than 16"
)
var
(
ErrRabinMin
=
errors
.
New
(
"rabin min must be greater than 16"
)
ErrSize
=
errors
.
New
(
"chunker size muster greater than 0"
)
)
// FromString returns a Splitter depending on the given string:
// it supports "default" (""), "size-{size}", "rabin", "rabin-{blocksize}" and
...
...
@@ -23,6 +26,8 @@ func FromString(r io.Reader, chunker string) (Splitter, error) {
size
,
err
:=
strconv
.
Atoi
(
sizeStr
)
if
err
!=
nil
{
return
nil
,
err
}
else
if
size
<=
0
{
return
nil
,
ErrSize
}
return
NewSizeSplitter
(
r
,
int64
(
size
)),
nil
...
...
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