提交 eac1c631 作者: Jeromy Johnson 提交者: GitHub

Merge pull request #3101 from ipfs/feat/reprovide-config

reprovider: add config option to set reprovide interval
...@@ -169,7 +169,20 @@ func (n *IpfsNode) startOnlineServices(ctx context.Context, routingOption Routin ...@@ -169,7 +169,20 @@ func (n *IpfsNode) startOnlineServices(ctx context.Context, routingOption Routin
} }
n.Reprovider = rp.NewReprovider(n.Routing, n.Blockstore) n.Reprovider = rp.NewReprovider(n.Routing, n.Blockstore)
go n.Reprovider.ProvideEvery(ctx, kReprovideFrequency)
if cfg.Reprovider.Interval != "0" {
interval := kReprovideFrequency
if cfg.Reprovider.Interval != "" {
dur, err := time.ParseDuration(cfg.Reprovider.Interval)
if err != nil {
return err
}
interval = dur
}
go n.Reprovider.ProvideEvery(ctx, interval)
}
// setup local discovery // setup local discovery
if do != nil { if do != nil {
......
...@@ -15,6 +15,7 @@ a running daemon do not read the config file at runtime. ...@@ -15,6 +15,7 @@ a running daemon do not read the config file at runtime.
- [`Identity`](#identity) - [`Identity`](#identity)
- [`Ipns`](#ipns) - [`Ipns`](#ipns)
- [`Mounts`](#mounts) - [`Mounts`](#mounts)
- [`ReproviderInterval`](#reproviderinterval)
- [`SupernodeRouting`](#supernoderouting) - [`SupernodeRouting`](#supernoderouting)
- [`Swarm`](#swarm) - [`Swarm`](#swarm)
- [`Tour`](#tour) - [`Tour`](#tour)
...@@ -192,6 +193,16 @@ Mountpoint for `/ipns/`. ...@@ -192,6 +193,16 @@ Mountpoint for `/ipns/`.
- `FuseAllowOther` - `FuseAllowOther`
Sets the FUSE allow other option on the mountpoint. Sets the FUSE allow other option on the mountpoint.
## `ReproviderInterval`
Sets the time between rounds of reproviding local content to the routing
system. If unset, it defaults to 12 hours. If set to the value `"0"` it will
disable content reproviding.
Note: disabling content reproviding will result in other nodes on the network
not being able to discover that you have the objects that you have. If you want
to have this disabled and keep the network aware of what you have, you must
manually announce your content periodically.
## `SupernodeRouting` ## `SupernodeRouting`
Deprecated. Deprecated.
......
...@@ -29,6 +29,8 @@ type Config struct { ...@@ -29,6 +29,8 @@ type Config struct {
SupernodeRouting SupernodeClientConfig // local node's routing servers (if SupernodeRouting enabled) SupernodeRouting SupernodeClientConfig // local node's routing servers (if SupernodeRouting enabled)
API API // local node's API settings API API // local node's API settings
Swarm SwarmConfig Swarm SwarmConfig
Reprovider Reprovider
} }
const ( const (
......
...@@ -68,6 +68,9 @@ func Init(out io.Writer, nBitsForKeypair int) (*Config, error) { ...@@ -68,6 +68,9 @@ func Init(out io.Writer, nBitsForKeypair int) (*Config, error) {
"Access-Control-Allow-Headers": []string{"X-Requested-With"}, "Access-Control-Allow-Headers": []string{"X-Requested-With"},
}, },
}, },
Reprovider: Reprovider{
Interval: "12h",
},
} }
return conf, nil return conf, nil
......
package config
type Reprovider struct {
Interval string // Time period to reprovide locally stored objects to the network
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论