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
ebb0ecaf
Commit
ebb0ecaf
authored
Mar 15, 2018
by
Dominic Della Valle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change go-os-rename to standard
Since Go 1.5, os.Rename is consistent across platforms
parent
542131a8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
12 deletions
+4
-12
convert.go
convert.go
+2
-3
flatfs.go
flatfs.go
+2
-3
package.json
package.json
+0
-6
No files found.
convert.go
View file @
ebb0ecaf
...
...
@@ -13,7 +13,6 @@ import (
"github.com/ipfs/go-datastore"
"github.com/ipfs/go-datastore/query"
"github.com/jbenet/go-os-rename"
)
func
UpgradeV0toV1
(
path
string
,
prefixLen
int
)
error
{
...
...
@@ -152,7 +151,7 @@ func Move(oldPath string, newPath string, out io.Writer) error {
// else we found something unexpected, so to be safe just move it
log
.
Warningf
(
"found unexpected file in datastore directory:
\"
%s
\"
, moving anyway
\n
"
,
fn
)
newPath
:=
filepath
.
Join
(
newDS
.
path
,
fn
)
err
:=
os
rename
.
Rename
(
oldPath
,
newPath
)
err
:=
os
.
Rename
(
oldPath
,
newPath
)
if
err
!=
nil
{
return
err
}
...
...
@@ -173,7 +172,7 @@ func moveKey(oldDS *Datastore, newDS *Datastore, key datastore.Key) error {
if
err
!=
nil
{
return
err
}
err
=
os
rename
.
Rename
(
oldPath
,
newPath
)
err
=
os
.
Rename
(
oldPath
,
newPath
)
if
err
!=
nil
{
return
err
}
...
...
flatfs.go
View file @
ebb0ecaf
...
...
@@ -19,7 +19,6 @@ import (
"github.com/ipfs/go-datastore"
"github.com/ipfs/go-datastore/query"
"github.com/jbenet/go-os-rename"
logging
"github.com/ipfs/go-log"
)
...
...
@@ -286,7 +285,7 @@ func (fs *Datastore) renameAndUpdateDiskUsage(tmpPath, path string) error {
// Rename and add new file's diskUsage. If the rename fails,
// it will either a) Re-add the size of an existing file, which
// was sustracted before b) Add 0 if there is no existing file.
err
=
os
rename
.
Rename
(
tmpPath
,
path
)
err
=
os
.
Rename
(
tmpPath
,
path
)
fs
.
updateDiskUsage
(
path
,
true
)
return
err
}
...
...
@@ -779,7 +778,7 @@ func (fs *Datastore) persistDiskUsageFile() {
return
}
os
rename
.
Rename
(
tmp
.
Name
(),
filepath
.
Join
(
fs
.
path
,
DiskUsageFile
))
os
.
Rename
(
tmp
.
Name
(),
filepath
.
Join
(
fs
.
path
,
DiskUsageFile
))
}
func
(
fs
*
Datastore
)
readDiskUsageFile
()
int64
{
...
...
package.json
View file @
ebb0ecaf
...
...
@@ -12,12 +12,6 @@
"name"
:
"go-log"
,
"version"
:
"1.4.0"
},
{
"author"
:
"jbenet"
,
"hash"
:
"QmaeRR9SpXumU5tYLRkq6x6pfMe8qKzxn4ujBpsTJ2zQG7"
,
"name"
:
"go-os-rename"
,
"version"
:
"0.0.0"
},
{
"author"
:
"jbenet"
,
"hash"
:
"QmeiCcJfDW1GJnWUArudsv5rQsihpi4oyddPhdqo3CfX6i"
,
...
...
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