Skip to content

Instantly share code, notes, and snippets.

@keroro520
Created October 18, 2018 10:12
Show Gist options
  • Save keroro520/830dcd1dadf236cfbe31bf4b9d9cbbfd to your computer and use it in GitHub Desktop.
Save keroro520/830dcd1dadf236cfbe31bf4b9d9cbbfd to your computer and use it in GitHub Desktop.
executor
# 执行线程
stage = "idle"
LOOP {
CASE stage {
"idle" => state = stage_idle();
"executing_proposal" => state = stage_executing_proposal();
}
}
FUNCTION stage_executing_proposal() {
LOOP {
IF an interruption event come {
handle_interrupt()
RETURN "idle"
} ELSE IF already done processing proposal {
handle_done_proposal()
RETURN "idle"
} ELSE {
continue to process next transaction
}
}
}
FUNCTION stage_idle() {
SWITCH {
receive ConsensusBlock event => ...
receive SyncBlock event => ...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment