Unverified Commit 1e5a8248 authored by Erin Swenson-Healey's avatar Erin Swenson-Healey Committed by GitHub
Browse files

Merge pull request #37 from filecoin-project/feat/cache-path-to-sector-builder-init

provide sector cache root directory to sector builder constructor
parents 9874093c 96c260d5
......@@ -248,12 +248,12 @@ func GetMaxUserBytesPerStagedSector(sectorSize uint64) uint64 {
func InitSectorBuilder(
sectorSize uint64,
poRepProofPartitions uint8,
poStProofPartitions uint8,
lastUsedSectorID uint64,
metadataDir string,
proverID [32]byte,
sealedSectorDir string,
stagedSectorDir string,
sectorCacheRootDir string,
maxNumOpenStagedSectors uint8,
) (unsafe.Pointer, error) {
defer elapsed("InitSectorBuilder")()
......@@ -270,6 +270,9 @@ func InitSectorBuilder(
cSealedSectorDir := C.CString(sealedSectorDir)
defer C.free(unsafe.Pointer(cSealedSectorDir))
cSectorCacheRootDir := C.CString(sectorCacheRootDir)
defer C.free(unsafe.Pointer(cSectorCacheRootDir))
class, err := cSectorClass(sectorSize, poRepProofPartitions)
if err != nil {
return nil, errors.Wrap(err, "failed to get sector class")
......@@ -282,6 +285,7 @@ func InitSectorBuilder(
(*[32]C.uint8_t)(proverIDCBytes),
cSealedSectorDir,
cStagedSectorDir,
cSectorCacheRootDir,
C.uint8_t(maxNumOpenStagedSectors),
)
defer C.sector_builder_ffi_destroy_init_sector_builder_response(resPtr)
......
......@@ -41,7 +41,10 @@ func TestSectorBuilderLifecycle(t *testing.T) {
stagedSectorDir := requireTempDirPath(t)
defer require.NoError(t, os.Remove(stagedSectorDir))
ptr, err := sb.InitSectorBuilder(1024, 2, 1, 0, metadataDir, proverID, sealedSectorDir, stagedSectorDir, 1)
sectorCacheRootDir := requireTempDirPath(t)
defer require.NoError(t, os.Remove(sectorCacheRootDir))
ptr, err := sb.InitSectorBuilder(1024, 2, 0, metadataDir, proverID, sealedSectorDir, stagedSectorDir, sectorCacheRootDir, 1)
require.NoError(t, err)
defer sb.DestroySectorBuilder(ptr)
......
Subproject commit ea80efaac14745ebf540ffbc8d54e7df3aa9a338
Subproject commit 668e18b19a8047aeb721e81cc7abe882e3119283
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment