Skip to content

Commit

Permalink
Merge pull request #6832 from ipfs/chore/update-deps
Browse files Browse the repository at this point in the history
chore(dep): update deps
  • Loading branch information
Stebalien authored Jan 29, 2020
2 parents 8e0f92b + 906f45e commit 37e0a60
Show file tree
Hide file tree
Showing 26 changed files with 157 additions and 145 deletions.
2 changes: 1 addition & 1 deletion cmd/ipfs/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ func daemonFunc(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment
// check transport encryption flag.
unencrypted, _ := req.Options[unencryptTransportKwd].(bool)
if unencrypted {
log.Warningf(`Running with --%s: All connections are UNENCRYPTED.
log.Warnf(`Running with --%s: All connections are UNENCRYPTED.
You will not be able to connect to regular encrypted networks.`, unencryptTransportKwd)
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/ipfs/daemon_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
package main

import (
daemon "github.com/coreos/go-systemd/daemon"
daemon "github.com/coreos/go-systemd/v22/daemon"
)

func notifyReady() {
Expand Down
10 changes: 1 addition & 9 deletions core/bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/peerstore"
"github.com/libp2p/go-libp2p-core/routing"
"github.com/libp2p/go-libp2p-loggables"
)

var log = logging.Logger("bootstrap")
Expand Down Expand Up @@ -80,16 +79,14 @@ func Bootstrap(id peer.ID, host host.Host, rt routing.Routing, cfg BootstrapConf
if len(cfg.BootstrapPeers()) == 0 {
// We *need* to bootstrap but we have no bootstrap peers
// configured *at all*, inform the user.
log.Warning("no bootstrap nodes configured: go-ipfs may have difficulty connecting to the network")
log.Warn("no bootstrap nodes configured: go-ipfs may have difficulty connecting to the network")
}

// the periodic bootstrap function -- the connection supervisor
periodic := func(worker goprocess.Process) {
ctx := goprocessctx.OnClosingContext(worker)
defer log.EventBegin(ctx, "periodicBootstrap", id).Done()

if err := bootstrapRound(ctx, host, cfg); err != nil {
log.Event(ctx, "bootstrapError", id, loggables.Error(err))
log.Debugf("%s bootstrap error: %s", id, err)
}

Expand Down Expand Up @@ -126,7 +123,6 @@ func bootstrapRound(ctx context.Context, host host.Host, cfg BootstrapConfig) er
// determine how many bootstrap connections to open
connected := host.Network().Peers()
if len(connected) >= cfg.MinPeerThreshold {
log.Event(ctx, "bootstrapSkip", id)
log.Debugf("%s core bootstrap skipped -- connected to %d (> %d) nodes",
id, len(connected), cfg.MinPeerThreshold)
return nil
Expand All @@ -150,7 +146,6 @@ func bootstrapRound(ctx context.Context, host host.Host, cfg BootstrapConfig) er
// connect to a random susbset of bootstrap candidates
randSubset := randomSubsetOfPeers(notConnected, numToDial)

defer log.EventBegin(ctx, "bootstrapStart", id).Done()
log.Debugf("%s bootstrapping to %d nodes: %s", id, numToDial, randSubset)
return bootstrapConnect(ctx, host, randSubset)
}
Expand All @@ -172,17 +167,14 @@ func bootstrapConnect(ctx context.Context, ph host.Host, peers []peer.AddrInfo)
wg.Add(1)
go func(p peer.AddrInfo) {
defer wg.Done()
defer log.EventBegin(ctx, "bootstrapDial", ph.ID(), p.ID).Done()
log.Debugf("%s bootstrapping to %s", ph.ID(), p.ID)

ph.Peerstore().AddAddrs(p.ID, p.Addrs, peerstore.PermanentAddrTTL)
if err := ph.Connect(ctx, p); err != nil {
log.Event(ctx, "bootstrapDialFailed", p.ID)
log.Debugf("failed to bootstrap with %v: %s", p.ID, err)
errs <- err
return
}
log.Event(ctx, "bootstrapDialSuccess", p.ID)
log.Infof("bootstrapped with %v", p.ID)
}(p)
}
Expand Down
2 changes: 1 addition & 1 deletion core/commands/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ You can now check what blocks have been created by:
go func() {
size, err := req.Files.Size()
if err != nil {
log.Warningf("error getting files size: %s", err)
log.Warnf("error getting files size: %s", err)
// see comment above
return
}
Expand Down
2 changes: 1 addition & 1 deletion core/commands/cat.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ var CatCmd = &cmds.Command{
return err
}
default:
log.Warningf("cat postrun: received unexpected type %T", val)
log.Warnf("cat postrun: received unexpected type %T", val)
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func (n *IpfsNode) Bootstrap(cfg bootstrap.BootstrapConfig) error {
cfg.BootstrapPeers = func() []peer.AddrInfo {
ps, err := n.loadBootstrapPeers()
if err != nil {
log.Warning("failed to parse bootstrap peers from config")
log.Warn("failed to parse bootstrap peers from config")
return nil
}
return ps
Expand Down
2 changes: 1 addition & 1 deletion core/corehttp/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ var defaultLocalhostOrigins = []string{
func addCORSFromEnv(c *cmdsHttp.ServerConfig) {
origin := os.Getenv(originEnvKey)
if origin != "" {
log.Warning(originEnvKeyDeprecate)
log.Warn(originEnvKeyDeprecate)
c.AppendAllowedOrigins(origin)
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/corehttp/gateway_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ func webError(w http.ResponseWriter, message string, err error, defaultCode int)
func webErrorWithCode(w http.ResponseWriter, message string, err error, code int) {
http.Error(w, fmt.Sprintf("%s: %s", message, err), code)
if code >= 500 {
log.Warningf("server error: %s: %s", err)
log.Warnf("server error: %s: %s", err)
}
}

Expand Down
2 changes: 1 addition & 1 deletion core/corehttp/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func LogOption() ServeOption {
w.WriteHeader(200)
wnf, errs := newWriteErrNotifier(w)
lwriter.WriterGroup.AddWriter(wnf)
log.Event(n.Context(), "log API client connected")
log.Event(n.Context(), "log API client connected") //nolint deprecated
<-errs
})
return mux, nil
Expand Down
3 changes: 1 addition & 2 deletions core/corerepo/gc.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,11 @@ func (gc *GC) maybeGC(ctx context.Context, offset uint64) error {

if storage+offset > gc.StorageGC {
if storage+offset > gc.StorageMax {
log.Warningf("pre-GC: %s", ErrMaxStorageExceeded)
log.Warnf("pre-GC: %s", ErrMaxStorageExceeded)
}

// Do GC here
log.Info("Watermark exceeded. Starting repo GC...")
defer log.EventBegin(ctx, "repoGC").Done()

if err := GarbageCollect(gc.Node, ctx); err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion core/node/libp2p/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func (dh *discoveryHandler) HandlePeerFound(p peer.AddrInfo) {
ctx, cancel := context.WithTimeout(dh.ctx, discoveryConnTimeout)
defer cancel()
if err := dh.host.Connect(ctx, p); err != nil {
log.Warningf("failed to connect to peer %s found by discovery: %s", p.ID, err)
log.Warnf("failed to connect to peer %s found by discovery: %s", p.ID, err)
}
}

Expand Down
4 changes: 2 additions & 2 deletions core/node/libp2p/pnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ func PNetChecker(repo repo.Repo, ph host.Host, lc fx.Lifecycle) error {
select {
case <-t.C:
if len(ph.Network().Peers()) == 0 {
log.Warning("We are in private network and have no peers.")
log.Warning("This might be configuration mistake.")
log.Warn("We are in private network and have no peers.")
log.Warn("This might be configuration mistake.")
}
case <-done:
return
Expand Down
2 changes: 1 addition & 1 deletion core/node/libp2p/smux.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func makeSmuxTransportOption(mplexExp bool) libp2p.Option {
for _, id := range order {
tpt, ok := muxers[id]
if !ok {
log.Warning("unknown or duplicate muxer in LIBP2P_MUX_PREFS: %s", id)
log.Warn("unknown or duplicate muxer in LIBP2P_MUX_PREFS: %s", id)
continue
}
delete(muxers, id)
Expand Down
2 changes: 1 addition & 1 deletion core/node/libp2p/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func Security(enabled, preferTLS bool) interface{} {
if !enabled {
return func() (opts Libp2pOpts) {
// TODO: shouldn't this be Errorf to guarantee visibility?
log.Warningf(`Your IPFS node has been configured to run WITHOUT ENCRYPTED CONNECTIONS.
log.Warnf(`Your IPFS node has been configured to run WITHOUT ENCRYPTED CONNECTIONS.
You will not be able to connect to any nodes configured to use encrypted connections`)
opts.Opts = append(opts.Opts, libp2p.NoSecurity)
return opts
Expand Down
2 changes: 1 addition & 1 deletion fuse/ipns/ipns_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ func (s *Root) Lookup(ctx context.Context, name string) (fs.Node, error) {
ipnsName := "/ipns/" + name
resolved, err := s.Ipfs.Namesys.Resolve(s.Ipfs.Context(), ipnsName)
if err != nil {
log.Warningf("ipns: namesys resolve error: %s", err)
log.Warnf("ipns: namesys resolve error: %s", err)
return nil, fuse.ENOENT
}

Expand Down
4 changes: 2 additions & 2 deletions fuse/mount/fuse.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,15 @@ func (m *mount) unmount() error {
m.setActive(false)
return nil
}
log.Warningf("fuse unmount err: %s", err)
log.Warnf("fuse unmount err: %s", err)

// try closing the fuseConn
err = m.fuseConn.Close()
if err == nil {
m.setActive(false)
return nil
}
log.Warningf("fuse conn error: %s", err)
log.Warnf("fuse conn error: %s", err)

// try mount.ForceUnmountManyTimes
if err := ForceUnmountManyTimes(m, 10); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions fuse/mount/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type Mount interface {
// It does so by calling diskutil or fusermount directly.
func ForceUnmount(m Mount) error {
point := m.MountPoint()
log.Warningf("Force-Unmounting %s...", point)
log.Warnf("Force-Unmounting %s...", point)

cmd, err := UnmountCmd(point)
if err != nil {
Expand Down Expand Up @@ -98,7 +98,7 @@ type closer struct {
}

func (c *closer) Close() error {
log.Warning(" (c *closer) Close(),", c.M.MountPoint())
log.Warn(" (c *closer) Close(),", c.M.MountPoint())
return c.M.Unmount()
}

Expand Down
20 changes: 4 additions & 16 deletions fuse/readonly/readonly_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
fs "bazil.org/fuse/fs"
ipld "github.com/ipfs/go-ipld-format"
logging "github.com/ipfs/go-log"
lgbl "github.com/libp2p/go-libp2p-loggables"
)

var log = logging.Logger("fuse/ipfs")
Expand Down Expand Up @@ -186,7 +185,7 @@ func (s *Node) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {
}
nd, err := s.Ipfs.DAG.Get(ctx, lnk.Cid)
if err != nil {
log.Warning("error fetching directory child node: ", err)
log.Warn("error fetching directory child node: ", err)
}

t := fuse.DT_Unknown
Expand All @@ -195,7 +194,7 @@ func (s *Node) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {
t = fuse.DT_File
case *mdag.ProtoNode:
if fsn, err := ft.FSNodeFromBytes(nd.Data()); err != nil {
log.Warning("failed to unmarshal protonode data field:", err)
log.Warn("failed to unmarshal protonode data field:", err)
} else {
switch fsn.Type() {
case ft.TDirectory, ft.THAMTShard:
Expand Down Expand Up @@ -238,22 +237,11 @@ func (s *Node) Readlink(ctx context.Context, req *fuse.ReadlinkRequest) (string,
}

func (s *Node) Read(ctx context.Context, req *fuse.ReadRequest, resp *fuse.ReadResponse) error {
c := s.Nd.Cid()

// setup our logging event
lm := make(lgbl.DeferredMap)
lm["fs"] = "ipfs"
lm["key"] = func() interface{} { return c.String() }
lm["req_offset"] = req.Offset
lm["req_size"] = req.Size
defer log.EventBegin(ctx, "fuseRead", lm).Done()

r, err := uio.NewDagReader(ctx, s.Nd, s.Ipfs.DAG)
if err != nil {
return err
}
o, err := r.Seek(req.Offset, io.SeekStart)
lm["res_offset"] = o
_, err = r.Seek(req.Offset, io.SeekStart)
if err != nil {
return err
}
Expand All @@ -266,7 +254,7 @@ func (s *Node) Read(ctx context.Context, req *fuse.ReadRequest, resp *fuse.ReadR
default:
return err
}
lm["res_size"] = n
resp.Data = resp.Data[:n]
return nil // may be non-nil / not succeeded
}

Expand Down
16 changes: 0 additions & 16 deletions gc/gc.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,7 @@ type Result struct {
func GC(ctx context.Context, bs bstore.GCBlockstore, dstor dstore.Datastore, pn pin.Pinner, bestEffortRoots []cid.Cid) <-chan Result {
ctx, cancel := context.WithCancel(ctx)

elock := log.EventBegin(ctx, "GC.lockWait")
unlocker := bs.GCLock()
elock.Done()
elock = log.EventBegin(ctx, "GC.locked")
emark := log.EventBegin(ctx, "GC.mark")

bsrv := bserv.New(bs, offline.Exchange(bs))
ds := dag.NewDAGService(bsrv)
Expand All @@ -55,7 +51,6 @@ func GC(ctx context.Context, bs bstore.GCBlockstore, dstor dstore.Datastore, pn
defer cancel()
defer close(output)
defer unlocker.Unlock()
defer elock.Done()

gcs, err := ColoredSet(ctx, pn, ds, bestEffortRoots, output)
if err != nil {
Expand All @@ -65,12 +60,6 @@ func GC(ctx context.Context, bs bstore.GCBlockstore, dstor dstore.Datastore, pn
}
return
}
emark.Append(logging.LoggableMap{
"blackSetSize": fmt.Sprintf("%d", gcs.Len()),
})
emark.Done()
esweep := log.EventBegin(ctx, "GC.sweep")

keychan, err := bs.AllKeysChan(ctx)
if err != nil {
select {
Expand Down Expand Up @@ -113,10 +102,6 @@ func GC(ctx context.Context, bs bstore.GCBlockstore, dstor dstore.Datastore, pn
break loop
}
}
esweep.Append(logging.LoggableMap{
"whiteSetSize": fmt.Sprintf("%d", removed),
})
esweep.Done()
if errors {
select {
case output <- Result{Error: ErrCannotDeleteSomeBlocks}:
Expand All @@ -125,7 +110,6 @@ func GC(ctx context.Context, bs bstore.GCBlockstore, dstor dstore.Datastore, pn
}
}

defer log.EventBegin(ctx, "GC.datastore").Done()
gds, ok := dstor.(dstore.GCDatastore)
if !ok {
return
Expand Down
Loading

0 comments on commit 37e0a60

Please sign in to comment.