Remvoed Node.Signal and replaced with Context.Send

gql_cataclysm
noah metz 2023-07-27 16:13:43 -06:00
parent 6b375245df
commit 9d31394707
3 changed files with 5 additions and 9 deletions

@ -31,7 +31,7 @@ func TestGQLDB(t * testing.T) {
NewGroupExt(nil)) NewGroupExt(nil))
ctx.Log.Logf("test", "GQL_ID: %s", gql.ID) ctx.Log.Logf("test", "GQL_ID: %s", gql.ID)
err = gql.Signal(ctx, gql.ID, StopSignal) err = ctx.Send(gql.ID, gql.ID, StopSignal)
fatalErr(t, err) fatalErr(t, err)
(*GraphTester)(t).WaitForStatus(ctx, listener_ext.Chan, "stopped", 100*time.Millisecond, "Didn't receive stopped on listener") (*GraphTester)(t).WaitForStatus(ctx, listener_ext.Chan, "stopped", 100*time.Millisecond, "Didn't receive stopped on listener")
@ -47,7 +47,7 @@ func TestGQLDB(t * testing.T) {
fatalErr(t, err) fatalErr(t, err)
listener_ext, err = GetExt[*ListenerExt](gql_loaded) listener_ext, err = GetExt[*ListenerExt](gql_loaded)
fatalErr(t, err) fatalErr(t, err)
err = gql_loaded.Signal(ctx, gql_loaded.ID, StopSignal) err = ctx.Send(gql_loaded.ID, gql_loaded.ID, StopSignal)
fatalErr(t, err) fatalErr(t, err)
(*GraphTester)(t).WaitForStatus(ctx, listener_ext.Chan, "stopped", 100*time.Millisecond, "Didn't receive stopped on update_channel_2") (*GraphTester)(t).WaitForStatus(ctx, listener_ext.Chan, "stopped", 100*time.Millisecond, "Didn't receive stopped on update_channel_2")

@ -93,7 +93,7 @@ func (ext *LockableExt) Process(ctx *Context, source NodeID, node *Node, signal
case Up: case Up:
owner_sent := false owner_sent := false
for _, dependency := range(ext.Dependencies) { for _, dependency := range(ext.Dependencies) {
err := node.Signal(ctx, dependency, signal) err := ctx.Send(node.ID, dependency, signal)
if err != nil { if err != nil {
ctx.Log.Logf("signal", "LOCKABLE_SIGNAL_ERR: %s->%s - %e", node.ID, dependency, err) ctx.Log.Logf("signal", "LOCKABLE_SIGNAL_ERR: %s->%s - %e", node.ID, dependency, err)
} }
@ -107,7 +107,7 @@ func (ext *LockableExt) Process(ctx *Context, source NodeID, node *Node, signal
if ext.Owner != nil && owner_sent == false { if ext.Owner != nil && owner_sent == false {
if *ext.Owner != node.ID { if *ext.Owner != node.ID {
err := node.Signal(ctx, *ext.Owner, signal) err := ctx.Send(node.ID, *ext.Owner, signal)
if err != nil { if err != nil {
ctx.Log.Logf("signal", "LOCKABLE_SIGNAL_ERR: %s->%s - %e", node.ID, *ext.Owner, err) ctx.Log.Logf("signal", "LOCKABLE_SIGNAL_ERR: %s->%s - %e", node.ID, *ext.Owner, err)
} }
@ -115,7 +115,7 @@ func (ext *LockableExt) Process(ctx *Context, source NodeID, node *Node, signal
} }
case Down: case Down:
for _, requirement := range(ext.Requirements) { for _, requirement := range(ext.Requirements) {
err := node.Signal(ctx, requirement, signal) err := ctx.Send(node.ID, requirement, signal)
if err != nil { if err != nil {
ctx.Log.Logf("signal", "LOCKABLE_SIGNAL_ERR: %s->%s - %e", node.ID, requirement, err) ctx.Log.Logf("signal", "LOCKABLE_SIGNAL_ERR: %s->%s - %e", node.ID, requirement, err)
} }

@ -189,10 +189,6 @@ func (node *Node) Process(ctx *Context, source NodeID, signal Signal) {
} }
} }
func (node *Node) Signal(ctx *Context, dest NodeID, signal Signal) error {
return ctx.Send(node.ID, dest, signal)
}
func GetCtx[T Extension, C any](ctx *Context) (C, error) { func GetCtx[T Extension, C any](ctx *Context) (C, error) {
var zero T var zero T
var zero_ctx C var zero_ctx C