Skip to content

Commit bc9d67c

Browse files
author
Valery Piashchynski
committed
Update names
1 parent a39a895 commit bc9d67c

File tree

9 files changed

+16
-14
lines changed

9 files changed

+16
-14
lines changed

endure.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ type Endure struct {
5454
retry bool
5555
maxInterval time.Duration
5656
initialInterval time.Duration
57-
// option to print resulted (before init) graph
58-
print bool
57+
// option to visualize resulted (before init) graph
58+
visualize bool
5959

6060
mutex *sync.RWMutex
6161

@@ -170,9 +170,9 @@ func SetBackoffTimes(initialInterval time.Duration, maxInterval time.Duration) O
170170
}
171171
}
172172

173-
func PrintGraph(print bool) Options {
173+
func Visualize(print bool) Options {
174174
return func(endure *Endure) {
175-
endure.print = print
175+
endure.visualize = print
176176
}
177177
}
178178

@@ -226,11 +226,11 @@ func (e *Endure) Init() error {
226226
}
227227

228228
// if failed - continue, just send warning to a user
229-
// print is not critical
230-
if e.print {
231-
err = structures.PrintGraph(e.graph.Vertices)
229+
// visualize is not critical
230+
if e.visualize {
231+
err = structures.Visualize(e.graph.Vertices)
232232
if err != nil {
233-
e.logger.Warn("failed to print the graph", zap.Error(err))
233+
e.logger.Warn("failed to visualize the graph", zap.Error(err))
234234
}
235235
}
236236

examples/sample_1/go.mod

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ require (
66
github.com/NYTimes/gziphandler v1.1.1
77
github.com/gorilla/mux v1.7.4
88
github.com/rs/cors v1.7.0
9-
github.com/spiral/endure v1.0.0-beta10
9+
github.com/spiral/endure v1.0.0-beta9
1010
go.etcd.io/bbolt v1.3.5
1111
)
12+
13+
replace github.com/spiral/endure v1.0.0-beta9 => /home/valery/Projects/opensource/spiral/endure

examples/sample_1/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
)
1515

1616
func main() {
17-
container, err := endure.NewContainer(endure.DebugLevel, endure.RetryOnFail(true), endure.PrintGraph(true))
17+
container, err := endure.NewContainer(endure.DebugLevel, endure.RetryOnFail(true), endure.Visualize(true))
1818
if err != nil {
1919
panic(err)
2020
}

internal.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ func (e *Endure) forceExitHandler(ctx context.Context, data chan *structures.Dll
534534
if err != nil {
535535
// TODO do not return until finished
536536
// just log the errors
537-
// stack it in slice and if slice is not empty, print it ??
537+
// stack it in slice and if slice is not empty, visualize it ??
538538
e.logger.Error("error occurred during the services stopping", zap.String("vertex id", node.Vertex.ID), zap.Error(err))
539539
}
540540
// exit from vertex poller
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"github.com/spiral/endure/errors"
88
)
99

10-
func PrintGraph(vertices []*Vertex) error {
10+
func Visualize(vertices []*Vertex) error {
1111
const op = errors.Op("print_graph")
1212
gr := graphviz.New()
1313
graph, err := gr.Graph()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"github.com/spiral/endure/errors"
77
)
88

9-
func PrintGraph(vertices []*Vertex) error {
9+
func Visualize(vertices []*Vertex) error {
1010
const op = errors.Op("print_graph")
1111
return errors.E(op, errors.Unsupported, errors.Str("windows currently not supported for this feature"))
1212
}

tests/happy_scenarios/graph.png

33.5 KB
Loading

tests/happy_scenarios/happyScenario_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func testLog(t *testing.T, level endure.Level) {
5757
}
5858

5959
func TestEndure_Init_OK(t *testing.T) {
60-
c, err := endure.NewContainer(endure.DebugLevel)
60+
c, err := endure.NewContainer(endure.DebugLevel, endure.Visualize(true))
6161
assert.NoError(t, err)
6262

6363
assert.NoError(t, c.Register(&plugin4.S4{}))

0 commit comments

Comments
 (0)