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-ds-flatfs
Commits
34bf8ae6
Commit
34bf8ae6
authored
Feb 14, 2020
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: wrap invalid key error on put
parent
4ca877d4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
flatfs.go
flatfs.go
+3
-2
No files found.
flatfs.go
View file @
34bf8ae6
...
...
@@ -95,6 +95,7 @@ var (
ErrDatastoreDoesNotExist
=
errors
.
New
(
"datastore directory does not exist"
)
ErrShardingFileMissing
=
fmt
.
Errorf
(
"%s file not found in datastore"
,
SHARDING_FN
)
ErrClosed
=
errors
.
New
(
"datastore closed"
)
ErrInvalidKey
=
errors
.
New
(
"key not supported by flatfs"
)
)
func
init
()
{
...
...
@@ -362,7 +363,7 @@ var putMaxRetries = 6
// will win.
func
(
fs
*
Datastore
)
Put
(
key
datastore
.
Key
,
value
[]
byte
)
error
{
if
!
keyIsValid
(
key
)
{
return
fmt
.
Errorf
(
"
key not supported by flatfs: '%q'"
,
k
ey
)
return
fmt
.
Errorf
(
"
when putting '%q': %w"
,
key
,
ErrInvalidK
ey
)
}
fs
.
shutdownLock
.
RLock
()
...
...
@@ -1138,7 +1139,7 @@ func (fs *Datastore) Batch() (datastore.Batch, error) {
func
(
bt
*
flatfsBatch
)
Put
(
key
datastore
.
Key
,
val
[]
byte
)
error
{
if
!
keyIsValid
(
key
)
{
return
fmt
.
Errorf
(
"
key not supported by flatfs: '%q'"
,
k
ey
)
return
fmt
.
Errorf
(
"
when putting '%q': %w"
,
key
,
ErrInvalidK
ey
)
}
bt
.
puts
[
key
]
=
val
return
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