Renamd Resource.Connect to Resource.Init
parent
bfd295b3db
commit
7e8045ce39
6
event.go
6
event.go
|
|
@ -18,11 +18,9 @@ func (event * BaseEvent) update(signal GraphSignal) {
|
|||
SendUpdate(event.parent, new_signal)
|
||||
}
|
||||
|
||||
source_id := signal.Last()
|
||||
|
||||
for _, resource := range(event.RequiredResources()) {
|
||||
source_id := ""
|
||||
if signal.Source() != nil {
|
||||
source_id = signal.Source().ID()
|
||||
}
|
||||
if source_id != resource.ID() {
|
||||
SendUpdate(resource, new_signal)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ func NewEventManager(root_event Event, dag_nodes []Resource) * EventManager {
|
|||
return manager;
|
||||
}
|
||||
|
||||
// Connect to all resources(in a thread to handle reconnections), and start the first event
|
||||
// Init to all resources(in a thread to handle reconnections), and start the first event
|
||||
func (manager * EventManager) Run() error {
|
||||
log.Logf("manager", "MANAGER_START")
|
||||
|
||||
|
|
@ -105,7 +105,7 @@ func (manager * EventManager) AddResource(resource Resource) error {
|
|||
}
|
||||
manager.dag_nodes[resource.ID()] = resource
|
||||
abort := make(chan error, 1)
|
||||
abort_used := resource.Connect(abort)
|
||||
abort_used := resource.Init(abort)
|
||||
if abort_used == true {
|
||||
manager.aborts = append(manager.aborts, abort)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,9 +47,9 @@ type Resource interface {
|
|||
LockState()
|
||||
UnlockState()
|
||||
|
||||
Init(abort chan error) bool
|
||||
lock(node GraphNode) error
|
||||
unlock(node GraphNode) error
|
||||
Connect(abort chan error) bool
|
||||
}
|
||||
|
||||
func AddParent(resource Resource, parent Resource) error {
|
||||
|
|
@ -200,7 +200,7 @@ func (resource * BaseResource) UnlockState() {
|
|||
resource.state_lock.Unlock()
|
||||
}
|
||||
|
||||
func (resource * BaseResource) Connect(abort chan error) bool {
|
||||
func (resource * BaseResource) Init(abort chan error) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
|
|||
7
vex.go
7
vex.go
|
|
@ -96,8 +96,8 @@ func (arena * VirtualArena) update(signal GraphSignal) {
|
|||
arena.BaseResource.update(signal)
|
||||
}
|
||||
|
||||
func (arena * VirtualArena) Connect(abort chan error) bool {
|
||||
log.Logf("vex", "Connecting %s", arena.Name())
|
||||
func (arena * VirtualArena) Init(abort chan error) bool {
|
||||
log.Logf("vex", "Initializing %s", arena.Name())
|
||||
go func(arena * VirtualArena, abort chan error) {
|
||||
update_str := fmt.Sprintf("VIRTUAL_ARENA connected: %s", arena.Name())
|
||||
signal := NewSignal(arena, "resource_connected")
|
||||
|
|
@ -130,6 +130,9 @@ func NewVexEvent(name string, description string) * VexEvent {
|
|||
event.actions["wait"] = EventWait(event)
|
||||
event.actions["start"] = func() (string, error) {
|
||||
log.Logf("vex", "STARTING_VEX_TOURNAMENT %s", event.Name())
|
||||
go func() {
|
||||
|
||||
}()
|
||||
return "wait", nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue