Skip to content

Commit

Permalink
Rename ProviderSystem to System
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Michael Avila <davidmichaelavila@gmail.com>
  • Loading branch information
michaelavila committed Apr 12, 2019
1 parent f8c8d85 commit 2d1a4c2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion core/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
12 changes: 6 additions & 6 deletions core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 10 additions & 10 deletions provider/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
}

0 comments on commit 2d1a4c2

Please sign in to comment.