提交 d4037f5f 作者: Juan Batiz-Benet

ipnsfs: remove "Publishing!" println

use `log.Info(...)` and `defer log.Event(...).Done()` instead

License: MIT
Signed-off-by: 's avatarJuan Batiz-Benet <juan@benet.ai>
上级 4ff59234
...@@ -12,7 +12,6 @@ package ipnsfs ...@@ -12,7 +12,6 @@ package ipnsfs
import ( import (
"errors" "errors"
"fmt"
"os" "os"
"sync" "sync"
"time" "time"
...@@ -120,6 +119,7 @@ type FSNode interface { ...@@ -120,6 +119,7 @@ type FSNode interface {
// KeyRoot represents the root of a filesystem tree pointed to by a given keypair // KeyRoot represents the root of a filesystem tree pointed to by a given keypair
type KeyRoot struct { type KeyRoot struct {
key ci.PrivKey key ci.PrivKey
name string
// node is the merkledag node pointed to by this keypair // node is the merkledag node pointed to by this keypair
node *dag.Node node *dag.Node
...@@ -146,6 +146,7 @@ func (fs *Filesystem) newKeyRoot(parent context.Context, k ci.PrivKey) (*KeyRoot ...@@ -146,6 +146,7 @@ func (fs *Filesystem) newKeyRoot(parent context.Context, k ci.PrivKey) (*KeyRoot
root := new(KeyRoot) root := new(KeyRoot)
root.key = k root.key = k
root.fs = fs root.fs = fs
root.name = name
ctx, cancel := context.WithCancel(parent) ctx, cancel := context.WithCancel(parent)
defer cancel() defer cancel()
...@@ -230,8 +231,13 @@ func (kr *KeyRoot) Publish(ctx context.Context) error { ...@@ -230,8 +231,13 @@ func (kr *KeyRoot) Publish(ctx context.Context) error {
// otherwise we are holding the lock through a costly // otherwise we are holding the lock through a costly
// network operation // network operation
fmt.Println("Publishing!") kp := path.FromKey(k)
return kr.fs.nsys.Publish(ctx, kr.key, path.FromKey(k))
ev := &eventlog.Metadata{"name": kr.name, "key": kp}
defer log.EventBegin(ctx, "ipnsfsPublishing", ev).Done()
log.Info("ipnsfs publishing %s -> %s", kr.name, kp)
return kr.fs.nsys.Publish(ctx, kr.key, kp)
} }
// Republisher manages when to publish the ipns entry associated with a given key // Republisher manages when to publish the ipns entry associated with a given key
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论