Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] [reconfigurator] introduce a simulator, make CLI use it #6856

Draft
wants to merge 3 commits into
base: sunshowers/spr/main.wip-reconfigurator-introduce-a-simulator-make-cli-use-it
Choose a base branch
from

Conversation

sunshowers
Copy link
Contributor

For non-deterministic testing, it's useful to have a higher-level notion of a
succession of system states, which can be inspected, rewound, and other
branches explored as desired. Introduce this via a new Simulator struct.

The individual states are roughly identical to the existing
ReconfiguratorSim in the CLI, and are a pretty standard tree structure. For
now I've chosen not to use a Merkle tree, just a UUID-based tree, but if
there's a good use case for it we may choose to make it a Merkle tree in the
future.

I've added a few basic features like storing the log of changes (though it's
not complete... I think I'll want to make SystemDescription follow the same
structure with read-only and mutable versions.)

As a proof of concept, this PR also rebuilds the current reconfigurator-cli
script on top of the simulator. I've not made any functional changes to the
CLI, but hope to add features like looking at the tree of states and undoing
them, and with non-deterministic testing to be able to load up the tree of
states.

The simulator uses a bunch of structural sharing via Arc. I was wondering
whether I could use the im crate, but it doesn't seem to have an IndexMap
equivalent, but it doesn't seem to have an IndexMap equivalent that I could
tell. The Arcs should make cloning cheap enough that I don't think it's an
issue in any case. (There's a comment in the PR about why I haven't used an
object-store-like style instead -- it's just easier to use Arc for now.)

There's a bunch of work to be done before this can be landed, but I wanted to
put it up for folks to have an early look.

TODO fill this out in more detail.

Created using spr 1.3.6-beta.1
@@ -0,0 +1,3 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: remove this file

//!
//! This library contains facilities to track and simulate successive system
//! states in the face of reconfiguration events. The library uses an operation
//! log internally to make it possible to rewind to previous states.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: expand on this

Comment on lines +811 to +813
struct SubnetIterator {
subnets: Ipv6Subnets,
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can split this into its own PR.


use crate::errors::{DuplicateError, MissingError, NonEmptySystemError};

/// A versioned, simulated reconfigurator system.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More documentation.

Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant