storage

package module
v0.0.0-...-ab4d9c7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2020 License: Apache-2.0, MIT Imports: 12 Imported by: 0

README

go-storage-mining

A Filecoin storage miner

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Miner

type Miner struct {
	// contains filtered or unexported fields
}

func NewMiner

func NewMiner(api node.Interface, minerAddressGetter MinerAddressGetter, dst datastore.Batching, mgr sectorstorage.SectorManager, sid fsm.SectorIDCounter, ver ffiwrapper.Verifier, pcp fsm.PreCommitPolicy) *Miner

func (*Miner) AllocatePiece

func (m *Miner) AllocatePiece(size abi.UnpaddedPieceSize) (sectorNum abi.SectorNumber, offset uint64, err error)

AllocatePiece produces information about where a piece of a given size can be written.

TODO: This signature doesn't make much sense. Returning a sector ID here means that we won't have the ability to move the piece around (i.e. do intelligent bin packing) after allocating. -- @laser

func (*Miner) ForceSectorState

func (m *Miner) ForceSectorState(ctx context.Context, num abi.SectorNumber, state fsm.SectorState) error

ForceSectorState puts a sector with given ID into the given state.

func (*Miner) GetSectorInfo

func (m *Miner) GetSectorInfo(sectorNum abi.SectorNumber) (fsm.SectorInfo, error)

GetSectorInfo produces information about a sector managed by this storage miner, or an error if the miner does not manage a sector with the provided identity.

func (*Miner) ListSectors

func (m *Miner) ListSectors() ([]fsm.SectorInfo, error)

ListSectors lists all the sectors managed by this storage miner (sealed or otherwise).

func (*Miner) PledgeSector

func (m *Miner) PledgeSector(ctx context.Context) error

PledgeSector allocates a new sector, fills it with self-deal junk, and seals that sector.

func (*Miner) Run

func (m *Miner) Run(ctx context.Context) error

Run starts the Miner, which causes it (and its collaborating objects) to start listening for sector state-transitions. It is undefined behavior to call this method more than once. It is undefined behavior to call this method concurrently with any other Miner method. This method blocks until all sectors have been restarted (in the finite-state machine), and returns any preflight check-errors or errors encountered when restarting sectors.

func (*Miner) SealPiece

func (m *Miner) SealPiece(ctx context.Context, size abi.UnpaddedPieceSize, r io.Reader, sectorNum abi.SectorNumber, deal fsm.DealInfo) error

SealPiece writes the provided piece to a newly-created sector which it immediately seals.

func (*Miner) Stop

func (m *Miner) Stop(ctx context.Context) error

Stop causes the miner to stop listening for sector state transitions. It is undefined behavior to call this method before calling Start. It is undefined behavior to call this method more than once. It is undefined behavior to call this method concurrently with any other Miner method.

type MinerAddressGetter

type MinerAddressGetter = func(context.Context) (address.Address, error)

Directories

Path Synopsis
apis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL