diff --git a/context.go b/context.go index 6ae2000..09117ad 100644 --- a/context.go +++ b/context.go @@ -146,7 +146,7 @@ func NewContext(db * badger.DB, log Logger) (*Context, error) { return nil, err } - err = ctx.RegisterNodeType(GQLNodeType, []ExtType{ACLExtType, GroupExtType, GQLExtType, ThreadExtType, LockableExtType}) + err = ctx.RegisterNodeType(GQLNodeType, []ExtType{ACLExtType, GroupExtType, GQLExtType, ThreadExtType}) if err != nil { return nil, err } diff --git a/gql_interfaces.go b/gql_interfaces.go index fe84d85..9bd9168 100644 --- a/gql_interfaces.go +++ b/gql_interfaces.go @@ -60,7 +60,7 @@ func AddThreadInterfaceFields(gql *GQLInterface) { } func addThreadInterfaceFields(gql *GQLInterface, gql_thread *GQLInterface) { - AddLockableInterfaceFields(gql) + AddNodeInterfaceFields(gql) gql.Interface.AddFieldConfig("Children", &graphql.Field{ Type: gql_thread.List, diff --git a/gql_test.go b/gql_test.go index 831c8c6..95e8914 100644 --- a/gql_test.go +++ b/gql_test.go @@ -25,11 +25,8 @@ func TestGQLDB(t * testing.T) { ctx.Log.Logf("test", "U1_ID: %s", u1.ID) - l1, listener_ext := NewSimpleListener(ctx, 10) - ctx.Log.Logf("test", "L1_ID: %s", l1.ID) - TestThreadNodeType := NodeType("TEST_THREAD") - err = ctx.RegisterNodeType(TestThreadNodeType, []ExtType{ACLExtType, ThreadExtType, LockableExtType}) + err = ctx.RegisterNodeType(TestThreadNodeType, []ExtType{ACLExtType, ThreadExtType}) fatalErr(t, err) t1_policy_1 := NewParentOfPolicy(Actions{"signal.abort", "state.write"}) @@ -42,8 +39,7 @@ func TestGQLDB(t * testing.T) { RandID(), TestThreadNodeType, NewACLExt(&t1_policy_1, &t1_policy_2), - t1_thread, - NewLockableExt(nil, nil, nil, nil)) + t1_thread) ctx.Log.Logf("test", "T1_ID: %s", t1.ID) key, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) @@ -58,24 +54,21 @@ func TestGQLDB(t * testing.T) { fatalErr(t, err) gql_ext := NewGQLExt(":0", ecdh.P256(), key, nil, nil) + listener_ext := NewListenerExt(10) gql := NewNode(ctx, RandID(), GQLNodeType, gql_thread, gql_ext, + listener_ext, NewACLExt(&gql_p1, &gql_p2), - NewGroupExt(nil), - NewLockableExt(nil, nil, nil, nil)) + NewGroupExt(nil)) ctx.Log.Logf("test", "GQL_ID: %s", gql.ID) info := ParentInfo{true, "start", "restore"} context := NewWriteContext(ctx) err = UpdateStates(context, u1, ACLMap{}, func(context *StateContext) error { - err := LinkThreads(context, u1, gql, ChildInfo{t1, map[InfoType]Info{ + return LinkThreads(context, u1, gql, ChildInfo{t1, map[InfoType]Info{ ParentInfoType: &info, }}) - if err != nil { - return err - } - return LinkLockables(context, u1, l1, []*Node{gql}) }) fatalErr(t, err) @@ -109,13 +102,8 @@ func TestGQLDB(t * testing.T) { context = NewReadContext(ctx) err = UseStates(context, gql_loaded, NewACLInfo(gql_loaded, []string{"users", "children", "requirements"}), func(context *StateContext) error { ser, err := gql_loaded.Serialize() - lockable_ext, err := GetExt[*LockableExt](gql_loaded) - if err != nil { - return err - } ctx.Log.Logf("test", "\n%s\n\n", ser) - dependency := lockable_ext.Dependencies[l1.ID] - listener_ext, err = GetExt[*ListenerExt](dependency) + listener_ext, err = GetExt[*ListenerExt](gql_loaded) if err != nil { return err } diff --git a/gql_types.go b/gql_types.go index 1eaf9b4..529bb7d 100644 --- a/gql_types.go +++ b/gql_types.go @@ -43,7 +43,7 @@ func AddThreadFields(object *graphql.Object) { } func addThreadFields(object *graphql.Object, thread_interface *graphql.Interface, thread_list *graphql.List) { - AddLockableFields(object) + AddNodeFields(object) object.AddFieldConfig("State", &graphql.Field{ Type: graphql.String, @@ -63,7 +63,7 @@ func addThreadFields(object *graphql.Object, thread_interface *graphql.Interface var GQLNodeInterfaces = []*graphql.Interface{GQLInterfaceNode.Interface} var GQLLockableInterfaces = append(GQLNodeInterfaces, GQLInterfaceLockable.Interface) -var GQLThreadInterfaces = append(GQLLockableInterfaces, GQLInterfaceThread.Interface) +var GQLThreadInterfaces = append(GQLNodeInterfaces, GQLInterfaceThread.Interface) var GQLTypeGQLNode = NewGQLNodeType(GQLNodeType, GQLThreadInterfaces, func(gql *GQLType) { AddThreadFields(gql.Type) diff --git a/thread.go b/thread.go index 0a00c82..875285b 100644 --- a/thread.go +++ b/thread.go @@ -648,10 +648,6 @@ func ThreadRestore(ctx * Context, thread *Node, thread_ext *ThreadExt, start boo func ThreadStart(ctx * Context, thread *Node, thread_ext *ThreadExt) (string, error) { context := NewWriteContext(ctx) err := UpdateStates(context, thread, NewACLInfo(thread, []string{"state"}), func(context *StateContext) error { - err := LockLockables(context, map[NodeID]*Node{thread.ID: thread}, thread) - if err != nil { - return err - } return thread_ext.SetState("started") }) if err != nil { @@ -695,11 +691,7 @@ func ThreadWait(ctx * Context, thread *Node, thread_ext *ThreadExt) (string, err func ThreadFinish(ctx *Context, thread *Node, thread_ext *ThreadExt) (string, error) { context := NewWriteContext(ctx) return "", UpdateStates(context, thread, NewACLInfo(thread, []string{"state"}), func(context *StateContext) error { - err := thread_ext.SetState("finished") - if err != nil { - return err - } - return UnlockLockables(context, map[NodeID]*Node{thread.ID: thread}, thread) + return thread_ext.SetState("finished") }) }