factor out locking, towards full document persistence abstraction
refined mutex abstraction
documentation