Refactor etcd into object and add exit timers
This refactors my etcd use into a struct (object) wrapper, which makes it easier to add an exit on converged timer.
This commit is contained in:
@@ -95,7 +95,7 @@ func (g *Graph) SetName(name string) {
|
||||
g.Name = name
|
||||
}
|
||||
|
||||
func (g *Graph) State() graphState {
|
||||
func (g *Graph) GetState() graphState {
|
||||
g.mutex.Lock()
|
||||
defer g.mutex.Unlock()
|
||||
return g.state
|
||||
@@ -577,6 +577,12 @@ func (g *Graph) Exit() {
|
||||
}
|
||||
}
|
||||
|
||||
func (g *Graph) SetConvergedCallback(ctimeout int, converged chan bool) {
|
||||
for v := range g.GetVerticesChan() {
|
||||
v.Type.SetConvegedCallback(ctimeout, converged)
|
||||
}
|
||||
}
|
||||
|
||||
// in array function to test *vertices in a slice of *vertices
|
||||
func HasVertex(v *Vertex, haystack []*Vertex) bool {
|
||||
for _, r := range haystack {
|
||||
|
||||
Reference in New Issue
Block a user