Renamed update to PropagateUpdate

graph-rework
noah metz 2023-06-18 19:14:07 -06:00
parent 4f7d172731
commit 30b539ad74
4 changed files with 7 additions and 7 deletions

@ -10,7 +10,7 @@ import (
) )
// Update the events listeners, and notify the parent to do the same // Update the events listeners, and notify the parent to do the same
func (event * BaseEvent) update(signal GraphSignal) { func (event * BaseEvent) PropagateUpdate(signal GraphSignal) {
if signal.Downwards() == false { if signal.Downwards() == false {
// Child->Parent // Child->Parent
event.parent_lock.Lock() event.parent_lock.Lock()

@ -873,9 +873,9 @@ func NewGQLServer(listen string, extended_types map[reflect.Type]*graphql.Object
return server return server
} }
func (server * GQLServer) update(signal GraphSignal) { func (server * GQLServer) PropagateUpdate(signal GraphSignal) {
server.signal <- signal server.signal <- signal
server.BaseResource.update(signal) server.BaseResource.PropagateUpdate(signal)
} }
func GQLSubscribeSignal(p graphql.ResolveParams) (interface{}, error) { func GQLSubscribeSignal(p graphql.ResolveParams) (interface{}, error) {

@ -154,7 +154,7 @@ type GraphNode interface {
Description() string Description() string
ID() string ID() string
UpdateListeners(update GraphSignal) UpdateListeners(update GraphSignal)
update(update GraphSignal) PropagateUpdate(update GraphSignal)
RegisterChannel(listener chan GraphSignal) RegisterChannel(listener chan GraphSignal)
UnregisterChannel(listener chan GraphSignal) UnregisterChannel(listener chan GraphSignal)
UpdateChannel() chan GraphSignal UpdateChannel() chan GraphSignal
@ -255,7 +255,7 @@ func (node * BaseNode) UpdateListeners(update GraphSignal) {
node.listeners_lock.Unlock() node.listeners_lock.Unlock()
} }
func (node * BaseNode) update(signal GraphSignal) { func (node * BaseNode) PropagateUpdate(signal GraphSignal) {
} }
func SendUpdate(node GraphNode, signal GraphSignal) { func SendUpdate(node GraphNode, signal GraphSignal) {
@ -265,6 +265,6 @@ func SendUpdate(node GraphNode, signal GraphSignal) {
} }
log.Logf("update", "UPDATE %s <- %s: %+v", node_name, signal.Source(), signal) log.Logf("update", "UPDATE %s <- %s: %+v", node_name, signal.Source(), signal)
node.UpdateListeners(signal) node.UpdateListeners(signal)
node.update(signal) node.PropagateUpdate(signal)
} }

@ -8,7 +8,7 @@ import (
// Resources propagate update up to multiple parents, and not downwards // Resources propagate update up to multiple parents, and not downwards
// (subscriber to team won't get update to alliance, but subscriber to alliance will get update to team) // (subscriber to team won't get update to alliance, but subscriber to alliance will get update to team)
func (resource * BaseResource) update(signal GraphSignal) { func (resource * BaseResource) PropagateUpdate(signal GraphSignal) {
if signal.Downwards() == false { if signal.Downwards() == false {
// Child->Parent, resource updates parent resources // Child->Parent, resource updates parent resources