In my search for all the Golang channels, I stumbled across several that were their own independent ecosystem and would just add clutter if included in the bigger diagrams. They're less interesting in terms of relevancy to the protocol but still an important function inside the code.
This thread is going to be a collection for these.
Legend for Channel Diagrams:
Clouds are external areas, or areas not detailed in this diagram.
Dot-Outlined areas are the entities responsible for this behavior.
Green boxes are Golang channels. The title bar consists of
Top Level Containers are specific functions responsible for reading or sending on channels. I included the function name (minus parameters passed) in the title bar, so you can search the codebase to find out what they do in detail
Containers inside Top Level Containers are either subfunctions or just "steps" that I thought were worth noting.
Lists inside Top Level Containers are the ones with dashed separators and [*] in the title. They're a list of valid message types.
Arrows going to and from channels denote a message being added or read from a channel. I tried to label them as best as I could with the actual message type sent along the path, where asterisks denote multiple types.
Olive arrows mean there's a loop involved.
First up: ShutdownChan
This channel is what happens when someone hits Ctrl+C on their keyboard. The arrows are mostly unlabeled in this one because the underlying code triggers on any input. The code just sends "0" to these channels. Another oddity is that apart from State, all the channels are available in local scope only.
Q: I don't care how this works, I just want to use it. What do I need to know?
A: Pass a function to
Diagram:

Direct Link
View original on draw.io
This thread is going to be a collection for these.
Legend for Channel Diagrams:
Clouds are external areas, or areas not detailed in this diagram.
Dot-Outlined areas are the entities responsible for this behavior.
Green boxes are Golang channels. The title bar consists of
entity.channelname, type, capacity
as they are defined with default values.Top Level Containers are specific functions responsible for reading or sending on channels. I included the function name (minus parameters passed) in the title bar, so you can search the codebase to find out what they do in detail
Containers inside Top Level Containers are either subfunctions or just "steps" that I thought were worth noting.
Lists inside Top Level Containers are the ones with dashed separators and [*] in the title. They're a list of valid message types.
Arrows going to and from channels denote a message being added or read from a channel. I tried to label them as best as I could with the actual message type sent along the path, where asterisks denote multiple types.
Olive arrows mean there's a loop involved.
First up: ShutdownChan
This channel is what happens when someone hits Ctrl+C on their keyboard. The arrows are mostly unlabeled in this one because the underlying code triggers on any input. The code just sends "0" to these channels. Another oddity is that apart from State, all the channels are available in local scope only.
Q: I don't care how this works, I just want to use it. What do I need to know?
A: Pass a function to
AddInterruptHandler()
and it will be executed when the system is shut down via console.Diagram:

Direct Link
View original on draw.io