Conversation
task.h
Outdated
| /* The scheduling_state can be used as a flag when we are listening for an event, | ||
| * for example TASK_WAITING | TASK_SCHEDULED. */ | ||
| enum scheduling_state { | ||
| TASK_WAITING = 0, |
There was a problem hiding this comment.
I think that if we're going to use bitmasks to filter these, we will probably need to start the enum at 1, not 0 (otherwise, we can't differentiate between an event that we didn't register for and TASK_WAITING).
There was a problem hiding this comment.
Yes, I am changing this
task.h
Outdated
| TASK_DONE = 4 | ||
| }; | ||
|
|
||
| typedef struct scheduled_task_impl scheduled_task; |
There was a problem hiding this comment.
Maybe scheduled_task -> assigned_task?
There was a problem hiding this comment.
I'm renaming it to task_instance now, which is what it really is! We are already using the assign terminology to refer to assigning tasks to workers, so it is not great in the context I think.
state/task_log.h
Outdated
| #include "task.h" | ||
|
|
||
| /* Callback for subscribing to the task log. */ | ||
| typedef void (*task_log_callback)(scheduled_task* task, void *userdata); |
There was a problem hiding this comment.
Can we add the state of the task to the arguments of the callback?
There was a problem hiding this comment.
It is in scheduled_task
The task queue is replaced by a task log, which is an append only datastructure (a hash table from task_iids to a list of scheduling updates). It reflects a message bus api and is used for pub/sub and also to store the task log in redis to make the pub/sub reliable when clients are disconnected.
There is a new datastructure, scheduled_task which is the information that is sent around to the schedulers via pub sub and can be reconstructed from the task log.