1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-30 09:59:13 +08:00

ipnsfs: remove "Publishing!" println

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

License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
This commit is contained in:
Juan Batiz-Benet
2015-07-28 23:51:56 -07:00
parent 4ff5923428
commit d4037f5f88

View File

@ -12,7 +12,6 @@ package ipnsfs
import ( import (
"errors" "errors"
"fmt"
"os" "os"
"sync" "sync"
"time" "time"
@ -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
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 {
// 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