stop exposing nodes outside of dag.go to fix potential race conditions.

This is a follow-up of this discussion required to fix races detected while running go test -race ./... proposed in !576 (closed)

This MR is globally cleaning the dag interface by clearly separating Node and FluxObject roles:

  • Nodes are only dag vertexes, used to store references to FluxObjects
  • FluxObjects store all the attributes about topology and readyness alongside the flux object itself

Change all the ObjectMap interface to only expose FluxObject and ObjectList that are made thread-safe using a RWlock in this MR.

It'll be easier to review this MR one commit at a time:

  • The first commit moves watched and reconciled attributes to FluxObject an add a mutex lock this object's methods. This way client modules like watch.go won't need to access node objects any more.
  • The second commit removes the exposition of Nodes outisde of dag.go, it exposes FluxObjects that are thread-safe instead. Node interface is made internal by renaming it to dagNode
  • The last commit is only remaining references to Node in watch.go in variables and comments.

Relates-to

Edited by Thomas Morin

Merge request reports

Loading
Loading