froghub-io / filecoin-sealer-recover

Filecoin sector recover
https://www.froghub.io
Apache License 2.0
67 stars 81 forks source link

Successfully restored and moved to storage, notifying miner to declare the sector. #12

Open FroghubMan opened 2 years ago

FroghubMan commented 2 years ago

If the sector is restored successfully, the miner will be notified to declare the sector as soon as possible, then the failure time of this sector can be used. Need to use MINER_API_INFO to quickly declare the new location of the sector by calling the interface StorageDeclareSector.

FroghubMan commented 2 years ago

The APIs involved include:

StorageDeclareSector(ctx context.Context, storageID ID, s abi.SectorID, ft storiface.SectorFileType, primary bool) error
StorageDropSector(ctx context.Context, storageID ID, s abi.SectorID, ft storiface.SectorFileType) error
StorageFindSector(ctx context.Context, sector abi.SectorID, ft storiface.SectorFileType, ssize abi.SectorSize, allowFetch bool) ([]SectorStorageInfo, error)

Approximate workflow: First check whether it already exists through StorageFindSector, if it is, discard it(StorageDropSector), and use StorageDeclareSector to declare to a new location.