various symbol renames
This commit is contained in:
parent
7587e6c08b
commit
36b327b57b
@ -54,7 +54,7 @@ type StorageMiner interface {
|
|||||||
|
|
||||||
DealsImportData(ctx context.Context, dealPropCid cid.Cid, file string) error
|
DealsImportData(ctx context.Context, dealPropCid cid.Cid, file string) error
|
||||||
DealsList(ctx context.Context) ([]storagemarket.StorageDeal, error)
|
DealsList(ctx context.Context) ([]storagemarket.StorageDeal, error)
|
||||||
DealsSetIsAcceptingStorageDeals(ctx context.Context, b bool) error
|
DealsSetAcceptingStorageDeals(context.Context, bool) error
|
||||||
|
|
||||||
StorageAddLocal(ctx context.Context, path string) error
|
StorageAddLocal(ctx context.Context, path string) error
|
||||||
}
|
}
|
||||||
|
@ -220,9 +220,9 @@ type StorageMinerStruct struct {
|
|||||||
StorageLock func(ctx context.Context, sector abi.SectorID, read stores.SectorFileType, write stores.SectorFileType) error `perm:"admin"`
|
StorageLock func(ctx context.Context, sector abi.SectorID, read stores.SectorFileType, write stores.SectorFileType) error `perm:"admin"`
|
||||||
StorageTryLock func(ctx context.Context, sector abi.SectorID, read stores.SectorFileType, write stores.SectorFileType) (bool, error) `perm:"admin"`
|
StorageTryLock func(ctx context.Context, sector abi.SectorID, read stores.SectorFileType, write stores.SectorFileType) (bool, error) `perm:"admin"`
|
||||||
|
|
||||||
DealsImportData func(ctx context.Context, dealPropCid cid.Cid, file string) error `perm:"write"`
|
DealsImportData func(ctx context.Context, dealPropCid cid.Cid, file string) error `perm:"write"`
|
||||||
DealsList func(ctx context.Context) ([]storagemarket.StorageDeal, error) `perm:"read"`
|
DealsList func(ctx context.Context) ([]storagemarket.StorageDeal, error) `perm:"read"`
|
||||||
DealsSetIsAcceptingStorageDeals func(ctx context.Context, b bool) error `perm:"admin"`
|
DealsSetAcceptingStorageDeals func(context.Context, bool) error `perm:"admin"`
|
||||||
|
|
||||||
StorageAddLocal func(ctx context.Context, path string) error `perm:"admin"`
|
StorageAddLocal func(ctx context.Context, path string) error `perm:"admin"`
|
||||||
}
|
}
|
||||||
@ -853,8 +853,8 @@ func (c *StorageMinerStruct) DealsList(ctx context.Context) ([]storagemarket.Sto
|
|||||||
return c.Internal.DealsList(ctx)
|
return c.Internal.DealsList(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *StorageMinerStruct) DealsSetIsAcceptingStorageDeals(ctx context.Context, b bool) error {
|
func (c *StorageMinerStruct) DealsSetAcceptingStorageDeals(ctx context.Context, b bool) error {
|
||||||
return c.Internal.DealsSetIsAcceptingStorageDeals(ctx, b)
|
return c.Internal.DealsSetAcceptingStorageDeals(ctx, b)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *StorageMinerStruct) StorageAddLocal(ctx context.Context, path string) error {
|
func (c *StorageMinerStruct) StorageAddLocal(ctx context.Context, path string) error {
|
||||||
|
@ -21,7 +21,7 @@ var enableCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
defer closer()
|
defer closer()
|
||||||
|
|
||||||
return api.DealsSetIsAcceptingStorageDeals(lcli.DaemonContext(cctx), true)
|
return api.DealsSetAcceptingStorageDeals(lcli.DaemonContext(cctx), true)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ var disableCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
defer closer()
|
defer closer()
|
||||||
|
|
||||||
return api.DealsSetIsAcceptingStorageDeals(lcli.DaemonContext(cctx), false)
|
return api.DealsSetAcceptingStorageDeals(lcli.DaemonContext(cctx), false)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -313,8 +313,9 @@ func Online() Option {
|
|||||||
Override(HandleDealsKey, modules.HandleDeals),
|
Override(HandleDealsKey, modules.HandleDeals),
|
||||||
Override(new(gen.WinningPoStProver), storage.NewWinningPoStProver),
|
Override(new(gen.WinningPoStProver), storage.NewWinningPoStProver),
|
||||||
Override(new(*miner.Miner), modules.SetupBlockProducer),
|
Override(new(*miner.Miner), modules.SetupBlockProducer),
|
||||||
Override(new(dtypes.IsAcceptingStorageDealsFunc), modules.NewIsAcceptingStorageDealsFunc),
|
|
||||||
Override(new(dtypes.SetAcceptingStorageDealsFunc), modules.NewSetAcceptingStorageDealsFunc),
|
Override(new(dtypes.AcceptingStorageDealsConfigFunc), modules.NewAcceptingStorageDealsConfigFunc),
|
||||||
|
Override(new(dtypes.SetAcceptingStorageDealsConfigFunc), modules.NewSetAcceptingStorageDealsConfigFunc),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ type StorageMiner struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type DealmakingConfig struct {
|
type DealmakingConfig struct {
|
||||||
IsAcceptingStorageDeals bool
|
AcceptingStorageDeals bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// API contains configs for API endpoint
|
// API contains configs for API endpoint
|
||||||
@ -116,7 +116,7 @@ func DefaultStorageMiner() *StorageMiner {
|
|||||||
},
|
},
|
||||||
|
|
||||||
Dealmaking: DealmakingConfig{
|
Dealmaking: DealmakingConfig{
|
||||||
IsAcceptingStorageDeals: true,
|
AcceptingStorageDeals: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
cfg.Common.API.ListenAddress = "/ip4/127.0.0.1/tcp/2345/http"
|
cfg.Common.API.ListenAddress = "/ip4/127.0.0.1/tcp/2345/http"
|
||||||
|
@ -43,7 +43,7 @@ type StorageMinerAPI struct {
|
|||||||
StorageMgr *sectorstorage.Manager `optional:"true"`
|
StorageMgr *sectorstorage.Manager `optional:"true"`
|
||||||
*stores.Index
|
*stores.Index
|
||||||
|
|
||||||
SetAcceptingStorageDealsFunc dtypes.SetAcceptingStorageDealsFunc
|
SetAcceptingStorageDealsConfigFunc dtypes.SetAcceptingStorageDealsConfigFunc
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sm *StorageMinerAPI) ServeRemote(w http.ResponseWriter, r *http.Request) {
|
func (sm *StorageMinerAPI) ServeRemote(w http.ResponseWriter, r *http.Request) {
|
||||||
@ -209,8 +209,8 @@ func (sm *StorageMinerAPI) DealsList(ctx context.Context) ([]storagemarket.Stora
|
|||||||
return sm.StorageProvider.ListDeals(ctx)
|
return sm.StorageProvider.ListDeals(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sm *StorageMinerAPI) DealsSetIsAcceptingStorageDeals(ctx context.Context, b bool) error {
|
func (sm *StorageMinerAPI) DealsSetAcceptingStorageDeals(ctx context.Context, b bool) error {
|
||||||
return sm.SetAcceptingStorageDealsFunc(b)
|
return sm.SetAcceptingStorageDealsConfigFunc(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sm *StorageMinerAPI) DealsImportData(ctx context.Context, deal cid.Cid, fname string) error {
|
func (sm *StorageMinerAPI) DealsImportData(ctx context.Context, deal cid.Cid, fname string) error {
|
||||||
|
@ -8,10 +8,10 @@ import (
|
|||||||
type MinerAddress address.Address
|
type MinerAddress address.Address
|
||||||
type MinerID abi.ActorID
|
type MinerID abi.ActorID
|
||||||
|
|
||||||
// IsAcceptingStorageDealsFunc is a function which reads from miner config to
|
// AcceptingStorageDealsFunc is a function which reads from miner config to
|
||||||
// determine if the user has disabled storage deals (or not).
|
// determine if the user has disabled storage deals (or not).
|
||||||
type IsAcceptingStorageDealsFunc func() (bool, error)
|
type AcceptingStorageDealsConfigFunc func() (bool, error)
|
||||||
|
|
||||||
// SetAcceptingStorageDealsFunc is a function which is used to disable or enable
|
// SetAcceptingStorageDealsFunc is a function which is used to disable or enable
|
||||||
// storage deal acceptance.
|
// storage deal acceptance.
|
||||||
type SetAcceptingStorageDealsFunc func(bool) error
|
type SetAcceptingStorageDealsConfigFunc func(bool) error
|
||||||
|
@ -307,7 +307,7 @@ func NewStorageAsk(ctx helpers.MetricsCtx, fapi lapi.FullNode, ds dtypes.Metadat
|
|||||||
return storedAsk, nil
|
return storedAsk, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func StorageProvider(minerAddress dtypes.MinerAddress, ffiConfig *ffiwrapper.Config, storedAsk *storedask.StoredAsk, h host.Host, ds dtypes.MetadataDS, ibs dtypes.StagingBlockstore, r repo.LockedRepo, pieceStore dtypes.ProviderPieceStore, dataTransfer dtypes.ProviderDataTransfer, spn storagemarket.StorageProviderNode, isAcceptingStorageDealsFunc dtypes.IsAcceptingStorageDealsFunc) (storagemarket.StorageProvider, error) {
|
func StorageProvider(minerAddress dtypes.MinerAddress, ffiConfig *ffiwrapper.Config, storedAsk *storedask.StoredAsk, h host.Host, ds dtypes.MetadataDS, ibs dtypes.StagingBlockstore, r repo.LockedRepo, pieceStore dtypes.ProviderPieceStore, dataTransfer dtypes.ProviderDataTransfer, spn storagemarket.StorageProviderNode, isAcceptingFunc dtypes.AcceptingStorageDealsConfigFunc) (storagemarket.StorageProvider, error) {
|
||||||
net := smnet.NewFromLibp2pHost(h)
|
net := smnet.NewFromLibp2pHost(h)
|
||||||
store, err := piecefilestore.NewLocalFileStore(piecefilestore.OsPath(r.Path()))
|
store, err := piecefilestore.NewLocalFileStore(piecefilestore.OsPath(r.Path()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -315,12 +315,12 @@ func StorageProvider(minerAddress dtypes.MinerAddress, ffiConfig *ffiwrapper.Con
|
|||||||
}
|
}
|
||||||
|
|
||||||
opt := storageimpl.CustomDealDecisionLogic(func(ctx context.Context, deal storagemarket.MinerDeal) (bool, string, error) {
|
opt := storageimpl.CustomDealDecisionLogic(func(ctx context.Context, deal storagemarket.MinerDeal) (bool, string, error) {
|
||||||
willEntertainProposals, err := isAcceptingStorageDealsFunc()
|
b, err := isAcceptingFunc()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, "miner error", err
|
return false, "miner error", err
|
||||||
}
|
}
|
||||||
|
|
||||||
if !willEntertainProposals {
|
if !b {
|
||||||
log.Warnf("storage deal acceptance disabled; rejecting storage deal proposal from client: %s", deal.Client.String())
|
log.Warnf("storage deal acceptance disabled; rejecting storage deal proposal from client: %s", deal.Client.String())
|
||||||
return false, "miner is not accepting storage deals", nil
|
return false, "miner is not accepting storage deals", nil
|
||||||
}
|
}
|
||||||
@ -379,7 +379,7 @@ func StorageAuth(ctx helpers.MetricsCtx, ca lapi.Common) (sectorstorage.StorageA
|
|||||||
return sectorstorage.StorageAuth(headers), nil
|
return sectorstorage.StorageAuth(headers), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewIsAcceptingStorageDealsFunc(r repo.LockedRepo) (dtypes.IsAcceptingStorageDealsFunc, error) {
|
func NewAcceptingStorageDealsConfigFunc(r repo.LockedRepo) (dtypes.AcceptingStorageDealsConfigFunc, error) {
|
||||||
return func() (bool, error) {
|
return func() (bool, error) {
|
||||||
raw, err := r.Config()
|
raw, err := r.Config()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -391,11 +391,11 @@ func NewIsAcceptingStorageDealsFunc(r repo.LockedRepo) (dtypes.IsAcceptingStorag
|
|||||||
return false, xerrors.New("expected address of config.StorageMiner")
|
return false, xerrors.New("expected address of config.StorageMiner")
|
||||||
}
|
}
|
||||||
|
|
||||||
return cfg.Dealmaking.IsAcceptingStorageDeals, nil
|
return cfg.Dealmaking.AcceptingStorageDeals, nil
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSetAcceptingStorageDealsFunc(r repo.LockedRepo) (dtypes.SetAcceptingStorageDealsFunc, error) {
|
func NewSetAcceptingStorageDealsConfigFunc(r repo.LockedRepo) (dtypes.SetAcceptingStorageDealsConfigFunc, error) {
|
||||||
return func(b bool) error {
|
return func(b bool) error {
|
||||||
var typeErr error
|
var typeErr error
|
||||||
|
|
||||||
@ -406,7 +406,7 @@ func NewSetAcceptingStorageDealsFunc(r repo.LockedRepo) (dtypes.SetAcceptingStor
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg.Dealmaking.IsAcceptingStorageDeals = b
|
cfg.Dealmaking.AcceptingStorageDeals = b
|
||||||
})
|
})
|
||||||
|
|
||||||
return multierr.Combine(typeErr, setConfigErr)
|
return multierr.Combine(typeErr, setConfigErr)
|
||||||
|
Loading…
Reference in New Issue
Block a user