(t NodeType, id string, entity interface{}, annotations string)
| 341 | } |
| 342 | |
| 343 | func (g *Graph) CreateNode(t NodeType, id string, entity interface{}, annotations string) (*Node, error) { |
| 344 | g.Lock() |
| 345 | defer g.Unlock() |
| 346 | |
| 347 | node := &Node{ |
| 348 | Type: t, |
| 349 | ID: id, |
| 350 | Entity: entity, |
| 351 | Annotations: annotations, |
| 352 | } |
| 353 | |
| 354 | nodeFileName := path.Join(g.path, fmt.Sprintf("%s.json", node.String())) |
| 355 | if err := CreateNode(nodeFileName, node); err != nil { |
| 356 | return nil, err |
| 357 | } |
| 358 | |
| 359 | session.I.Events.Add("graph.node.new", node) |
| 360 | |
| 361 | return node, nil |
| 362 | } |
| 363 | |
| 364 | func (g *Graph) UpdateNode(node *Node) error { |
| 365 | g.Lock() |
no test coverage detected