Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
go-sectorbuilder
Commits
2290bd99
Commit
2290bd99
authored
Jan 29, 2020
by
Łukasz Magiera
Browse files
Don't move sector when don't need to
parent
3838f81f
Changes
1
Hide whitespace changes
Inline
Side-by-side
fs/fs.go
View file @
2290bd99
...
@@ -223,7 +223,7 @@ func (f *FS) ForceAllocSector(typ DataType, miner address.Address, ssize uint64,
...
@@ -223,7 +223,7 @@ func (f *FS) ForceAllocSector(typ DataType, miner address.Address, ssize uint64,
if
err
!=
nil
{
if
err
!=
nil
{
return
""
,
xerrors
.
Errorf
(
"looking for existing sector data: %w"
,
err
)
return
""
,
xerrors
.
Errorf
(
"looking for existing sector data: %w"
,
err
)
}
}
log
.
Warn
(
"found existing sector data in %s, cleaning up"
,
spath
)
log
.
Warn
f
(
"found existing sector data in %s, cleaning up"
,
spath
)
if
err
:=
os
.
RemoveAll
(
string
(
spath
));
err
!=
nil
{
if
err
:=
os
.
RemoveAll
(
string
(
spath
));
err
!=
nil
{
return
""
,
xerrors
.
Errorf
(
"cleaning up sector data: %w"
,
err
)
return
""
,
xerrors
.
Errorf
(
"cleaning up sector data: %w"
,
err
)
...
@@ -275,6 +275,10 @@ func (f *FS) PrepareCacheMove(sector SectorPath, ssize uint64, tocache bool) (Se
...
@@ -275,6 +275,10 @@ func (f *FS) PrepareCacheMove(sector SectorPath, ssize uint64, tocache bool) (Se
}
}
func
(
f
*
FS
)
MoveSector
(
from
,
to
SectorPath
)
error
{
func
(
f
*
FS
)
MoveSector
(
from
,
to
SectorPath
)
error
{
if
from
==
to
{
return
nil
}
inf
,
err
:=
os
.
Stat
(
string
(
from
))
inf
,
err
:=
os
.
Stat
(
string
(
from
))
if
err
!=
nil
{
if
err
!=
nil
{
return
xerrors
.
Errorf
(
"stat %s: %w"
,
from
,
err
)
return
xerrors
.
Errorf
(
"stat %s: %w"
,
from
,
err
)
...
...
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