@@ -7,6 +7,12 @@ import (
77 "go.uber.org/zap"
88)
99
10+ /*
11+ Notes: the structure of scheduler is very modular
12+ Docs must be updated for replacing a certain scheduler module with another
13+ This includes installation of prebuilt module or developing a module
14+ */
15+
1016/* FCFS Scheduler attached with curSession.Manager */
1117type FCFSScheduler struct {
1218 curSessionManager * session.Manager
@@ -29,6 +35,7 @@ func (f *FCFSScheduler) Run(ctx context.Context) error {
2935 default :
3036 /* RULE: ctx is propogates all over the coming functions */
3137
38+ /* get next session in the queue (round robin manner) */
3239 curSession := f .curSessionManager .GetNextSession ()
3340 if curSession == nil {
3441 /* might need a delay of 10 ms */
@@ -54,8 +61,13 @@ func (f *FCFSScheduler) Run(ctx context.Context) error {
5461 /* defer clearing the semaphore channel */
5562 defer func () { <- f .semaphore }()
5663
57- /* process the transaction */
58- if err := f .processTransaction ; err != nil {
64+ /*
65+ process the transaction
66+ * processTransaction handles transaction processing completely
67+ * now it is responsible now responsible to execute it
68+ * role of scheduler in handling transactions ends here
69+ */
70+ if err := f .processTransaction (ctx , curSession , transaction ); err != nil {
5971 zap .L ().Error ("Faild to process transaction" ,
6072 zap .Error (err ),
6173 )
0 commit comments