Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
Add seal proof type info to sector
Browse files Browse the repository at this point in the history
  • Loading branch information
magik6k committed Nov 4, 2020
1 parent c066548 commit 4d05608
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ import (

type Data = io.Reader

type SectorRef struct {
ID abi.SectorID
ProofType abi.RegisteredSealProof
}

type Storage interface {
// Creates a new empty sector (only allocate on disk. Layers above
// storage are responsible for assigning sector IDs)
NewSector(ctx context.Context, sector abi.SectorID) error
NewSector(ctx context.Context, sector SectorRef) error
// Add a piece to an existing *unsealed* sector
AddPiece(ctx context.Context, sector abi.SectorID, pieceSizes []abi.UnpaddedPieceSize, newPieceSize abi.UnpaddedPieceSize, pieceData Data) (abi.PieceInfo, error)
AddPiece(ctx context.Context, sector SectorRef, pieceSizes []abi.UnpaddedPieceSize, newPieceSize abi.UnpaddedPieceSize, pieceData Data) (abi.PieceInfo, error)
}

type Prover interface {
Expand All @@ -42,19 +47,19 @@ type Range struct {
}

type Sealer interface {
SealPreCommit1(ctx context.Context, sector abi.SectorID, ticket abi.SealRandomness, pieces []abi.PieceInfo) (PreCommit1Out, error)
SealPreCommit2(ctx context.Context, sector abi.SectorID, pc1o PreCommit1Out) (SectorCids, error)
SealPreCommit1(ctx context.Context, sector SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (PreCommit1Out, error)
SealPreCommit2(ctx context.Context, sector SectorRef, pc1o PreCommit1Out) (SectorCids, error)

SealCommit1(ctx context.Context, sector abi.SectorID, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids SectorCids) (Commit1Out, error)
SealCommit2(ctx context.Context, sector abi.SectorID, c1o Commit1Out) (Proof, error)
SealCommit1(ctx context.Context, sector SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids SectorCids) (Commit1Out, error)
SealCommit2(ctx context.Context, sector SectorRef, c1o Commit1Out) (Proof, error)

FinalizeSector(ctx context.Context, sector abi.SectorID, keepUnsealed []Range) error
FinalizeSector(ctx context.Context, sector SectorRef, keepUnsealed []Range) error

// ReleaseUnsealed marks parts of the unsealed sector file as safe to drop
// (called by the fsm on restart, allows storage to keep no persistent
// state about unsealed fast-retrieval copies)
ReleaseUnsealed(ctx context.Context, sector abi.SectorID, safeToFree []Range) error
ReleaseUnsealed(ctx context.Context, sector SectorRef, safeToFree []Range) error

// Removes all data associated with the specified sector
Remove(ctx context.Context, sector abi.SectorID) error
Remove(ctx context.Context, sector SectorRef) error
}

0 comments on commit 4d05608

Please sign in to comment.