More renames
License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
parent
e2bd4b658b
commit
7f537dce2d
@ -58,7 +58,7 @@ type StorageMiner interface {
|
|||||||
ActorSectorSize(context.Context, address.Address) (uint64, error)
|
ActorSectorSize(context.Context, address.Address) (uint64, error)
|
||||||
|
|
||||||
// Temp api for testing
|
// Temp api for testing
|
||||||
StoreGarbageData(context.Context) error
|
PledgeSector(context.Context) error
|
||||||
|
|
||||||
// Get the status of a given sector by ID
|
// Get the status of a given sector by ID
|
||||||
SectorsStatus(context.Context, uint64) (SectorInfo, error)
|
SectorsStatus(context.Context, uint64) (SectorInfo, error)
|
||||||
|
@ -134,7 +134,7 @@ type StorageMinerStruct struct {
|
|||||||
ActorAddress func(context.Context) (address.Address, error) `perm:"read"`
|
ActorAddress func(context.Context) (address.Address, error) `perm:"read"`
|
||||||
ActorSectorSize func(context.Context, address.Address) (uint64, 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"`
|
SectorsStatus func(context.Context, uint64) (SectorInfo, error) `perm:"read"`
|
||||||
SectorsList func(context.Context) ([]uint64, 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)
|
return c.Internal.ActorSectorSize(ctx, addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *StorageMinerStruct) StoreGarbageData(ctx context.Context) error {
|
func (c *StorageMinerStruct) PledgeSector(ctx context.Context) error {
|
||||||
return c.Internal.StoreGarbageData(ctx)
|
return c.Internal.PledgeSector(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the status of a given sector by ID
|
// Get the status of a given sector by ID
|
||||||
|
@ -24,7 +24,7 @@ func main() {
|
|||||||
runCmd,
|
runCmd,
|
||||||
initCmd,
|
initCmd,
|
||||||
infoCmd,
|
infoCmd,
|
||||||
storeGarbageCmd,
|
pledgeSectorCmd,
|
||||||
sectorsCmd,
|
sectorsCmd,
|
||||||
}
|
}
|
||||||
jaeger := tracing.SetupJaegerTracing("lotus")
|
jaeger := tracing.SetupJaegerTracing("lotus")
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
lcli "github.com/filecoin-project/lotus/cli"
|
lcli "github.com/filecoin-project/lotus/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
var storeGarbageCmd = &cli.Command{
|
var pledgeSectorCmd = &cli.Command{
|
||||||
Name: "pledge-sector",
|
Name: "pledge-sector",
|
||||||
Usage: "store random data in a sector",
|
Usage: "store random data in a sector",
|
||||||
Action: func(cctx *cli.Context) error {
|
Action: func(cctx *cli.Context) error {
|
||||||
@ -23,7 +23,7 @@ var storeGarbageCmd = &cli.Command{
|
|||||||
defer closer()
|
defer closer()
|
||||||
ctx := lcli.ReqContext(cctx)
|
ctx := lcli.ReqContext(cctx)
|
||||||
|
|
||||||
return nodeApi.StoreGarbageData(ctx)
|
return nodeApi.PledgeSector(ctx)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ class StorageNode extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.loadInfo = this.loadInfo.bind(this)
|
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.stop = this.stop.bind(this)
|
||||||
|
|
||||||
this.connect()
|
this.connect()
|
||||||
@ -98,8 +98,8 @@ class StorageNode extends React.Component {
|
|||||||
this.setState({staged, statusCounts})
|
this.setState({staged, statusCounts})
|
||||||
}
|
}
|
||||||
|
|
||||||
async sealGarbage() {
|
async pledgeSector() {
|
||||||
await this.state.client.call("Filecoin.StoreGarbageData", [])
|
await this.state.client.call("Filecoin.PledgeSector", [])
|
||||||
}
|
}
|
||||||
|
|
||||||
sealStaged = async () => {
|
sealStaged = async () => {
|
||||||
@ -113,7 +113,7 @@ class StorageNode extends React.Component {
|
|||||||
render() {
|
render() {
|
||||||
let runtime = <div></div>
|
let runtime = <div></div>
|
||||||
if (this.state.actor) {
|
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>
|
const sealStaged = <a href="#" onClick={this.sealStaged}>[Seal Staged]</a>
|
||||||
|
|
||||||
runtime = (
|
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>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>Repo: LOTUS_STORAGE_PATH={this.props.node.Repo}</div>
|
||||||
<div>
|
<div>
|
||||||
{sealGarbage} {sealStaged}
|
{pledgeSector} {sealStaged}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<Address client={this.props.fullConn} addr={this.state.actor} mountWindow={this.props.mountWindow}/>
|
<Address client={this.props.fullConn} addr={this.state.actor} mountWindow={this.props.mountWindow}/>
|
||||||
|
@ -143,8 +143,8 @@ func (sm *StorageMinerAPI) ActorSectorSize(ctx context.Context, addr address.Add
|
|||||||
return sm.Full.StateMinerSectorSize(ctx, addr, nil)
|
return sm.Full.StateMinerSectorSize(ctx, addr, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sm *StorageMinerAPI) StoreGarbageData(ctx context.Context) error {
|
func (sm *StorageMinerAPI) PledgeSector(ctx context.Context) error {
|
||||||
return sm.Miner.StoreGarbageData()
|
return sm.Miner.PledgeSector()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sm *StorageMinerAPI) SectorsStatus(ctx context.Context, sid uint64) (api.SectorInfo, error) {
|
func (sm *StorageMinerAPI) SectorsStatus(ctx context.Context, sid uint64) (api.SectorInfo, error) {
|
||||||
|
@ -15,7 +15,7 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/lib/sectorbuilder"
|
"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 {
|
if len(sizes) == 0 {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
@ -111,7 +111,7 @@ func (m *Miner) storeGarbage(ctx context.Context, sectorID uint64, existingPiece
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Miner) StoreGarbageData() error {
|
func (m *Miner) PledgeSector() error {
|
||||||
go func() {
|
go func() {
|
||||||
ctx := context.TODO() // we can't use the context from command which invokes
|
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
|
// this, as we run everything here async, and it's cancelled when the
|
||||||
@ -125,7 +125,7 @@ func (m *Miner) StoreGarbageData() error {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
pieces, err := m.storeGarbage(ctx, sid, []uint64{}, size)
|
pieces, err := m.pledgeSector(ctx, sid, []uint64{}, size)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("%+v", err)
|
log.Errorf("%+v", err)
|
||||||
return
|
return
|
||||||
|
@ -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)
|
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 {
|
if err != nil {
|
||||||
return sector.upd().fatal(xerrors.Errorf("filling up the sector (%v): %w", fillerSizes, err))
|
return sector.upd().fatal(xerrors.Errorf("filling up the sector (%v): %w", fillerSizes, err))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user