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
24aaedac
Unverified
Commit
24aaedac
authored
Nov 20, 2019
by
Erin Swenson-Healey
Committed by
GitHub
Nov 20, 2019
Browse files
feat(submodule): consume new merkle tree cache software (#53)
parent
33fb89c5
Changes
3
Hide whitespace changes
Inline
Side-by-side
bindings.go
View file @
24aaedac
...
...
@@ -1073,6 +1073,7 @@ func StandaloneSealCommit(
func
StandaloneUnseal
(
sectorSize
uint64
,
poRepProofPartitions
uint8
,
cacheDirPath
string
,
sealedSectorPath
string
,
unsealOutputPath
string
,
sectorID
uint64
,
...
...
@@ -1082,6 +1083,9 @@ func StandaloneUnseal(
)
error
{
defer
elapsed
(
"StandaloneUnseal"
)()
cCacheDirPath
:=
C
.
CString
(
cacheDirPath
)
defer
C
.
free
(
unsafe
.
Pointer
(
cCacheDirPath
))
cSealedSectorPath
:=
C
.
CString
(
sealedSectorPath
)
defer
C
.
free
(
unsafe
.
Pointer
(
cSealedSectorPath
))
...
...
@@ -1099,6 +1103,7 @@ func StandaloneUnseal(
resPtr
:=
C
.
sector_builder_ffi_reexported_unseal
(
cSectorClass
(
sectorSize
,
poRepProofPartitions
),
cCacheDirPath
,
cSealedSectorPath
,
cUnsealOutputPath
,
C
.
uint64_t
(
sectorID
),
...
...
bindings_test.go
View file @
24aaedac
...
...
@@ -46,16 +46,16 @@ func TestSectorBuilderLifecycle(t *testing.T) {
proverID
:=
[
32
]
byte
{
6
,
7
,
8
}
metadataDir
:=
requireTempDirPath
(
t
)
metadataDir
:=
requireTempDirPath
(
t
,
"metadata"
)
defer
os
.
RemoveAll
(
metadataDir
)
sealedSectorDir
:=
requireTempDirPath
(
t
)
sealedSectorDir
:=
requireTempDirPath
(
t
,
"sealed-sectors"
)
defer
os
.
RemoveAll
(
sealedSectorDir
)
stagedSectorDir
:=
requireTempDirPath
(
t
)
stagedSectorDir
:=
requireTempDirPath
(
t
,
"staged-sectors"
)
defer
os
.
RemoveAll
(
stagedSectorDir
)
sectorCacheRootDir
:=
requireTempDirPath
(
t
)
sectorCacheRootDir
:=
requireTempDirPath
(
t
,
"sector-cache-root"
)
defer
os
.
RemoveAll
(
sectorCacheRootDir
)
ptr
,
err
:=
sb
.
InitSectorBuilder
(
1024
,
2
,
0
,
metadataDir
,
proverID
,
sealedSectorDir
,
stagedSectorDir
,
sectorCacheRootDir
,
1
,
2
)
...
...
@@ -224,16 +224,16 @@ func TestStandaloneSealing(t *testing.T) {
proverID
:=
[
32
]
byte
{
6
,
7
,
8
}
// initialize a sector builder
metadataDir
:=
requireTempDirPath
(
t
)
metadataDir
:=
requireTempDirPath
(
t
,
"metadata"
)
defer
os
.
RemoveAll
(
metadataDir
)
sealedSectorsDir
:=
requireTempDirPath
(
t
)
sealedSectorsDir
:=
requireTempDirPath
(
t
,
"sealed-sectors"
)
defer
os
.
RemoveAll
(
sealedSectorsDir
)
stagedSectorsDir
:=
requireTempDirPath
(
t
)
stagedSectorsDir
:=
requireTempDirPath
(
t
,
"staged-sectors"
)
defer
os
.
RemoveAll
(
stagedSectorsDir
)
sectorCacheRootDir
:=
requireTempDirPath
(
t
)
sectorCacheRootDir
:=
requireTempDirPath
(
t
,
"sector-cache-root-dir"
)
defer
os
.
RemoveAll
(
sectorCacheRootDir
)
ptr
,
err
:=
sb
.
InitSectorBuilder
(
1024
,
2
,
0
,
metadataDir
,
proverID
,
sealedSectorsDir
,
stagedSectorsDir
,
sectorCacheRootDir
,
1
,
1
)
...
...
@@ -243,7 +243,7 @@ func TestStandaloneSealing(t *testing.T) {
sectorID
,
err
:=
sb
.
AcquireSectorId
(
ptr
)
require
.
NoError
(
t
,
err
)
sectorCacheDirPath
:=
requireTempDirPath
(
t
)
sectorCacheDirPath
:=
requireTempDirPath
(
t
,
"sector-cache-dir"
)
defer
os
.
RemoveAll
(
sectorCacheDirPath
)
stagedSectorFile
:=
requireTempFile
(
t
,
bytes
.
NewReader
([]
byte
{}),
0
)
...
...
@@ -326,7 +326,7 @@ func TestStandaloneSealing(t *testing.T) {
require
.
True
(
t
,
isValid
,
"proof wasn't valid"
)
// unseal and verify that things went as we planned
require
.
NoError
(
t
,
sb
.
StandaloneUnseal
(
sectorSize
,
poRepProofPartitions
,
sealedSectorFile
.
Name
(),
unsealOutputFile
.
Name
(),
sectorID
,
proverID
,
ticket
.
TicketBytes
,
output
.
CommD
))
require
.
NoError
(
t
,
sb
.
StandaloneUnseal
(
sectorSize
,
poRepProofPartitions
,
sectorCacheDirPath
,
sealedSectorFile
.
Name
(),
unsealOutputFile
.
Name
(),
sectorID
,
proverID
,
ticket
.
TicketBytes
,
output
.
CommD
))
contents
,
err
:=
ioutil
.
ReadFile
(
unsealOutputFile
.
Name
())
require
.
NoError
(
t
,
err
)
...
...
@@ -357,10 +357,10 @@ func TestStandaloneSealing(t *testing.T) {
require
.
NoError
(
t
,
filepath
.
Walk
(
sealedSectorsDir
,
visit
(
&
sealedSectorPathsB
)))
assert
.
Equal
(
t
,
2
,
len
(
sealedSectorPathsB
),
sealedSectorPathsB
)
// it should now have a cache dir
, woo!
// it should now have a cache dir
and a bunch of goodies in the cache
var
sectorCacheDirPathsB
[]
string
require
.
NoError
(
t
,
filepath
.
Walk
(
sectorCacheRootDir
,
visit
(
&
sectorCacheDirPathsB
)))
assert
.
Equal
(
t
,
2
,
len
(
sectorCacheDirPathsB
),
sectorCacheDirPathsB
)
assert
.
Less
(
t
,
2
,
len
(
sectorCacheDirPathsB
),
sectorCacheDirPathsB
)
// verify that it shows up in sealed sector list
metadata
,
err
:=
sb
.
GetAllSealedSectorsWithHealth
(
ptr
)
...
...
@@ -445,8 +445,8 @@ func requireTempFile(t *testing.T, fileContentsReader io.Reader, size uint64) *o
return
file
}
func
requireTempDirPath
(
t
*
testing
.
T
)
string
{
dir
,
err
:=
ioutil
.
TempDir
(
""
,
""
)
func
requireTempDirPath
(
t
*
testing
.
T
,
prefix
string
)
string
{
dir
,
err
:=
ioutil
.
TempDir
(
""
,
prefix
)
require
.
NoError
(
t
,
err
)
return
dir
...
...
rust-fil-sector-builder
@
9a0fe0de
Compare
aa644623
...
9a0fe0de
Subproject commit
aa6446237961eca1f6ca773a7d7debb39252d290
Subproject commit
9a0fe0dee0f1e56ab853c331ffa6a3017dbf2acd
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