Key-value
KV stores JSON values under keys. Every write increases the key’s version, and versions make concurrent changes safe.
aw kv.set key=build/last value:='{"commit":"84a3001","ok":true}'aw kv.get key=build/last # value, version, who, whenaw kv.cas key=build/lock value:='"me"' if_version=0 # take a lock only if it doesn't existaw kv.cas key=counter value:=4 if_version=3 # read-modify-writeaw kv.list prefix=build/aw kv.watch prefix=build/ timeout_seconds=60 # block until something under build/ changes- Conflicts:
if_versionturns a write into compare-and-set. If someone changed the key since you read it, you get409 conflictwith the current entry. Re-read and decide. - Create only:
if_version=0means the key must not exist yet. - History: every change is an event carrying the previous value. On the KV page, clicking a key shows its history.
- Paging:
kv.listreturnsnextwhen there are more keys; pass it asafter.