solve problem of endless creation of new node_ids. we derive the id from
the node_name, insuring there are no duplicates.
our method for doing this right now is very weird- we convert the String
node_name into a u64. going forward we will likely replace the node_id
with a hash to be more straightforward.
instead of making several info hashmaps like so:
node_info = HashMap<NodeId, NodeInfo>
session_info = HashMap<SessionId, SessionInfo>
we make a single info hashmap:
infos = HashMap<Id, SelectableObject>
this is so we can keep track of what kind of selectable object the ID is
associated with.
we create 3 types of info objects, NodeInfo, ConnectInfo, and
SessionInfo. NodeInfo is the parent and ConnectInfo and SessionInfo are children.
These info objects are passed into an enum:
enum SelectableObject {
Node(NodeId)
Session(SessionId)
Connect(ConnectId)
}
We protect this data using mutexes and write it to a hashmap:
Mutex<FxHashMap<u32, SelectableObject>
View has not yet been updated with this new design.
discard empty connections efficiently and only render when is_empty
== false.
for outbound connections, use iter().all() to ensure that is_empty is
only set to false when all slots are empty.
Previously, we were trying to render messages using a seperate widget
called Paragraph. This would enable us to put msgs on the right of the
screen using the enum Alignment.
However, rendering msgs as a seperate widget meant we had to keep track
of the position of other widgets in order to align properly. This quickly
became highly complex.
Instead, we have now rendered all the data in a single widget called List.
List is composed of a ListItem which is composed of Spans. Spans
indiciate a seperate line whereas Span is a grapheme on a single line.
We render addrs and msgs on the same line as follows:
lines.push(Spans::from(vec![addr, msgs])
Where lines is a Vec<Spans> that initializes ListItem.
We are currently aligning the msgs Span with empty spaces, which is the
method used by tui-rs/example/list.rs. Ideally we would use some variant
of Alignment for this so we don't have variation between screen sizes.
get_and_draw_outbound():
* loop through the slots of every outbound connection, instead of
just the first value (&connect.outbound[0])
* recursively initialize and draw new widgets for each node instead
of writing everything to the same vectors and frame.
get_and_draw_inbound()
* recursively initialize and draw new widgets for each node instead
of writing everything to the same vectors and frame.