Merge pull request #790 from filecoin-project/feat/pledge-capacity

Rename pledge-sector
This commit is contained in:
Łukasz Magiera 2019-12-08 23:22:48 +01:00 committed by GitHub
commit 6d0e5997dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 20 additions and 20 deletions

View File

@ -58,7 +58,7 @@ type StorageMiner interface {
ActorSectorSize(context.Context, address.Address) (uint64, error)
// Temp api for testing
StoreGarbageData(context.Context) error
PledgeSector(context.Context) error
// Get the status of a given sector by ID
SectorsStatus(context.Context, uint64) (SectorInfo, error)

View File

@ -134,7 +134,7 @@ type StorageMinerStruct struct {
ActorAddress func(context.Context) (address.Address, error) `perm:"read"`
ActorSectorSize func(context.Context, address.Address) (uint64, error) `perm:"read"`
StoreGarbageData func(context.Context) error `perm:"write"`
PledgeSector func(context.Context) error `perm:"write"`
SectorsStatus func(context.Context, uint64) (SectorInfo, error) `perm:"read"`
SectorsList func(context.Context) ([]uint64, error) `perm:"read"`
@ -496,8 +496,8 @@ func (c *StorageMinerStruct) ActorSectorSize(ctx context.Context, addr address.A
return c.Internal.ActorSectorSize(ctx, addr)
}
func (c *StorageMinerStruct) StoreGarbageData(ctx context.Context) error {
return c.Internal.StoreGarbageData(ctx)
func (c *StorageMinerStruct) PledgeSector(ctx context.Context) error {
return c.Internal.PledgeSector(ctx)
}
// Get the status of a given sector by ID

View File

@ -24,7 +24,7 @@ func main() {
runCmd,
initCmd,
infoCmd,
storeGarbageCmd,
pledgeSectorCmd,
sectorsCmd,
}
jaeger := tracing.SetupJaegerTracing("lotus")

View File

@ -12,8 +12,8 @@ import (
lcli "github.com/filecoin-project/lotus/cli"
)
var storeGarbageCmd = &cli.Command{
Name: "store-garbage",
var pledgeSectorCmd = &cli.Command{
Name: "pledge-sector",
Usage: "store random data in a sector",
Action: func(cctx *cli.Context) error {
nodeApi, closer, err := lcli.GetStorageMinerAPI(cctx)
@ -23,7 +23,7 @@ var storeGarbageCmd = &cli.Command{
defer closer()
ctx := lcli.ReqContext(cctx)
return nodeApi.StoreGarbageData(ctx)
return nodeApi.PledgeSector(ctx)
},
}

View File

@ -53,7 +53,7 @@ lotus-storage-miner info
**Seal** random data to start producing **PoSts**:
```sh
lotus-storage-miner store-garbage
lotus-storage-miner pledge-sector
```
Get **miner power** and **sector usage**:

View File

@ -37,7 +37,7 @@ class StorageNode extends React.Component {
}
this.loadInfo = this.loadInfo.bind(this)
this.sealGarbage = this.sealGarbage.bind(this)
this.pledgeSector = this.pledgeSector.bind(this)
this.stop = this.stop.bind(this)
this.connect()
@ -98,8 +98,8 @@ class StorageNode extends React.Component {
this.setState({staged, statusCounts})
}
async sealGarbage() {
await this.state.client.call("Filecoin.StoreGarbageData", [])
async pledgeSector() {
await this.state.client.call("Filecoin.PledgeSector", [])
}
sealStaged = async () => {
@ -113,7 +113,7 @@ class StorageNode extends React.Component {
render() {
let runtime = <div></div>
if (this.state.actor) {
const sealGarbage = <a href="#" onClick={this.sealGarbage}>[Seal Garbage]</a>
const pledgeSector = <a href="#" onClick={this.pledgeSector}>[Pledge Sector]</a>
const sealStaged = <a href="#" onClick={this.sealStaged}>[Seal Staged]</a>
runtime = (
@ -121,7 +121,7 @@ class StorageNode extends React.Component {
<div>v{this.state.version.Version}, <abbr title={this.state.id}>{this.state.id.substr(-8)}</abbr>, {this.state.peers} peers</div>
<div>Repo: LOTUS_STORAGE_PATH={this.props.node.Repo}</div>
<div>
{sealGarbage} {sealStaged}
{pledgeSector} {sealStaged}
</div>
<div>
<Address client={this.props.fullConn} addr={this.state.actor} mountWindow={this.props.mountWindow}/>

View File

@ -143,8 +143,8 @@ func (sm *StorageMinerAPI) ActorSectorSize(ctx context.Context, addr address.Add
return sm.Full.StateMinerSectorSize(ctx, addr, nil)
}
func (sm *StorageMinerAPI) StoreGarbageData(ctx context.Context) error {
return sm.Miner.StoreGarbageData()
func (sm *StorageMinerAPI) PledgeSector(ctx context.Context) error {
return sm.Miner.PledgeSector()
}
func (sm *StorageMinerAPI) SectorsStatus(ctx context.Context, sid uint64) (api.SectorInfo, error) {

View File

@ -15,7 +15,7 @@ import (
"github.com/filecoin-project/lotus/lib/sectorbuilder"
)
func (m *Miner) storeGarbage(ctx context.Context, sectorID uint64, existingPieceSizes []uint64, sizes ...uint64) ([]Piece, error) {
func (m *Miner) pledgeSector(ctx context.Context, sectorID uint64, existingPieceSizes []uint64, sizes ...uint64) ([]Piece, error) {
if len(sizes) == 0 {
return nil, nil
}
@ -111,7 +111,7 @@ func (m *Miner) storeGarbage(ctx context.Context, sectorID uint64, existingPiece
return out, nil
}
func (m *Miner) StoreGarbageData() error {
func (m *Miner) PledgeSector() error {
go func() {
ctx := context.TODO() // we can't use the context from command which invokes
// this, as we run everything here async, and it's cancelled when the
@ -125,7 +125,7 @@ func (m *Miner) StoreGarbageData() error {
return
}
pieces, err := m.storeGarbage(ctx, sid, []uint64{}, size)
pieces, err := m.pledgeSector(ctx, sid, []uint64{}, size)
if err != nil {
log.Errorf("%+v", err)
return

View File

@ -52,7 +52,7 @@ func (m *Miner) handlePacking(ctx context.Context, sector SectorInfo) *sectorUpd
log.Warnf("Creating %d filler pieces for sector %d", len(fillerSizes), sector.SectorID)
}
pieces, err := m.storeGarbage(ctx, sector.SectorID, sector.existingPieces(), fillerSizes...)
pieces, err := m.pledgeSector(ctx, sector.SectorID, sector.existingPieces(), fillerSizes...)
if err != nil {
return sector.upd().fatal(xerrors.Errorf("filling up the sector (%v): %w", fillerSizes, err))
}