spork-state
spork-state 0.2.1
Thread-safe validated and observable atoms with one Spork implementation and typed Python API.
spork-state provides Atom, a mutable reference whose updates are synchronized, validated before commit, and observed through synchronous watches. Its implementation and declarations are written in Spork; package builds generate both the public Spork namespace and typed Python facade.
Install#
Python projects:
python -m pip install "spork-state==0.2.1"
Spork projects declare the compatible stable line in spork.it and synchronize:
:dependencies ["spork-state>=0.2,<0.3"]
spork sync
Contract#
- updates, validator replacement, and compare-and-set are linearizable;
- swap functions run exactly once under a reentrant lock;
- validators run before commit;
- watches run synchronously after commit and outside the lock;
- identity, rather than equality, controls compare-and-set and notification; and
- atom synchronization does not make a mutable stored object safe to mutate.
Continue with the practical guide, API reference, and concurrency design.