Commit aae27bf2 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent c541c99c
// Copyright (C) 2017 Nexedi SA and Contributors. // Copyright (C) 2017-2021 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com> // Kirill Smelkov <kirr@nexedi.com>
// //
// This program is free software: you can Use, Study, Modify and Redistribute // This program is free software: you can Use, Study, Modify and Redistribute
// it under the terms of the GNU General Public License version 3, or (at your // it under the terms of the GNU General Public License version 3, or (at your
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
// See COPYING file for full licensing terms. // See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options. // See https://www.nexedi.com/licensing for rationale and options.
// Package task provides handy utilities to define & log tasks. // Package task provides handy utilities to define & trace tasks.
package task package task
import ( import (
...@@ -46,19 +46,21 @@ func Runningf(ctxp *context.Context, format string, argv ...interface{}) func(*e ...@@ -46,19 +46,21 @@ func Runningf(ctxp *context.Context, format string, argv ...interface{}) func(*e
func running(ctxp *context.Context, name string) func(*error) { func running(ctxp *context.Context, name string) func(*error) {
ctx := taskctx.Running(*ctxp, name) ctx := taskctx.Running(*ctxp, name)
*ctxp = ctx *ctxp = ctx
log.Depth(2).Info(ctx, "start") log.Depth(2).Info(ctx, "start") // XXX log -> trace
return func(errp *error) { return func(errp *error) {
if *errp != nil { if *errp != nil {
// XXX is it good idea to log to error here? (not in above layer) // XXX is it good idea to log to error here? (not in above layer)
// XXX what is error here could be not so error above // XXX what is error here could be not so error above
// XXX or we still want to log all errors - right? // XXX or we still want to log all errors - right?
log.Depth(1).Warning(ctx, "## ", *errp) // XXX "::" temp //
// -> yes, we do want to trace unconditionally when a task is finished
// here it is tracing, just with trace sink being hardcoded to log.
log.Depth(1).Warning(ctx, "## ", *errp) // XXX "##" temp
} else { } else {
log.Depth(1).Info(ctx, "done") log.Depth(1).Info(ctx, "done")
} }
// XXX do we need vvv if we log it anyway ^^^ ?
// NOTE not *ctxp here - as context pointed by ctxp could be // NOTE not *ctxp here - as context pointed by ctxp could be
// changed when this deferred function is run // changed when this deferred function is run
taskctx.ErrContext(errp, ctx) taskctx.ErrContext(errp, ctx)
......
...@@ -238,7 +238,7 @@ func (c *Client) talkMaster(ctx context.Context) (err error) { ...@@ -238,7 +238,7 @@ func (c *Client) talkMaster(ctx context.Context) (err error) {
// TODO if err = shutdown -> return // TODO if err = shutdown -> return
// exit on cancel / throttle reconnecting // exit on cancel / throttle reconnecting
select { select {
case <-ctx.Done(): case <-ctx.Done():
return ctx.Err() return ctx.Err()
......
...@@ -180,7 +180,7 @@ func (stor *Storage) talkMaster(ctx context.Context) (err error) { ...@@ -180,7 +180,7 @@ func (stor *Storage) talkMaster(ctx context.Context) (err error) {
// TODO if err = shutdown -> return // TODO if err = shutdown -> return
// exit on cancel / throttle reconnecting // exit on cancel / throttle reconnecting
select { select {
case <-ctx.Done(): case <-ctx.Done():
return ctx.Err() return ctx.Err()
......
...@@ -52,7 +52,7 @@ type tEnv struct { ...@@ -52,7 +52,7 @@ type tEnv struct {
// Create it with tEnv.NewCluster. // Create it with tEnv.NewCluster.
// Create nodes with .NewMaster, .NewStorage and .NewClient. // Create nodes with .NewMaster, .NewStorage and .NewClient.
// //
// NOTE network addresses are predictable due to using pipenet/lonet for inter-networking. // NOTE network addresses are predictable due to using pipenet/lonet for inter-node networking.
// //
// XXX text about events tracing // XXX text about events tracing
type tCluster struct { type tCluster struct {
...@@ -379,7 +379,7 @@ func (m *tMaster) Run(ctx context.Context) error { ...@@ -379,7 +379,7 @@ func (m *tMaster) Run(ctx context.Context) error {
return m.Master.Run(ctx, l) return m.Master.Run(ctx, l)
} }
// ------- // -------------------
// Verify verifies f for all combinations of node kinds. // Verify verifies f for all combinations of node kinds.
// XXX place // XXX place
...@@ -408,7 +408,7 @@ func Verify(t *testing.T, f func(*tEnv)) { ...@@ -408,7 +408,7 @@ func Verify(t *testing.T, f func(*tEnv)) {
} }
// -------- // --------------------
// tNewCluster_MS starts simple NEO cluster with 1 master and 1 storage nodes. // tNewCluster_MS starts simple NEO cluster with 1 master and 1 storage nodes.
// The cluster is returned in ready-to-start state. // The cluster is returned in ready-to-start state.
......
// Copyright (C) 2017-2020 Nexedi SA and Contributors. // Copyright (C) 2017-2021 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com> // Kirill Smelkov <kirr@nexedi.com>
// //
// This program is free software: you can Use, Study, Modify and Redistribute // This program is free software: you can Use, Study, Modify and Redistribute
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment