sched: Have per-scheduler type data in a channel_t
Right now in
channel_t, we have a
scheduler_state. Both are specific to the scheduler layer and are per-channel. The KIST scheduler also keeps data per-channel in a global state it keeps some other place.
Because of #23744 (moved), which is a ticket about the scheduler state not applying to both Vanilla and KIST, we need a way to have a interface that allows any "scheduler data per-channel" to be specific to a type of scheduler (KIST or Vanilla).
To achieve compartmentalization of whatever state the scheduler needs to keep, we need an interface that allows a specific scheduler to store data per-channel instead of in a global state which, in the case of KIST, would avoid two things:
Huge amount of memory allocation at runtime that needs to be done by the main loop (this is currently a problem with KIST code).
Avoid data duplication or/and synchronization problem between the channel subsystem and the scheduler subsystem.
Finally, by doing so, we can build an opaque interface for the specific scheduler information data structure in order to make them ONLY accessible from the per-type scheduler code. This means a builtin protection to prevent any other layer in the tor to change or access the channel's scheduler state.
Once we have this capability, we can go ahead and fix #23744 (moved) and move the
scheduler_state out of a channel object so ONLY the scheduler has access to those and be able to have different semantic for different scheduler type.