add idxProvHost to StorageProvider
This commit is contained in:
parent
db5e4da268
commit
f9b63c5f8c
@ -168,6 +168,7 @@ func ConfigStorageMiner(c interface{}) Option {
|
|||||||
Override(new(dtypes.ProviderTransferNetwork), modules.NewProviderTransferNetwork),
|
Override(new(dtypes.ProviderTransferNetwork), modules.NewProviderTransferNetwork),
|
||||||
Override(new(dtypes.ProviderTransport), modules.NewProviderTransport),
|
Override(new(dtypes.ProviderTransport), modules.NewProviderTransport),
|
||||||
Override(new(dtypes.ProviderDataTransfer), modules.NewProviderDataTransfer),
|
Override(new(dtypes.ProviderDataTransfer), modules.NewProviderDataTransfer),
|
||||||
|
Override(new(*modules.IdxProvHost), modules.IndexerProviderHost(cfg.IndexerProvider)),
|
||||||
Override(new(provider.Interface), modules.IndexerProvider(cfg.IndexerProvider)),
|
Override(new(provider.Interface), modules.IndexerProvider(cfg.IndexerProvider)),
|
||||||
Override(new(*storedask.StoredAsk), modules.NewStorageAsk),
|
Override(new(*storedask.StoredAsk), modules.NewStorageAsk),
|
||||||
Override(new(dtypes.StorageDealFilter), modules.BasicDealFilter(cfg.Dealmaking, nil)),
|
Override(new(dtypes.StorageDealFilter), modules.BasicDealFilter(cfg.Dealmaking, nil)),
|
||||||
|
@ -591,6 +591,7 @@ func StorageProvider(minerAddress dtypes.MinerAddress,
|
|||||||
df dtypes.StorageDealFilter,
|
df dtypes.StorageDealFilter,
|
||||||
dsw *dagstore.Wrapper,
|
dsw *dagstore.Wrapper,
|
||||||
fullnodeApi v1api.FullNode,
|
fullnodeApi v1api.FullNode,
|
||||||
|
idxProvHost *IdxProvHost,
|
||||||
) (storagemarket.StorageProvider, error) {
|
) (storagemarket.StorageProvider, error) {
|
||||||
net := smnet.NewFromLibp2pHost(h)
|
net := smnet.NewFromLibp2pHost(h)
|
||||||
|
|
||||||
@ -622,6 +623,7 @@ func StorageProvider(minerAddress dtypes.MinerAddress,
|
|||||||
address.Address(minerAddress),
|
address.Address(minerAddress),
|
||||||
storedAsk,
|
storedAsk,
|
||||||
fullnodeApi,
|
fullnodeApi,
|
||||||
|
idxProvHost.Host,
|
||||||
opt,
|
opt,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -48,10 +48,12 @@ type IdxProv struct {
|
|||||||
peerstore.Peerstore
|
peerstore.Peerstore
|
||||||
}
|
}
|
||||||
|
|
||||||
func IndexerProvider(cfg config.IndexerProviderConfig) func(params IdxProv, marketHost host.Host) (provider.Interface, error) {
|
type IdxProvHost struct {
|
||||||
return func(args IdxProv, marketHost host.Host) (provider.Interface, error) {
|
host.Host
|
||||||
ipds := namespace.Wrap(args.Datastore, datastore.NewKey("/indexer-provider"))
|
}
|
||||||
|
|
||||||
|
func IndexerProviderHost(cfg config.IndexerProviderConfig) func(IdxProv) (*IdxProvHost, error) {
|
||||||
|
return func(args IdxProv) (*IdxProvHost, error) {
|
||||||
pkey := args.Peerstore.PrivKey(args.PeerID)
|
pkey := args.Peerstore.PrivKey(args.PeerID)
|
||||||
if pkey == nil {
|
if pkey == nil {
|
||||||
return nil, fmt.Errorf("missing private key for node ID: %s", args.PeerID.Pretty())
|
return nil, fmt.Errorf("missing private key for node ID: %s", args.PeerID.Pretty())
|
||||||
@ -62,6 +64,19 @@ func IndexerProvider(cfg config.IndexerProviderConfig) func(params IdxProv, mark
|
|||||||
return nil, xerrors.Errorf("creating indexer provider host: %w", err)
|
return nil, xerrors.Errorf("creating indexer provider host: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return &IdxProvHost{h}, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func IndexerProvider(cfg config.IndexerProviderConfig) func(params IdxProv, marketHost host.Host, h *IdxProvHost) (provider.Interface, error) {
|
||||||
|
return func(args IdxProv, marketHost host.Host, h *IdxProvHost) (provider.Interface, error) {
|
||||||
|
ipds := namespace.Wrap(args.Datastore, datastore.NewKey("/indexer-provider"))
|
||||||
|
|
||||||
|
pkey := args.Peerstore.PrivKey(args.PeerID)
|
||||||
|
if pkey == nil {
|
||||||
|
return nil, fmt.Errorf("missing private key for node ID: %s", args.PeerID.Pretty())
|
||||||
|
}
|
||||||
|
|
||||||
dt, err := newIndexerProviderDataTransfer(cfg, args.MetricsCtx, args.Lifecycle, args.Repo, h, ipds)
|
dt, err := newIndexerProviderDataTransfer(cfg, args.MetricsCtx, args.Lifecycle, args.Repo, h, ipds)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Loading…
Reference in New Issue
Block a user