interface.go 2.04 KB
Newer Older
Łukasz Magiera's avatar
Łukasz Magiera committed
1
2
3
4
5
6
7
package sectorbuilder

import (
	"context"
	"io"

	"github.com/filecoin-project/go-address"
Łukasz Magiera's avatar
Łukasz Magiera committed
8
9

	"github.com/filecoin-project/go-sectorbuilder/fs"
Łukasz Magiera's avatar
Łukasz Magiera committed
10
11
12
13
)

type Interface interface {
	RateLimit() func()
Łukasz Magiera's avatar
Łukasz Magiera committed
14
	AddPiece(context.Context, uint64, uint64, io.Reader, []uint64) (PublicPieceInfo, error)
Łukasz Magiera's avatar
Łukasz Magiera committed
15
16
17
18
19
20
21
22
23
24
25
	SectorSize() uint64
	AcquireSectorId() (uint64, error)
	Scrub(SortedPublicSectorInfo) []*Fault

	GenerateEPostCandidates(sectorInfo SortedPublicSectorInfo, challengeSeed [CommLen]byte, faults []uint64) ([]EPostCandidate, error)
	GenerateFallbackPoSt(SortedPublicSectorInfo, [CommLen]byte, []uint64) ([]EPostCandidate, []byte, error)
	ComputeElectionPoSt(sectorInfo SortedPublicSectorInfo, challengeSeed []byte, winners []EPostCandidate) ([]byte, error)

	SealPreCommit(context.Context, uint64, SealTicket, []PublicPieceInfo) (RawSealPreCommitOutput, error)
	SealCommit(context.Context, uint64, SealTicket, SealSeed, []PublicPieceInfo, RawSealPreCommitOutput) ([]byte, error)

Łukasz Magiera's avatar
Łukasz Magiera committed
26
	ReadPieceFromSealedSector(ctx context.Context, sectorID uint64, offset uint64, size uint64, ticket []byte, commD []byte) (io.ReadCloser, error)
Łukasz Magiera's avatar
Łukasz Magiera committed
27

Łukasz Magiera's avatar
Łukasz Magiera committed
28
29
30
	SectorPath(typ fs.DataType, sectorID uint64) (fs.SectorPath, error)
	AllocSectorPath(typ fs.DataType, sectorID uint64, cache bool) (fs.SectorPath, error)
	ReleaseSector(fs.DataType, fs.SectorPath)
Łukasz Magiera's avatar
Łukasz Magiera committed
31
	CanCommit(sectorID uint64) (bool, error)
Łukasz Magiera's avatar
Łukasz Magiera committed
32
33
34
35
36
37
38
39
40
41
	WorkerStats() WorkerStats
	AddWorker(context.Context, WorkerCfg) (<-chan WorkerTask, error)
	TaskDone(context.Context, uint64, SealRes) error
}

type Verifier interface {
	VerifyElectionPost(ctx context.Context, sectorSize uint64, sectorInfo SortedPublicSectorInfo, challengeSeed []byte, proof []byte, candidates []EPostCandidate, proverID address.Address) (bool, error)
	VerifyFallbackPost(ctx context.Context, sectorSize uint64, sectorInfo SortedPublicSectorInfo, challengeSeed []byte, proof []byte, candidates []EPostCandidate, proverID address.Address, faults uint64) (bool, error)
	VerifySeal(sectorSize uint64, commR, commD []byte, proverID address.Address, ticket []byte, seed []byte, sectorID uint64, proof []byte) (bool, error)
}