Zone instances and IDs#528
Conversation
|
Converting to draft while I consider adding some more state. |
This will replace 'ZoneState::{signed,unsigned}' with a dedicated module
and track more information there.
Instance IDs are now threaded through all relevant code. This will serve as a better replacement for serial numbers for review.
|
@bal-e: My first thought when looking at this is that there seems to be a strong coupling between builder and instance state changes yet the two are decoupled, with the potential for forgetting to update one when changing the other, as evidenced even by the "// TODO: Update something in 'handle.state.instances.?" comment in the code. As an example, if we look at the I haven't looked far enough into the changes to understand if this pattern applies universally or not, could it be an idea to couple these concepts to avoid foot guns involving forgetting to update the instance and the storage at the same time? |
In this PR, or in another PR? |
ximon18
left a comment
There was a problem hiding this comment.
I'm having trouble reviewing this as I'm wondering why this introduces another state machine, and how that relates to the storage and zone state machines. The actual code is not that complex, but I think it would be good to sit with @bal-e and review it together to better understand the thinking behind this PR.
| #[derive(Debug, Default)] | ||
| pub struct Instances { | ||
| /// The ID of the next loaded instance. | ||
| pub next_loaded_id: u64, |
There was a problem hiding this comment.
Should these fields be pub? If we assume that the functions on this type manage this state, by being pub a user (with mut access) could change the state without going via the functions, is that wise?
Yes, I haven't touched this PR in a while because I need to rethink my approach. It took me a while to realize that I was accidentally building another state machine. I will rebase it on top of |
This PR introduces
zone/instance.rsfor tracking zone instances. It introduces{Loaded,Signed}InstanceIDas a way to uniquely identify loaded and signed instances of zones, respectively; unlike SOA serial numbers, instance IDs are guaranteed to be unique (even if two instances have the same SOA serial, or if an instance is rejected). The rest of the codebase has been integrated with this system, so IDs are correctly available at every step (except review to some extent; I will work on it next).The new state for instances will eventually replace the
.{unsigned,signed}fields ofZoneState. They will accumulate more instance-specific data, e.g. loader/signer statistics, diffs (for persistence, rollback, and IXFR out), maybe even logs/history.Cargo.*,crates/,etc/,integration-tests/,src/):actthrough theact-wrapper(as described inTESTING.md)?