
The basic workflow is: * Set the state read-only * Rebuild the change if it's out of date * Flip the state to primary There are various atomic operations and double-checks at each point in this process, described in detail in the code. Change-Id: Ib3a2804adb9341a3673dea8a264387f0db7c819a