blob: d8d1d0dccaa63ad3fca1bee095d212fdb2f113f0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# The same editor with an authored size policy: an edit whose result would
# exceed 8 bytes fails as a whole, and nothing is stored.
state documents: bytes by key
input show = message by key
input edit = message by key {
start: u32
remove: u32
insert: bytes
}
on show {
reply documents[key]
}
on edit {
documents[key].replace(edit.start .. edit.start + edit.remove, edit.insert)
require documents[key].bytes <= 8
reply edit.insert
}
|