Made fixes for group

gql_cataclysm
noah metz 2023-10-03 20:14:26 -06:00
parent 3ef0a98a17
commit e042384b3f
4 changed files with 20 additions and 1 deletions

@ -1330,7 +1330,12 @@ func NewContext(db * badger.DB, log Logger) (*Context, error) {
return nil, err return nil, err
} }
err = ctx.RegisterNodeType(GQLNodeType, []ExtType{GroupExtType, GQLExtType}) err = ctx.RegisterNodeType(GroupNodeType, []ExtType{GroupExtType})
if err != nil {
return nil, err
}
err = ctx.RegisterNodeType(GQLNodeType, []ExtType{GQLExtType})
if err != nil { if err != nil {
return nil, err return nil, err
} }

@ -1285,6 +1285,18 @@ func (ext *GQLExt) FreeResponseChannel(req_id uuid.UUID) chan Signal {
func (ext *GQLExt) Process(ctx *Context, node *Node, source NodeID, signal Signal) Messages { func (ext *GQLExt) Process(ctx *Context, node *Node, source NodeID, signal Signal) Messages {
// Process ReadResultSignalType by forwarding it to the waiting resolver // Process ReadResultSignalType by forwarding it to the waiting resolver
switch sig := signal.(type) { switch sig := signal.(type) {
case *SuccessSignal:
response_chan := ext.FreeResponseChannel(sig.ReqID)
if response_chan != nil {
select {
case response_chan <- sig:
ctx.Log.Logf("gql", "Forwarded success to resolver, %+v", sig.ReqID)
default:
ctx.Log.Logf("gql", "Resolver channel overflow %+v", sig)
}
} else {
ctx.Log.Logf("gql", "received success signal response %+v with no mapped resolver", sig)
}
case *ErrorSignal: case *ErrorSignal:
// TODO: Forward to resolver if waiting for it // TODO: Forward to resolver if waiting for it
response_chan := ext.FreeResponseChannel(sig.ReqID) response_chan := ext.FreeResponseChannel(sig.ReqID)

@ -308,6 +308,7 @@ func nodeLoop(ctx *Context, node *Node) error {
} }
} }
node.PendingACLs[msg.Signal.ID()] = PendingACL{len(msgs), timeout_signal.ID(), msg.Signal.Permission(), princ_id, msgs, []Signal{}, msg.Signal, msg.Source} node.PendingACLs[msg.Signal.ID()] = PendingACL{len(msgs), timeout_signal.ID(), msg.Signal.Permission(), princ_id, msgs, []Signal{}, msg.Signal, msg.Source}
ctx.Log.Logf("policy", "Sending signals for pending ACL: %+v", msgs)
ctx.Send(msgs) ctx.Send(msgs)
continue continue
} else if resp == Allow { } else if resp == Allow {

@ -86,6 +86,7 @@ var (
GQLNodeType = NewNodeType("GQL") GQLNodeType = NewNodeType("GQL")
BaseNodeType = NewNodeType("BASE") BaseNodeType = NewNodeType("BASE")
GroupNodeType = NewNodeType("GROUP")
StopSignalType = NewSignalType("STOP") StopSignalType = NewSignalType("STOP")
CreateSignalType = NewSignalType("CREATE") CreateSignalType = NewSignalType("CREATE")