January 2019
Intermediate to advanced
520 pages
14h 32m
English
We will also add the SharedTasks type alias, which represents an IndexMap wrapped with Mutex and Arc. We will use this type to store all the tasks and statuses for them:
type SharedTasks = Arc<Mutex<IndexMap<String, Record>>>;
Record is a struct that contains the unique identifier of the task, and is used as the correlation ID for the message. It also has a timestamp that denotes when the task was posted, and a Status that represents the status of the task:
#[derive(Clone)]struct Record { task_id: TaskId, timestamp: DateTime<Utc>, status: Status,}
Status is an enumeration that has two variants: InProgress, when a task is sent to a worker; and Done, when a worker returns a response as a QrResponse value:
#[derive(Clone)]enum Status ...
Read now
Unlock full access