as a user
history of cycle handling in salsa
db.query(a)
...
db.query(b)
...
db.query(a)
in salsa
you tag a query q
with #[salsa::recover(some_fn)]
q
…
some_fn
which will yield a resultsalsa::Cycle
DatabaseKeyIndex
#[salsa::recover]
wait_results
map and completes normallyunblock_runtimes_blocked_on(B2, result)
method on the runtimewait_results
mapnotify_one
on the condvar, which wakes up thread Ablock_on_or_unwind(A2)(
step 1:
Identify the cycle participants:
v = vec![A2, A3, B2, B3]
WaitResult::Cycle
suppose A2/B2 both have recovery
v = vec![A2, A3, B2, B3]
WaitResult::Cycle
guarantee that
then you will see the recovery
true no matter where the cycle started
what if A1 and A2 had recovery set?
silly compiler:
parser(input-text) = vec[item]
item = class | function
parse_file() -> Vec<Item>
process_all_items
let p = parse_file().len();
for i in 0..p { process_item(i); }
parse_file()[i]
– very wrongentity Item {
... class | function ...
}
Item::new(db, data)
Item
Item
is just an integer (newtype'd)vec[item]
process_all_items
for item in parser() { process_item(item); }
process_item(item: Item)
item.field1(db)
item.field1
graph:
[parser-query: vec[item]]
^ |
| v
[entity: Item 0]
[data: record when this field last changed] <–- process_item(Item 0)
[entity: Item 1]
[entity: Item 0]
or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing