oxidecomputer / oxidecomputer/omicron
ImportExportPolicy::Allow - use a set instead of a vec?
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 572
- Forks
- 97
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 96
Description
The current definition of ImportExportPolicy is
pub enum ImportExportPolicy {
/// Do not perform any filtering.
#[default]
NoFiltering,
Allow(Vec<oxnet::IpNet>),
}
Putting the same Ipnet value inside the Allow(_) case multiple times fails at database insertion time. We could use a BTreeSet<oxnet::IpNet> instead, preventing duplicate values at the type level.
Should we permit ImportExportPolicy::Allow(_) with an empty set/list IpNets to allow? Or is the expectation that Allow(_) always has at least one entry?
(This came up working on some related unit tests in the context of #9832.)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read the ImportExportPolicy definition and the related unit tests mentioned in #9832 first. Resolve whether Allow may contain zero IpNet values and whether BTreeSet is the intended representation; done means the policy semantics and duplicate-handling behavior are agreed and covered by the relevant tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api, backend, databases
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100