Commit 79a4a1d8 authored by laser's avatar laser
Browse files

feat(plumb sector health parameter to FFI call)

parent 5a6af1f9
......@@ -386,7 +386,7 @@ func GetAllStagedSectors(sectorBuilderPtr unsafe.Pointer) ([]StagedSectorMetadat
func GetAllSealedSectors(sectorBuilderPtr unsafe.Pointer, performHealthchecks bool) ([]SealedSectorMetadata, error) {
defer elapsed("GetAllSealedSectors")()
resPtr := C.sector_builder_ffi_get_sealed_sectors((*C.sector_builder_ffi_SectorBuilder)(sectorBuilderPtr), performHealthchecks)
resPtr := C.sector_builder_ffi_get_sealed_sectors((*C.sector_builder_ffi_SectorBuilder)(sectorBuilderPtr), true == performHealthchecks)
defer C.sector_builder_ffi_destroy_get_sealed_sectors_response(resPtr)
if resPtr.status_code != 0 {
......
......@@ -87,12 +87,13 @@ func TestSectorBuilderLifecycle(t *testing.T) {
require.NoError(t, err)
require.True(t, isValid)
sealedSectors, err := sb.GetAllSealedSectors(ptr)
sealedSectors, err := sb.GetAllSealedSectors(ptr, true)
require.NoError(t, err)
require.Equal(t, 1, len(sealedSectors), "expected to see one sealed sector")
sealedSector := sealedSectors[0]
require.Equal(t, uint64(1), sealedSector.SectorID)
require.Equal(t, 1, len(sealedSector.Pieces))
require.Equal(t, sb.Ok, sealedSector.Health)
// the piece is the size of the sector, so its piece commitment should be the
// data commitment
require.Equal(t, commP, sealedSector.CommD)
......
......@@ -129,15 +129,15 @@ func goPieceMetadata(src *C.sector_builder_ffi_FFIPieceMetadata, size C.size_t)
func goSealedSectorHealth(health C.sector_builder_ffi_FFISealedSectorHealth) (SealedSectorHealth, error) {
switch health {
case C.sector_builder_ffi_FFISealedSectorHealth_Unknown:
case C.Unknown:
return Unknown, nil
case C.sector_builder_ffi_FFISealedSectorHealth_Ok:
case C.Ok:
return Ok, nil
case C.sector_builder_ffi_FFISealedSectorHealth_ErrorInvalidChecksum:
case C.ErrorInvalidChecksum:
return ErrorInvalidChecksum, nil
case C.sector_builder_ffi_FFISealedSectorHealth_ErrorInvalidLength:
case C.ErrorInvalidLength:
return ErrorInvalidLength, nil
case C.sector_builder_ffi_FFISealedSectorHealth_ErrorMissing:
case C.ErrorMissing:
return ErrorMissing, nil
default:
return Unknown, errors.Errorf("unhandled sealed sector health: %v", health)
......
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