提交 2d1a4c27 作者: Michael Avila

Rename ProviderSystem to System

License: MIT
Signed-off-by: 's avatarMichael Avila <davidmichaelavila@gmail.com>
上级 f8c8d858
......@@ -286,7 +286,7 @@ func setupNode(ctx context.Context, n *IpfsNode, cfg *BuildCfg) error {
return err
}
tracker := provider.NewTracker(n.Repo.Datastore())
n.Provider = provider.NewProviderSystem(
n.Provider = provider.NewSystem(
provider.NewProvider(ctx, queueP, tracker, n.Routing),
// TODO: configure time.Minute and time.Hour*12
provider.NewReprovider(ctx, queueR, tracker, time.Minute, time.Hour*12, n.Blockstore, n.Routing),
......
......@@ -119,12 +119,12 @@ type IpfsNode struct {
RecordValidator record.Validator
// Online
PeerHost p2phost.Host // the network host (server+client)
Bootstrapper io.Closer // the periodic bootstrapper
Routing routing.IpfsRouting // the routing system. recommend ipfs-dht
Exchange exchange.Interface // the block exchange + strategy (bitswap)
Namesys namesys.NameSystem // the name system, resolves paths to hashes
Provider *provider.ProviderSystem // the value provider system
PeerHost p2phost.Host // the network host (server+client)
Bootstrapper io.Closer // the periodic bootstrapper
Routing routing.IpfsRouting // the routing system. recommend ipfs-dht
Exchange exchange.Interface // the block exchange + strategy (bitswap)
Namesys namesys.NameSystem // the name system, resolves paths to hashes
Provider *provider.System // the value provider system
IpnsRepub *ipnsrp.Republisher
AutoNAT *autonat.AutoNATService
......
......@@ -5,29 +5,29 @@ import (
"github.com/ipfs/go-cid"
)
// ProviderSystem bundles together provider and reprovider behavior
// System bundles together provider and reprovider behavior
// into one system
type ProviderSystem struct {
type System struct {
provider Provider
reprovider *Reprovider
}
// NewProviderSystem creates a new ProviderSystem
func NewProviderSystem(p Provider, r *Reprovider) *ProviderSystem {
return &ProviderSystem{
// NewSystem creates a new System
func NewSystem(p Provider, r *Reprovider) *System {
return &System{
provider: p,
reprovider: r,
}
}
// Run starts the provider system loops
func (ps *ProviderSystem) Run() {
func (ps *System) Run() {
ps.provider.Run()
ps.reprovider.Run()
}
// Close stops the provider system loops
func (ps *ProviderSystem) Close() error {
func (ps *System) Close() error {
var errs []error
if err := ps.provider.Close(); err != nil {
......@@ -45,17 +45,17 @@ func (ps *ProviderSystem) Close() error {
}
// Provide a cid by announcing it to the network
func (ps *ProviderSystem) Provide(cid cid.Cid) {
func (ps *System) Provide(cid cid.Cid) {
ps.provider.Provide(cid)
}
// Tracking returns all cids that are currently being tracked and reprovided
// by the provider system.
func (ps *ProviderSystem) Tracking() (<-chan cid.Cid, error) {
func (ps *System) Tracking() (<-chan cid.Cid, error) {
return ps.provider.Tracking()
}
// Reprovide triggers a reprovide
func (ps *ProviderSystem) Reprovide(ctx context.Context) error {
func (ps *System) Reprovide(ctx context.Context) error {
return ps.reprovider.Trigger(ctx)
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论