Unverified 提交 402af031 作者: Steven Allen 提交者: GitHub

Merge pull request #5979 from AuHau/doc/namesys/ttl

Improve "name publish" ttl option documentation
...@@ -78,7 +78,7 @@ Alternatively, publish an <ipfs-path> using a valid PeerID (as listed by ...@@ -78,7 +78,7 @@ Alternatively, publish an <ipfs-path> using a valid PeerID (as listed by
This accepts durations such as "300s", "1.5h" or "2h45m". Valid time units are This accepts durations such as "300s", "1.5h" or "2h45m". Valid time units are
"ns", "us" (or "µs"), "ms", "s", "m", "h".`).WithDefault("24h"), "ns", "us" (or "µs"), "ms", "s", "m", "h".`).WithDefault("24h"),
cmdkit.BoolOption(allowOfflineOptionName, "When offline, save the IPNS record to the the local datastore without broadcasting to the network instead of simply failing."), cmdkit.BoolOption(allowOfflineOptionName, "When offline, save the IPNS record to the the local datastore without broadcasting to the network instead of simply failing."),
cmdkit.StringOption(ttlOptionName, "Time duration this record should be cached for (caution: experimental)."), cmdkit.StringOption(ttlOptionName, "Time duration this record should be cached for. Uses the same syntax as the lifetime option. (caution: experimental)"),
cmdkit.StringOption(keyOptionName, "k", "Name of the key to be used or a valid PeerID, as listed by 'ipfs key list -l'.").WithDefault("self"), cmdkit.StringOption(keyOptionName, "k", "Name of the key to be used or a valid PeerID, as listed by 'ipfs key list -l'.").WithDefault("self"),
cmdkit.BoolOption(quieterOptionName, "Q", "Write only final hash."), cmdkit.BoolOption(quieterOptionName, "Q", "Write only final hash."),
}, },
......
...@@ -171,7 +171,7 @@ func emitOnceResult(ctx context.Context, outCh chan<- onceResult, r onceResult) ...@@ -171,7 +171,7 @@ func emitOnceResult(ctx context.Context, outCh chan<- onceResult, r onceResult)
// Publish implements Publisher // Publish implements Publisher
func (ns *mpns) Publish(ctx context.Context, name ci.PrivKey, value path.Path) error { func (ns *mpns) Publish(ctx context.Context, name ci.PrivKey, value path.Path) error {
return ns.PublishWithEOL(ctx, name, value, time.Now().Add(DefaultRecordTTL)) return ns.PublishWithEOL(ctx, name, value, time.Now().Add(DefaultRecordEOL))
} }
func (ns *mpns) PublishWithEOL(ctx context.Context, name ci.PrivKey, value path.Path, eol time.Time) error { func (ns *mpns) PublishWithEOL(ctx context.Context, name ci.PrivKey, value path.Path, eol time.Time) error {
......
...@@ -24,7 +24,7 @@ import ( ...@@ -24,7 +24,7 @@ import (
const ipnsPrefix = "/ipns/" const ipnsPrefix = "/ipns/"
const PublishPutValTimeout = time.Minute const PublishPutValTimeout = time.Minute
const DefaultRecordTTL = 24 * time.Hour const DefaultRecordEOL = 24 * time.Hour
// IpnsPublisher is capable of publishing and resolving names to the IPFS // IpnsPublisher is capable of publishing and resolving names to the IPFS
// routing system. // routing system.
...@@ -48,7 +48,7 @@ func NewIpnsPublisher(route routing.ValueStore, ds ds.Datastore) *IpnsPublisher ...@@ -48,7 +48,7 @@ func NewIpnsPublisher(route routing.ValueStore, ds ds.Datastore) *IpnsPublisher
// and publishes it out to the routing system // and publishes it out to the routing system
func (p *IpnsPublisher) Publish(ctx context.Context, k ci.PrivKey, value path.Path) error { func (p *IpnsPublisher) Publish(ctx context.Context, k ci.PrivKey, value path.Path) error {
log.Debugf("Publish %s", value) log.Debugf("Publish %s", value)
return p.PublishWithEOL(ctx, k, value, time.Now().Add(DefaultRecordTTL)) return p.PublishWithEOL(ctx, k, value, time.Now().Add(DefaultRecordEOL))
} }
func IpnsDsKey(id peer.ID) ds.Key { func IpnsDsKey(id peer.ID) ds.Key {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论