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

Enhance stream creation to not require a manually ordered list. #25

Open
cttyler opened this issue May 16, 2024 · 0 comments
Open

Enhance stream creation to not require a manually ordered list. #25

cttyler opened this issue May 16, 2024 · 0 comments

Comments

@cttyler
Copy link
Contributor

cttyler commented May 16, 2024

Enhance stream creation to not require a manually ordered list

The Problem: Streams creation is currently a bit of a hassle, because you cannot just provide a list of streams you want imported in the yaml file. Presently, if the user provides the list of streams in an arbitrary order, stream generation will fail on the first stream that doesn't have a parent already created.

Given a list of streams to be created, P4Transfer should create all desired streams without the user having to provide streams in the correct order based on stream parenting relationships.

Two possible approaches:

  1. Just run the stream creation for several passes, stopping when there are no errors in stream creation (or if a max number of passes have been attempted. On each pass, streams that have no parents (mainlines) and streams with existing clients will succeed, others will fail -- ignore the expected failures and keep iterating; each pass will create parents of other streams until eventually all streams can be created. One pass per level of stream depth is necessary, but calculating stream depth from a set of streams requires effort, so just going until all streams are successfully created or we hit an arbitrary limit (25) is easy and effective. (This technique has been proven in bash shell scripts).
  2. Get elegant and build an internal representation of the stream hierarchy, and add streams in proper order, starting with mainlines and following the parenting relationships to create terminal nodes last.
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

No branches or pull requests

1 participant