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-datastore
Commits
4d340af8
Commit
4d340af8
authored
Jun 28, 2016
by
Jeromy Johnson
Committed by
GitHub
Jun 28, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #41 from ipfs/fix/omit-slash
omit slash from created dskeys
parents
7a618be1
f098817c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
flatfs/flatfs.go
flatfs/flatfs.go
+3
-2
flatfs/flatfs_test.go
flatfs/flatfs_test.go
+1
-1
No files found.
flatfs/flatfs.go
View file @
4d340af8
...
...
@@ -56,9 +56,10 @@ func New(path string, prefixLen int, sync bool) (*Datastore, error) {
var
padding
=
strings
.
Repeat
(
"_"
,
maxPrefixLen
)
func
(
fs
*
Datastore
)
encode
(
key
datastore
.
Key
)
(
dir
,
file
string
)
{
prefix
:=
(
key
.
String
()
+
padding
)[
:
fs
.
prefixLen
]
noslash
:=
key
.
String
()[
1
:
]
prefix
:=
(
noslash
+
padding
)[
:
fs
.
prefixLen
]
dir
=
path
.
Join
(
fs
.
path
,
prefix
)
file
=
path
.
Join
(
dir
,
key
.
String
()
+
extension
)
file
=
path
.
Join
(
dir
,
noslash
+
extension
)
return
dir
,
file
}
...
...
flatfs/flatfs_test.go
View file @
4d340af8
...
...
@@ -152,7 +152,7 @@ func TestStorage(t *testing.T) {
defer
cleanup
()
const
prefixLen
=
2
const
prefix
=
"q"
const
prefix
=
"q
u
"
const
target
=
prefix
+
string
(
os
.
PathSeparator
)
+
"quux.data"
fs
,
err
:=
flatfs
.
New
(
temp
,
prefixLen
,
false
)
if
err
!=
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